These are chat archives for django/django

27th
Jun 2017
Roman Tolkachyov
@romantolkachyov
Jun 27 2017 09:04
@sp1rs is_staff users can login to admin, you know @koderNeptune
Miracle Ayodele
@iammiracle
Jun 27 2017 09:04
yeah @romantolkachyov
tho, i included, is_user, is_agent to the field
i actually created two apps, one for individual user and the other for agent
and its authenticating well, depending on the group
i just want to know if its a good practice
Anish Shrestha
@annshress
Jun 27 2017 09:17
@flyboy1565 did it, fulfilled my very basic needs, but didn't go way too deep
notify me, if you are doing stuffs with it, maybe I can know more.
sufficed me.
Roman Tolkachyov
@romantolkachyov
Jun 27 2017 09:58
@koderNeptune it's depend on how it would be complicated in future. You can look at django permissions or existing django apps solving your problem but in this case you need to learn this libraries. https://djangopackages.org/grids/g/authorization/
Hubert
@hubert10
Jun 27 2017 11:20
Hello guys ? is possible to create or associate to Anonymous User with sessions_key in django Rest Framework
J. Dalton Childers
@jdaltonchilders
Jun 27 2017 13:59
Can I do multiple database request all at once? Even if those request are just fetching data?
Shashank Parekh
@sp1rs
Jun 27 2017 17:18
@jdaltonchilders possible
Vatsal Parekh
@vatsalparekh
Jun 27 2017 17:49
yes @jdaltonchilders
@sp1rs correct
Annie Viviane Lessa
@Viviannie
Jun 27 2017 18:00

I need help. In the web tab, after configuring everything, when I clicked on "Configuration", it opened a page with error (error log):

Error running WSGI application
ImportError: No module named 'whitenoise'
File "/var/www/viviannie_pythonanywhere_com_wsgi.py", line 11, in <module>
From whitenoise.django import DjangoWhiteNoise

Forgot to install whitenoise?

Vatsal Parekh
@vatsalparekh
Jun 27 2017 18:01
@Viviannie seems like you forgot to install the package
nicostombros
@nicostombros
Jun 27 2017 18:30
Does anyone know how one might achieve a similar log in system to that of Slack (so you can be logged in to multiple teams at any given time)?
Just having trouble with a project like this lmao
J. Dalton Childers
@jdaltonchilders
Jun 27 2017 18:57
@sp1rs and @vatsalparekh How exactly would I do this with/In Django?
I’m trying to build up the select options in a form and need to do a DB query to build the list, since there’s multiple queries that need to happen I’m trying to avoid a performance hit when you create a new instance.
nicostombros
@nicostombros
Jun 27 2017 19:26
@jdaltonchilders So if you have a select box and in it you want some Database info to populate the choices? Like a list of the different users in your DB sort of thing?
J. Dalton Childers
@jdaltonchilders
Jun 27 2017 19:26
@nicostombros Yes exactly. I’ve already done this with a supervisor field (pulling users), but I need to do this with other fields as well.
nicostombros
@nicostombros
Jun 27 2017 19:27
does a for loop in the select box work?
or is there some other way you have to do it?
J. Dalton Childers
@jdaltonchilders
Jun 27 2017 19:28
I handle it with the supervisor field like so:
def __init__(self, *args, **kwargs):
        super(PersonnelForm, self).__init__(*args, **kwargs)
        users = User.objects.filter(is_active=True)
        self.fields[‘supervisor’].choices = [(user.pk, user.get_full_name()) for user in users]
I was just wondering if I could running multiple at the sometime for sake of performance.
Annie Viviane Lessa
@Viviannie
Jun 27 2017 20:44
@vatsalparekh Which package?
Shashank Parekh
@sp1rs
Jun 27 2017 20:57
@jdaltonchilders What else data you need to populate?
@jdaltonchilders This looks fine. Only 1 db call.
J. Dalton Childers
@jdaltonchilders
Jun 27 2017 21:37
Academic Department, Titles, Major, Institution @sp1rs