These are chat archives for django/django

16th
Apr 2018
Ronald Langeveld
@burgundy93
Apr 16 2018 05:49
hey guys
I'm trying to get a custom cookie created upon login with JWT token. I've got the token displaying in my console fine, but HttpResponse.set_cookie("jwt", token) doesn't seem to have any affect,.
Any other ways I should be apply this? Would I need to add anything in the client side JS?
Byeong Gyu Choi
@gyukebox
Apr 16 2018 06:13
@Hey-tom 👍👍👍
Ronald Langeveld
@burgundy93
Apr 16 2018 06:26
@gyukebox I stayed at your Uni in Seoul a few years ago for a week. :)
Byeong Gyu Choi
@gyukebox
Apr 16 2018 06:27
@burgundy93 really?? how was it?
Ronald Langeveld
@burgundy93
Apr 16 2018 06:28
@gyukebox i was at a camp kinda thing and they used Konkuk as our "base".
@gyukebox i lived in Seoul for 5 years
Byeong Gyu Choi
@gyukebox
Apr 16 2018 06:29
@burgundy93 wow interesting..!
Ronald Langeveld
@burgundy93
Apr 16 2018 06:29
@gyukebox Small world :)
Kurian Benoy
@kurianbenoy
Apr 16 2018 07:42

Hi guys , I recently made an Intelligent Web app which analyses the various messages or conversation you enter and classifies

conversation which you have entered is a spam or Ham(Not spam).It uses Django 2.0 , Machine Learning and NLP

Siddharth Jain
@singhaisid0
Apr 16 2018 08:16
Recently i am making a django project in which, i have a UserProfile app having a model named as 'Profile'. Profile has field user which is OneToOneField to settings. Auth_user_model.
Now when i have put a createview using model form for profile model, then a list dropdown of all users are coming
But i want only the current user to be shown there. How can i do that. I am getting stuck on this from long time
Deepak Bharti
@dbads
Apr 16 2018 08:19
@singhaisid0 yeah, I also see the list of all users even when its one to one relationship
I think its the way this happens :)
Byeong Gyu Choi
@gyukebox
Apr 16 2018 09:27
How about customizing Profile as your app's authentication model?
:]
@elcolie
Apr 16 2018 11:03
@singhaisid0 I guess you are using ModelForm. I've never used it, but you can override the __ini__ to fill value or even change the wideget.
Hey-tom
@Hey-tom
Apr 16 2018 15:50
Hi Guys, I'm trying to figure out how to build a custom filter with django that relys on another api. What I'd like to do is call a client that requests data from betfair's api and then render the filtered information on my site. I found this project on github that uses the lightweight api for betfair but I'm really struggling how to figure out how to render the data. How do you pass calls from a client script to a view? Do they need to be stored in a model first before you can pass the data to a view? This is the example project. Thanks
https://github.com/Tjorriemorrie/tabby/tree/master/betarb/betarb
Justin Weller
@jt-weller
Apr 16 2018 18:48
I have a question. I am running a project with Django and I need to gather a customers number to send a welcome text message to new customers. Not sure if correct by using 'customerNumber = Customer.objects.get('number').filter('date_joined'). Any help with be appreciated.
Rod
@sixtycycles
Apr 16 2018 18:53
I think you need to get all the new customers first in a queryset, then grab the number by iterating throught that queryset. Something like ‘code' new customers = Customer.objects.filter(‘date_joined’)
phone_numb ‘code'
Derp, formatting.
new customers = Customer.objects.filter(‘date_joined’) phone_numbers = [customer.number for customer in newcustomers]
Justin Weller
@jt-weller
Apr 16 2018 19:01
@sixtycycles I see where you're going with that. I'm assuming 'customer.number' will be gathering the phone numbers in the customer tuple and will be "filtered" by the iterator newCustomer?
Rod
@sixtycycles
Apr 16 2018 19:05
@jt-weller yes, you are on the right track with your code, except that the .get() function will only return ONE customer. if that is your intended case, then this will absolutely work! you might also look at the 'field lookups’ section of the queryset docs. https://docs.djangoproject.com/en/2.0/ref/models/querysets/#id4
Justin Weller
@jt-weller
Apr 16 2018 19:06
Okay. I'll take a look at the doc. I am trying to return one customer upon signing up, with it being filtered by date_joined.
Rod
@sixtycycles
Apr 16 2018 19:10
@jt-weller Oh, great! then your code should defintely work! i had assumed this was a batch job to be run at the end of day or a simmilar situation…
it may be overkill for your situation, but Django signals are a great way to manage lots of different actions when a model is saved or updated. https://docs.djangoproject.com/en/2.0/ref/signals/
A behavior like, “ i sign up and create my user object” can then be used a s signal to create a more robust “profile object” for them (extending the defaurt user model) and also for actions like emailing or texting confimations.
Good luck with your project!