These are chat archives for django/django

23rd
Jun 2017
Hassen ben tanfous
@HassenPy
Jun 23 2017 02:38
@fuuman , you mean a project that you can do to learn django?
@s13g3lb4um In your settings.py Do you have MEDIA_URL?
:]
@elcolie
Jun 23 2017 04:34
Hi
:]
@elcolie
Jun 23 2017 04:47
2017-06-23 04:36:37.938 UTC [27896] DETAIL:  Failed process was running: INSERT INTO "sales_sales" ("imc", "order_number", "original_order_date", "count") VALUES ('1049129', '415000458', '2017-03-01T03:00:00+00:00'::timestamptz, 1), ('1113804', '415000457', '2017-03-01T03:00:00+00:00'::timestamptz, 1), ('1151620', '415000460', '2017-03-01T03:00:00+00:00'::timestamptz, 1), ('1522771', '415000462', '2017-03-01T03:00:00+00:00'::timestamptz, 1), ('2280038', '415000459', '2017-03-01T03:00:00+00:00'::timestamptz, 1), ('7374979', '415000461', '2017-03-01T03:00:00+00:00'::timestamptz, 1), ('399428', '415000618', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('399428', '415000619', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('1049129', '415000614', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('1059455', '415000636', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('1059455', '415000638', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('1075963', '415000605', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('1113804', '415000607', '2017-03-01T03:02:00+00:00'::timestamptz, 1), ('1137600', '
2017-06-23 04:36:37.940 UTC [27896] LOG:  terminating any other active server processes
2017-06-23 04:36:37.941 UTC [19396] WARNING:  terminating connection because of crash of another server process
2017-06-23 04:36:37.941 UTC [19396] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2017-06-23 04:36:37.941 UTC [19396] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2017-06-23 04:36:37.984 UTC [27896] LOG:  all server processes terminated; reinitializing
2017-06-23 04:36:38.062 UTC [19650] LOG:  database system was interrupted; last known up at 2017-06-23 04:31:35 UTC
2017-06-23 04:36:38.084 UTC [19651] postgres@uihspot FATAL:  the database system is in recovery mode
2017-06-23 04:36:38.088 UTC [19652] postgres@uihspot FATAL:  the database system is in recovery mode
I upload ~15MB file and read records from it and put to the postgres table
At first time it works, but when I keep testing it. It raises an error
Marco Schanz
@fuuman
Jun 23 2017 07:44
@elcolie Thank you, that's what I meant
Saurav Agrawal
@asaurav025
Jun 23 2017 08:46
Hey can anyone help me in integrating websocket in django
Skynet094
@Skynet094
Jun 23 2017 12:36
Hi , anyone here
Elcolie, your userID reminds me of E. coli
:D
Anish Shrestha
@annshress
Jun 23 2017 16:19
@asaurav025 django-channels is there for you.
Saurav Agrawal
@asaurav025
Jun 23 2017 16:57
@annshress I followed some website but my websocket get disconnect before it is connected....
@annshress if you can recommend some blogs aur YouTube channel for using channel in django
aman1193
@aman1193
Jun 23 2017 17:40
hello guys i am new to django.. what concepts do i nees to learn in python ­čśâ
need*
neutralboy
@neutralboy
Jun 23 2017 17:58
@aman1193 try learning concepts from sololearn.com they have python courses shallow enough for you to learn django
aman1193
@aman1193
Jun 23 2017 19:03
thanks poorna
Saurav Agrawal
@asaurav025
Jun 23 2017 19:21
What is difference between authentication and permission in django rest framework
Ismael Venegas Castell├│
@SalchiPapa
Jun 23 2017 19:41
Hello eeryone!
everyone!
Ismael Venegas Castell├│
@SalchiPapa
Jun 23 2017 20:00

I have this field in a model:

agent = models.ForeignKey(User, on_delete=models.CASCADE)

But I would like to filter only the users that belong to certain group.
Ismael Venegas Castell├│
@SalchiPapa
Jun 23 2017 20:12
I know I can do:
>>> from django.contrib.auth.models import User, Group
>>> super = Group.objects.get(pk=1)
>> User.objects.filter(groups=super)
<QuerySet [<User: Bec>, <User: vizendev>]>
but I would like to filter from the model field directly, is this possible, I see the ForeignKey field model, has a filter keyword argument, but I haven't found examples on how to use it.
Ismael Venegas Castell├│
@SalchiPapa
Jun 23 2017 20:19
Ah no that was my mistake, no filter keyword, there is limit_choices_to, seems what I was looking for
SUPERVISOR_GROUP = Group.objects.filter(name__istartswith="super")
...
    agent = models.ForeignKey(User, on_delete=models.CASCADE, limit_choices_to={'groups': SUPERVISOR_GROUP})
...
that worked like a charm! :D
J. Dalton Childers
@jdaltonchilders
Jun 23 2017 21:37
How should I handle my app structure if I have a hand full of models which are going to be FKs in other models? Should I place all of these models inside of a core app (something needed by all apps) or create a separate app for each model? Models I'm looking at create are for office, org info, etc...these things will have maybe 3 to 5 fields per model. I was thinking all separate apps, since I think that's recommended in the Two scoops of django books but I thought I should get a second opinion before creating X apps for just office location info.
John
@flyboy1565
Jun 23 2017 23:01
could use some help.. i have been fighting for like 3 months trying to get my head around DRF.
https://github.com/flyboy1565/portal2
I want to go to a url /api/locations/district/XXXX this would then give a list of stores in the that district. I have included the error message in my github.