workspace
stringclasses 1
value | channel
stringclasses 1
value | sentences
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
| sentence_id
stringlengths 44
53
| timestamp
float64 1.5B
1.56B
| __index_level_0__
int64 0
106k
|
---|---|---|---|---|---|---|---|
pythondev | help | I think youre doing it wrong | 2019-03-30T08:38:23.387900 | Hiroko | pythondev_help_Hiroko_2019-03-30T08:38:23.387900 | 1,553,935,103.3879 | 16,021 |
pythondev | help | you’re using it as a get? | 2019-03-30T08:39:18.388800 | Hiroko | pythondev_help_Hiroko_2019-03-30T08:39:18.388800 | 1,553,935,158.3888 | 16,022 |
pythondev | help | ok, use urlencode *just* for the `ipaddress` field | 2019-03-30T08:39:41.389500 | Hiroko | pythondev_help_Hiroko_2019-03-30T08:39:41.389500 | 1,553,935,181.3895 | 16,023 |
pythondev | help | eg ```
data = {
'maxAgeInDays': 90,
'ipAddress': urllib.parse.urlencode('125.19.180.206`)
}
``` | 2019-03-30T08:40:34.390500 | Hiroko | pythondev_help_Hiroko_2019-03-30T08:40:34.390500 | 1,553,935,234.3905 | 16,024 |
pythondev | help | Hello everyone!
I have question about for KNN Algorithm... How can I improve my accuracy score on KNN? | 2019-03-30T08:58:14.392300 | Ethyl | pythondev_help_Ethyl_2019-03-30T08:58:14.392300 | 1,553,936,294.3923 | 16,025 |
pythondev | help | I'm using pymongo find_raw_batches and it's internal bson class to decode the batches into json, but the documentation says ` in practice raw batches should be passed to an external library that can decode BSON into another data type, rather than used with PyMongo’s bson module.`. Does anyone have any recommendations on which library to use? pymongo bson does work but it seems to be a bit slow. | 2019-03-30T09:07:06.393600 | Dawn | pythondev_help_Dawn_2019-03-30T09:07:06.393600 | 1,553,936,826.3936 | 16,026 |
pythondev | help | good day all | 2019-03-30T09:46:19.393900 | Florencio | pythondev_help_Florencio_2019-03-30T09:46:19.393900 | 1,553,939,179.3939 | 16,027 |
pythondev | help | Continuing what I started, i have an error: | 2019-03-30T09:46:40.394300 | Florencio | pythondev_help_Florencio_2019-03-30T09:46:40.394300 | 1,553,939,200.3943 | 16,028 |
pythondev | help | ```
Exception Type: MultiValueDictKeyError
Exception Value: 'photo'
``` | 2019-03-30T09:46:54.394600 | Florencio | pythondev_help_Florencio_2019-03-30T09:46:54.394600 | 1,553,939,214.3946 | 16,029 |
pythondev | help | Model | 2019-03-30T09:47:54.395000 | Florencio | pythondev_help_Florencio_2019-03-30T09:47:54.395000 | 1,553,939,274.395 | 16,030 |
pythondev | help | Views | 2019-03-30T09:48:43.395500 | Florencio | pythondev_help_Florencio_2019-03-30T09:48:43.395500 | 1,553,939,323.3955 | 16,031 |
pythondev | help | <@Florencio> paste the entire stack trace | 2019-03-30T10:06:21.396300 | Hiroko | pythondev_help_Hiroko_2019-03-30T10:06:21.396300 | 1,553,940,381.3963 | 16,032 |
pythondev | help | There’s not much to go on | 2019-03-30T10:06:45.396800 | Hiroko | pythondev_help_Hiroko_2019-03-30T10:06:45.396800 | 1,553,940,405.3968 | 16,033 |
pythondev | help | None | 2019-03-30T10:07:36.397000 | Florencio | pythondev_help_Florencio_2019-03-30T10:07:36.397000 | 1,553,940,456.397 | 16,034 |
pythondev | help | Apparently `photo` is missing from your request | 2019-03-30T10:08:42.397900 | Hiroko | pythondev_help_Hiroko_2019-03-30T10:08:42.397900 | 1,553,940,522.3979 | 16,035 |
pythondev | help | But | 2019-03-30T10:25:32.398000 | Florencio | pythondev_help_Florencio_2019-03-30T10:25:32.398000 | 1,553,941,532.398 | 16,036 |
pythondev | help | It's there | 2019-03-30T10:25:33.398100 | Florencio | pythondev_help_Florencio_2019-03-30T10:25:33.398100 | 1,553,941,533.3981 | 16,037 |
pythondev | help | I thought it takes care of just saving the path to db | 2019-03-30T10:29:19.398500 | Florencio | pythondev_help_Florencio_2019-03-30T10:29:19.398500 | 1,553,941,759.3985 | 16,038 |
pythondev | help | It also copies the file to the destination you set in media | 2019-03-30T10:35:39.399600 | Hiroko | pythondev_help_Hiroko_2019-03-30T10:35:39.399600 | 1,553,942,139.3996 | 16,039 |
pythondev | help | can anyone help me at this, please?
<https://stackoverflow.com/questions/55430776/algorithm-to-calculate-the-profile-percentage-complete>
algorithm to calculate the profile percentage complete considering fk fields | 2019-03-30T10:35:42.399700 | Elenore | pythondev_help_Elenore_2019-03-30T10:35:42.399700 | 1,553,942,142.3997 | 16,040 |
pythondev | help | But your problem now is the photo field doesn't exist in the post request you're sending, <@Florencio> | 2019-03-30T10:36:59.400800 | Hiroko | pythondev_help_Hiroko_2019-03-30T10:36:59.400800 | 1,553,942,219.4008 | 16,041 |
pythondev | help | and I don't even know what to think now | 2019-03-30T10:37:36.401100 | Florencio | pythondev_help_Florencio_2019-03-30T10:37:36.401100 | 1,553,942,256.4011 | 16,042 |
pythondev | help | for files i'm not supposed to use `POST` | 2019-03-30T10:41:49.401600 | Florencio | pythondev_help_Florencio_2019-03-30T10:41:49.401600 | 1,553,942,509.4016 | 16,043 |
pythondev | help | wow... it's posting now but not the desired results | 2019-03-30T11:04:29.402300 | Florencio | pythondev_help_Florencio_2019-03-30T11:04:29.402300 | 1,553,943,869.4023 | 16,044 |
pythondev | help | ```
def get_upload_path(instance, filename):
return os.path.join(
"products_%s" % instance.slug, filename)
```
this is not giving what i want | 2019-03-30T11:05:08.402800 | Florencio | pythondev_help_Florencio_2019-03-30T11:05:08.402800 | 1,553,943,908.4028 | 16,045 |
pythondev | help | I wanted base on the name of the event happening, it will create a folder with that name and save the image in it | 2019-03-30T11:06:27.403700 | Florencio | pythondev_help_Florencio_2019-03-30T11:06:27.403700 | 1,553,943,987.4037 | 16,046 |
pythondev | help | this way will create lots of folders which will be hard for me to use the `src` attribute of the `img` tag | 2019-03-30T11:42:27.406000 | Florencio | pythondev_help_Florencio_2019-03-30T11:42:27.406000 | 1,553,946,147.406 | 16,047 |
pythondev | help | This is 100% dependent on the problem you're solving. However, the best way to improve your accuracy is to throw more training data at it. Even naive, ridiculously-stupid ML algorithms can get extremely good results if you just give them a large enough dataset. | 2019-03-30T11:44:41.406100 | Carmen | pythondev_help_Carmen_2019-03-30T11:44:41.406100 | 1,553,946,281.4061 | 16,048 |
pythondev | help | Alternate possibilities:
Increase your `k` value.
Reduce the number of features you're using. | 2019-03-30T11:48:14.406300 | Carmen | pythondev_help_Carmen_2019-03-30T11:48:14.406300 | 1,553,946,494.4063 | 16,049 |
pythondev | help | <https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm> has a good overview of various things you can do to help get your algorithm behaving the way you want it. | 2019-03-30T11:48:39.406500 | Carmen | pythondev_help_Carmen_2019-03-30T11:48:39.406500 | 1,553,946,519.4065 | 16,050 |
pythondev | help | Little help with timezone, please?
I have a backend that adds a bunch of time.
First, I saved the timestamp;
```
self._timestamp = datetime.datetime.fromtimestamp(1553944144)
# result datetime.datetime(2019, 3, 30, 20, 43, 38)
# 1553944144 = Saturday, March 30, 2019 8:09:04 PM GMT+09:00
```
Then add the timestamp and return it to the client;
```
arrival_time = self._timestamp + datetime.timedelta(seconds=g['walking_time']);
departure_time = self._timestamp;
# arrival_time 2019-03-30 20:11:21
# departure_time 2019-03-30 20:41:21
d1.source_to_dest = {
'arrival_time': arrival_time,
'departure_time': departure_time
}
```
The above part works well but when I check the returned value on the client side, it shows;
```
arrival_time: "Sun, 31 Mar 2019 00:26:08 GMT"
```
As you can see it removes the offset `+09:00`, not sure what I did wrong there. | 2019-03-30T12:21:35.410800 | Emelina | pythondev_help_Emelina_2019-03-30T12:21:35.410800 | 1,553,948,495.4108 | 16,051 |
pythondev | help | That's arguably the correct thing for the server to do, since the original timezone was just coming from the server's local time, rather than the client's timezone. What backend library are you using? | 2019-03-30T12:45:45.412800 | Sasha | pythondev_help_Sasha_2019-03-30T12:45:45.412800 | 1,553,949,945.4128 | 16,052 |
pythondev | help | hey <@Hiroko>, I managed to achieve `--data-urlencode "ipAddress=125.19.180.206"` in my python code, | 2019-03-30T13:13:24.414100 | Soo | pythondev_help_Soo_2019-03-30T13:13:24.414100 | 1,553,951,604.4141 | 16,053 |
pythondev | help | :stuck_out_tongue: | 2019-03-30T13:13:34.414700 | Soo | pythondev_help_Soo_2019-03-30T13:13:34.414700 | 1,553,951,614.4147 | 16,054 |
pythondev | help | None | 2019-03-30T13:14:29.415000 | Soo | pythondev_help_Soo_2019-03-30T13:14:29.415000 | 1,553,951,669.415 | 16,055 |
pythondev | help | Hello again,
Many thanks your feedback!
Please keep in touch to together
Thanks a lot! | 2019-03-30T13:16:26.416200 | Ethyl | pythondev_help_Ethyl_2019-03-30T13:16:26.416200 | 1,553,951,786.4162 | 16,056 |
pythondev | help | How would I access the url field within the serializer below for the actions.href? (using django rest framework)
```
class TodoSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
fields = ('id','title','description','url')
model = Todo
actions = [
{
"name": "delete-todo",
"title": "Delete this Todo",
"method": "DELETE",
"href": HERE I WOUKD LIKE THE CURRENT TODOS URL,
}
]
``` | 2019-03-30T18:39:29.418000 | Novella | pythondev_help_Novella_2019-03-30T18:39:29.418000 | 1,553,971,169.418 | 16,057 |
pythondev | help | anyone have some good tools when to help build Tkinter GUIs? | 2019-03-30T18:45:32.419000 | Priscilla | pythondev_help_Priscilla_2019-03-30T18:45:32.419000 | 1,553,971,532.419 | 16,058 |
pythondev | help | Not sure if this what you meant, but I used the basic `datetime` library.
> since the original timezone was just coming from the server's local time,
But how come the `fromtimestamp` didn't pick up the offset? | 2019-03-30T20:43:20.419100 | Emelina | pythondev_help_Emelina_2019-03-30T20:43:20.419100 | 1,553,978,600.4191 | 16,059 |
pythondev | help | When I am using pyttsx3 I get this error `moduleNotFoundError: No module named 'pywintypes'` | 2019-03-30T21:32:27.419800 | Rodrick | pythondev_help_Rodrick_2019-03-30T21:32:27.419800 | 1,553,981,547.4198 | 16,060 |
pythondev | help | do you have pywin32 installed? if not, maybe try that? | 2019-03-30T21:54:28.420500 | Marth | pythondev_help_Marth_2019-03-30T21:54:28.420500 | 1,553,982,868.4205 | 16,061 |
pythondev | help | Any slack channel for statsmodels? | 2019-03-31T03:47:18.427000 | Ok | pythondev_help_Ok_2019-03-31T03:47:18.427000 | 1,554,004,038.427 | 16,062 |
pythondev | help | Hi guys any advice on <https://pythondev.slack.com/archives/C07EFMZ1N/p1553962895410800>
I've tried;
```
local_tz = pytz.timezone('Asia/Tokyo')
self._timestamp = datetime.datetime.fromtimestamp(kwargs['timestamp'], local_tz)
```
Still not working | 2019-03-31T04:30:21.428100 | Emelina | pythondev_help_Emelina_2019-03-31T04:30:21.428100 | 1,554,006,621.4281 | 16,063 |
pythondev | help | <@Marth> “Pywin32” is installed | 2019-03-31T08:04:06.429200 | Rodrick | pythondev_help_Rodrick_2019-03-31T08:04:06.429200 | 1,554,019,446.4292 | 16,064 |
pythondev | help | have you looked at the project’s github? | 2019-03-31T08:08:00.429500 | Hiroko | pythondev_help_Hiroko_2019-03-31T08:08:00.429500 | 1,554,019,680.4295 | 16,065 |
pythondev | help | there’s a couple things about pywintypes in the issues, maybe something there can help | 2019-03-31T08:08:17.430000 | Hiroko | pythondev_help_Hiroko_2019-03-31T08:08:17.430000 | 1,554,019,697.43 | 16,066 |
pythondev | help | <@Emelina> I would look at what the follow up comment to your question is. that’s expected behavior | 2019-03-31T08:11:10.430900 | Hiroko | pythondev_help_Hiroko_2019-03-31T08:11:10.430900 | 1,554,019,870.4309 | 16,067 |
pythondev | help | you should do locale transforms in the client, not the server | 2019-03-31T08:11:22.431200 | Hiroko | pythondev_help_Hiroko_2019-03-31T08:11:22.431200 | 1,554,019,882.4312 | 16,068 |
pythondev | help | keep your timestamps UTC in the db, and let the recieving end transform to local time | 2019-03-31T08:11:43.431700 | Hiroko | pythondev_help_Hiroko_2019-03-31T08:11:43.431700 | 1,554,019,903.4317 | 16,069 |
pythondev | help | why do you feel it is hackish? | 2019-03-31T08:15:43.433000 | Hiroko | pythondev_help_Hiroko_2019-03-31T08:15:43.433000 | 1,554,020,143.433 | 16,070 |
pythondev | help | lol | 2019-03-31T08:42:08.433800 | Rodrick | pythondev_help_Rodrick_2019-03-31T08:42:08.433800 | 1,554,021,728.4338 | 16,071 |
pythondev | help | <@Hiroko> were you talking to me? | 2019-03-31T09:43:27.434300 | Rodrick | pythondev_help_Rodrick_2019-03-31T09:43:27.434300 | 1,554,025,407.4343 | 16,072 |
pythondev | help | for pywintypes and github, yes | 2019-03-31T09:44:02.434600 | Hiroko | pythondev_help_Hiroko_2019-03-31T09:44:02.434600 | 1,554,025,442.4346 | 16,073 |
pythondev | help | Ok | 2019-03-31T09:47:05.434800 | Rodrick | pythondev_help_Rodrick_2019-03-31T09:47:05.434800 | 1,554,025,625.4348 | 16,074 |
pythondev | help | I’ll try that | 2019-03-31T09:47:13.435100 | Rodrick | pythondev_help_Rodrick_2019-03-31T09:47:13.435100 | 1,554,025,633.4351 | 16,075 |
pythondev | help | that can be a basic step in your problem solving process | 2019-03-31T09:48:34.435500 | Hiroko | pythondev_help_Hiroko_2019-03-31T09:48:34.435500 | 1,554,025,714.4355 | 16,076 |
pythondev | help | especially with open source projects on github | 2019-03-31T09:48:47.435900 | Hiroko | pythondev_help_Hiroko_2019-03-31T09:48:47.435900 | 1,554,025,727.4359 | 16,077 |
pythondev | help | “has anyone had this issue before on the project issue board?” | 2019-03-31T09:48:58.436200 | Hiroko | pythondev_help_Hiroko_2019-03-31T09:48:58.436200 | 1,554,025,738.4362 | 16,078 |
pythondev | help | Ok | 2019-03-31T10:20:23.436400 | Rodrick | pythondev_help_Rodrick_2019-03-31T10:20:23.436400 | 1,554,027,623.4364 | 16,079 |
pythondev | help | Hi friends, I have two doubts
1) I need help in python package making.
Basically, there's a repo on github written in python and cython.
Currently, it requires cloning, installing gcc and python dependencies to build and run it which is not easy way for new inexperienced users.
I want to make a python package so that it will have a common installation procedure on all platforms(windows, linux)
$ pip install <package>
will it possible considering it requires gcc to build.
2) To help the new users (considering it requires installing gcc and many things which have different installation procedure depending on platforms), I am also looking to make a standalone package to ship and came across PyInstaller. Will it work considering it requires something to pack that doesn't belongs to python(gcc). | 2019-03-31T11:00:24.446400 | Beckie | pythondev_help_Beckie_2019-03-31T11:00:24.446400 | 1,554,030,024.4464 | 16,080 |
pythondev | help | Sorry for the late reply <@Carmen> , I did not, so your help would be appreciated. | 2019-03-31T11:01:19.446500 | Henrietta | pythondev_help_Henrietta_2019-03-31T11:01:19.446500 | 1,554,030,079.4465 | 16,081 |
pythondev | help | I need to generate some HTML, PHP and Javascript, and I was thinking of using a JSON file to set the needed variables, but not really sure the best way to structure this project | 2019-03-31T11:02:12.446700 | Henrietta | pythondev_help_Henrietta_2019-03-31T11:02:12.446700 | 1,554,030,132.4467 | 16,082 |
pythondev | help | ```for turn in range(4):
print "Turn %d" % turn + 1``` | 2019-03-31T11:03:08.447100 | Latanya | pythondev_help_Latanya_2019-03-31T11:03:08.447100 | 1,554,030,188.4471 | 16,083 |
pythondev | help | i tried this in my code. | 2019-03-31T11:03:33.447600 | Latanya | pythondev_help_Latanya_2019-03-31T11:03:33.447600 | 1,554,030,213.4476 | 16,084 |
pythondev | help | and i got following error | 2019-03-31T11:03:44.448000 | Latanya | pythondev_help_Latanya_2019-03-31T11:03:44.448000 | 1,554,030,224.448 | 16,085 |
pythondev | help | None | 2019-03-31T11:04:05.448100 | Latanya | pythondev_help_Latanya_2019-03-31T11:04:05.448100 | 1,554,030,245.4481 | 16,086 |
pythondev | help | None | 2019-03-31T11:04:30.448400 | Latanya | pythondev_help_Latanya_2019-03-31T11:04:30.448400 | 1,554,030,270.4484 | 16,087 |
pythondev | help | any idea? | 2019-03-31T11:04:33.448800 | Latanya | pythondev_help_Latanya_2019-03-31T11:04:33.448800 | 1,554,030,273.4488 | 16,088 |
pythondev | help | Use Python 3 | 2019-03-31T11:17:53.449100 | Jonas | pythondev_help_Jonas_2019-03-31T11:17:53.449100 | 1,554,031,073.4491 | 16,089 |
pythondev | help | print(“turn {}”.format(turn +1)) | 2019-03-31T11:18:28.449900 | Jonas | pythondev_help_Jonas_2019-03-31T11:18:28.449900 | 1,554,031,108.4499 | 16,090 |
pythondev | help | I'll throw out how I did the thing, and hopefully you can pick up some thoughts on how to handle it on your end. | 2019-03-31T11:19:21.450000 | Carmen | pythondev_help_Carmen_2019-03-31T11:19:21.450000 | 1,554,031,161.45 | 16,091 |
pythondev | help | The ultimate goal in my case was ".XLS -> PHP script", to do some one-time data importing for a client. | 2019-03-31T11:19:57.450200 | Carmen | pythondev_help_Carmen_2019-03-31T11:19:57.450200 | 1,554,031,197.4502 | 16,092 |
pythondev | help | I had the data source (.xls file), a Python script (using openpyxl to pull the data, and pipe it into Jinja2), and the Jinja2 template of the PHP script. | 2019-03-31T11:21:15.450400 | Carmen | pythondev_help_Carmen_2019-03-31T11:21:15.450400 | 1,554,031,275.4504 | 16,093 |
pythondev | help | In your case, since you have multiple files you need to output, I'd suggest having a templates directory, a data directory, and an output directory. | 2019-03-31T11:22:20.450600 | Carmen | pythondev_help_Carmen_2019-03-31T11:22:20.450600 | 1,554,031,340.4506 | 16,094 |
pythondev | help | If the data is tabular in nature, I'd honestly recommend you go with a spreadsheet of some kind. Maybe CSV if you have that export option from your data source. | 2019-03-31T11:22:58.450800 | Carmen | pythondev_help_Carmen_2019-03-31T11:22:58.450800 | 1,554,031,378.4508 | 16,095 |
pythondev | help | If the data is more varied and doesn't have a repeating structure, I'd recommend either a YAML file or a JSON file. | 2019-03-31T11:23:36.451000 | Carmen | pythondev_help_Carmen_2019-03-31T11:23:36.451000 | 1,554,031,416.451 | 16,096 |
pythondev | help | YAML is easier in my experience to build by hand, JSON is more common if you have an export option with your data source. | 2019-03-31T11:24:09.451200 | Carmen | pythondev_help_Carmen_2019-03-31T11:24:09.451200 | 1,554,031,449.4512 | 16,097 |
pythondev | help | Or if you're stuck in Python 2, you just need to parenthesize `(turn + 1)` so the addition happens before the string conversion. Alternately, you can change the `range()` to start with 1 instead of 0. | 2019-03-31T11:34:01.452600 | Sasha | pythondev_help_Sasha_2019-03-31T11:34:01.452600 | 1,554,032,041.4526 | 16,098 |
pythondev | help | I see, that's true | 2019-03-31T11:45:08.452700 | Henrietta | pythondev_help_Henrietta_2019-03-31T11:45:08.452700 | 1,554,032,708.4527 | 16,099 |
pythondev | help | I was thinking of having a verbose_name field for the HTML, since I am working with Brazilian Portuguese, and plurals are a problem | 2019-03-31T11:45:58.452900 | Henrietta | pythondev_help_Henrietta_2019-03-31T11:45:58.452900 | 1,554,032,758.4529 | 16,100 |
pythondev | help | Ultimately, the specifics are kind of dependent on your project. If you're generating PHP files, presumably to interact with the HTML files, you could probably do some dynamic translations on the fly when the PHP file generates the HTML page. | 2019-03-31T11:50:30.453100 | Carmen | pythondev_help_Carmen_2019-03-31T11:50:30.453100 | 1,554,033,030.4531 | 16,101 |
pythondev | help | will use python3. thnx. | 2019-03-31T12:30:18.454200 | Latanya | pythondev_help_Latanya_2019-03-31T12:30:18.454200 | 1,554,035,418.4542 | 16,102 |
pythondev | help | Does any one know any tools for creating project business diagram. For visualization of every step. | 2019-03-31T13:09:48.454400 | Aron | pythondev_help_Aron_2019-03-31T13:09:48.454400 | 1,554,037,788.4544 | 16,103 |
pythondev | help | ```import csv
with open('books.csv', newline='') as books_csv:
books_reader = csv.DictReader(books_csv, delimiter='@')
isbn_list = []
for row in books_reader:
isbn_list.append(row['ISBN'])
``` | 2019-03-31T13:11:59.454800 | Latanya | pythondev_help_Latanya_2019-03-31T13:11:59.454800 | 1,554,037,919.4548 | 16,104 |
pythondev | help | could any one help me why i have to use `newline` in `open` function? | 2019-03-31T13:12:21.455300 | Latanya | pythondev_help_Latanya_2019-03-31T13:12:21.455300 | 1,554,037,941.4553 | 16,105 |
pythondev | help | You may not have to use it. All that is saying is to not translate line endings to a standard `'\n'`. | 2019-03-31T13:16:52.456200 | Sasha | pythondev_help_Sasha_2019-03-31T13:16:52.456200 | 1,554,038,212.4562 | 16,106 |
pythondev | help | I typically use yEd, Dia, or LibreOffice depending on other team members want to use or what data import/export interaction requirement are. | 2019-03-31T13:53:14.456300 | Mora | pythondev_help_Mora_2019-03-31T13:53:14.456300 | 1,554,040,394.4563 | 16,107 |
pythondev | help | Hi Django enthusiasts, I have two questions on model serializers:
1) Is calling [modelserializer].save() the same as [model].save()?
2) When I try to serialize a model that has a foreign key to another model, what should I pass in as data parameter? | 2019-03-31T14:01:15.459000 | Darby | pythondev_help_Darby_2019-03-31T14:01:15.459000 | 1,554,040,875.459 | 16,108 |
pythondev | help | thank you so much ! | 2019-03-31T16:09:06.459300 | Deon | pythondev_help_Deon_2019-03-31T16:09:06.459300 | 1,554,048,546.4593 | 16,109 |
pythondev | help | <@Darby> to clarify, are you talking about django serializers or DRF serializers? | 2019-03-31T16:24:57.460200 | Hiroko | pythondev_help_Hiroko_2019-03-31T16:24:57.460200 | 1,554,049,497.4602 | 16,110 |
pythondev | help | funnelitics | 2019-03-31T19:49:21.460600 | Rodrick | pythondev_help_Rodrick_2019-03-31T19:49:21.460600 | 1,554,061,761.4606 | 16,111 |
pythondev | help | is one option | 2019-03-31T19:49:27.460800 | Rodrick | pythondev_help_Rodrick_2019-03-31T19:49:27.460800 | 1,554,061,767.4608 | 16,112 |
pythondev | help | can anyone suggest me a better algorithm for calculating the completeness of profile percentage, please? I could do the very basic one without considering fk fields(experiences, skills) but i want to consider that too.
```
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile")
full_name = models.CharField(max_length=100, blank=True, null=True)
age = models.PositiveSmallIntegerField(blank=True, null=True)
city = models.CharField(max_length=100, blank=True, null=True)
address = models.CharField(max_length=100, blank=True, null=True)
name_of_company = models.CharField(max_length=150, blank=True, null=True)
job_title = models.CharField(max_length=100, blank=True, null=True)
zip_code = models.PositiveSmallIntegerField(blank=True, null=True)
slogan = models.CharField(max_length=400, blank=True, null=True)
class Experience(models.Model):
profile = models.ForeignKey(Profile, on_delete=models.CASCADE, related_name="experience")
title = models.CharField(max_length=150, blank=False, null=False)
name_of_company = models.CharField(max_length=150, blank=False, null=False)
location = models.CharField(max_length=150, blank=False, null=False)
start_date = models.DateField(max_length=150, blank=False, null=False)
end_date = models.DateField(max_length=150, blank=False, null=False)
class Skill(models.Model):
profile = models.ForeignKey(Profile, on_delete=models.CASCADE, related_name="skill")
title = models.CharField(max_length=150, blank=False, null=False)
def calculate_profile_percentage(self, context):
fields = {'full_name': 10, 'age': 10, 'city': 10, 'address': 10}
completed_profile_percent = 0
try:
user = json.loads(context.get('user'))[0].get('pk')
profile_instance = model_to_dict(Profile.objects.get(user=user))
for field in profile_instance:
if fields.get(field) is not None:
print("field found", field)
completed_profile_percent += fields[field]
except Profile.DoesNotExist:
logger.error("Profile does not exist")
print("completed_profile_percent", completed_profile_percent)
return completed_profile_percent
``` | 2019-03-31T21:20:29.462700 | Elenore | pythondev_help_Elenore_2019-03-31T21:20:29.462700 | 1,554,067,229.4627 | 16,113 |
pythondev | help | any help will be appreciated. | 2019-03-31T21:35:56.462800 | Elenore | pythondev_help_Elenore_2019-03-31T21:35:56.462800 | 1,554,068,156.4628 | 16,114 |
pythondev | help | hmmmm | 2019-03-31T21:36:17.463000 | Rodrick | pythondev_help_Rodrick_2019-03-31T21:36:17.463000 | 1,554,068,177.463 | 16,115 |
pythondev | help | <@Hiroko> DRF | 2019-03-31T21:41:27.463800 | Darby | pythondev_help_Darby_2019-03-31T21:41:27.463800 | 1,554,068,487.4638 | 16,116 |
pythondev | help | maybe `if xform and yform and zform == true` ?? | 2019-03-31T21:41:36.464000 | Rodrick | pythondev_help_Rodrick_2019-03-31T21:41:36.464000 | 1,554,068,496.464 | 16,117 |
pythondev | help | possibly | 2019-03-31T21:41:43.464200 | Rodrick | pythondev_help_Rodrick_2019-03-31T21:41:43.464200 | 1,554,068,503.4642 | 16,118 |
pythondev | help | <@Elenore> | 2019-03-31T21:42:09.464500 | Rodrick | pythondev_help_Rodrick_2019-03-31T21:42:09.464500 | 1,554,068,529.4645 | 16,119 |
pythondev | help | What are magic methods | 2019-03-31T21:45:05.464900 | Harvey | pythondev_help_Harvey_2019-03-31T21:45:05.464900 | 1,554,068,705.4649 | 16,120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.