anyone can help me get django channels working properly on my staging server ?
benbacardi
Matthieu`: actually, perhaps use 'self' on the FK instead of 'Folder'
Matthieu`
ok
benbacardi
Matthieu`: from the docs:
Matthieu`
thank you for your help
benbacardi
To create a recursive relationship – an object that has a many-to-one relationship with itself – use models.ForeignKey('self', on_delete=models.CASCADE).
murk has quit
Utal has quit
flobin
benbacardi heh, you're right, I don't know why I was complicating things... I had installed a Django app called django-betterforms because I thought I needed it
so in my forms.py I have specified a widget to be CheckboxSelectMultiple() for two fields, but they come out as <select> with <options>, one with multiple and one without
mattmcc: ok, but how to link with django rest authentication?
Darkhunter has quit
ticketbot has quit
mattmcc: I need the default django-auth user class, but also need another one for django rest
mattmcc
Why?
jessamynsmith joined the channel
olrrai
mattmcc: I gonna try to explain the project
murk joined the channel
DLSteve_ joined the channel
sanketdg has quit
jessamynsmith has quit
mattmcc: main users are IT supporters, they support their customers (domains). The domains have OS (operating systems) which need consume one REST API with users and passwords (by token)
jamesbvaughan joined the channel
garrypolley has quit
flobin
does anyone have any experience in a form not rendering the correct widgets?
feathered_person joined the channel
garrypolley joined the channel
glookoza
Hi, I have the following issue... I have a CharField in one of my models... in the view, I get a list of that data from all the complete set of that model... now, when I pass it to the html, I print it like in... {{ data }}... and pass it also to some jQuery component... However, when I see the resulting html, I am able to see that the one I print is ['1', '2', ... ] but the one in the jquery
is ['1' ... ] I have the same 'tag' in the html source file {{ data }} but why is it pasting it differently inside the <script> tag ?
feathered_person has quit
mattmcc
olrrai: Okay, but what calls for two different user models?
no worries, I literally didn't get what you were asking
cyphase joined the channel
I also missed the beginning
djmoch joined the channel
ubuntu_aze joined the channel
garrypolley joined the channel
benbacardi
flobin: looks like you need obj.id not self.id. Plus, use reverse, not reverse_lazy.
olrrai
tga: It is the proyect: main users are IT supporters, they support their customers (domains). The domains have OS (operating systems) which need consume one REST API with users and passwords (by token)
flobin
benbacardi when you say it like that, it seems obvious...
benbacardi
reverse_lazy is only for when the URLs haven't loaded - I.e code run when the views are imported. But code _inside_ a view is always run after URLs are loaded
flobin
ah, right
thanks
looks like we're getting somewhere though, now I get a different error, let me copy/paste it
benbacardi
flobin: well... obj is a new Article instance, self is the instance of the ArticleSubmitView class, not an article
flobin
ah yeah that makes sense
tga
olrrai: one idea would be to keep api tokens separate from django users
olrrai: another idea would be exactly opposite, creating django users for api tokens
ironfroggy joined the channel
mingrammer joined the channel
garrypolley has quit
olrrai: as far as I know, the DRF token authentication only works with django users, so if you want to use that out of the box, you have to create users for all api clients
benbacardi
flobin: args needs a list: args=[obj.pk]. But you probably actually want kwargs={'pk': obj.id} as its a named pattern in the url
flobin
ah yeah I was wondering how to do that
that also makes sense
olrrai
tga: oh
benbacardi
It's all in the docs ;)
(Not that I'm not happy to help.)
tga
olrrai: if you want to authenticate api clients with tokens without having anything to do with django authentication, you'll have to do it manually
you look at headers, get the token, look in the database, see whether it's ok, then reply or not
devshady has quit
flobin
heh, well, I'm a beginner
olrrai
tga: tokens work without users/pass ?
tga
olrrai: not by default, you can reimplement token authentication from scratch if you wnat
the drf token authentication works with django users
mingrammer has quit
olrrai
tga: can u give me links to start with your 2 ideas?
tga
olrrai: probably the easiest thing for you would be to create django users for everybody
benturner has quit
olrrai: this way you can use token authentication out of the box