Harsha
Can anyone share python developer sample resumes pls
Doragonsureiyā
Can anyone share python developer sample resumes pls
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python
Khumoyun
Hi there, I need solution, any ideas? When a user logs in DRF (Django Rest Framework), he is given a token, now next time through another view or through this login view how can the user make himself accessible with the token? users need Just next time enter valid token for sign in
Khumoyun
You need to set the authentication classes, if you set the TokenAuthentication every call to other view must include the token into an header
class LoginView(generics.GenericAPIView): serializer_class = LoginSerializer def post(self, request): serializer = LoginSerializer(data=request.data) serializer.is_valid(raise_exception=True) user = serializer.validated_data["user"] login(request, user) token, created = Token.objects.get_or_create(user=user) return Response( {"token": token.key, 'first_name': user.first_name, 'last_name': user.last_name, 'avatar': user.avatar if user.avatar else None}, status=status.HTTP_200_OK)
Mirco
The login view returns to the frontend the token for that user
Mirco
Everything is explained on official doc under TokenAuthentication
Paschaljet
please family i need your help.... i made an ajax call to which return a payment reference from paystack API, please how do i save this to my database through my views.py... so i can update the orders from a customer.... its an e-commerce app
Anonymous
Please I need the link so I can post my code for review
Doragonsureiyā
Please I need the link so I can post my code for review
To share code or error tracebacks please use an online pasting service, here is a list of suggested sites: - https://del.dog - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev
Anonymous
Thanks bro
Mirco
Thanks bro
Not your bro 😎 but yw
Anonymous
Lol
Anonymous
https://del.dog/my_app
Dhruv
Have any one make an blog site
Doragonsureiyā
Have any one make an blog site
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z" Just ask about your problem directly! With ~80,000 people here, the probability that someone will help is pretty high. How to ask smart questions: http://catb.org/~esr/faqs/smart-questions.html
Anonymous
Anonymous
Hello all, Can any tell me how to use pgfunction in django appliction.
Full stack developer (React, Django)
How much time it takes to.learn django?
Furqan
How much time it takes to.learn django?
depend on your effort and practice
Peak
Hi I have used an ajax call to pass a js variable to my view and it's ok but when I call the same url to that view in href, the passed data get None value. How can I solve it?
Nayan
How to clear catched memory django queryset
Nayan
*For django queryset
Peak
we should see your url pattern, that part of template you are calling, and your view function
https://del.dog/hengomemof.txt here is all parts of the code thank you.
Tukhtamurod
https://del.dog/hengomemof.txt here is all parts of the code thank you.
you know how to pass variables along with url? no track of it in your code
Peak
you know how to pass variables along with url? no track of it in your code
i used such a thing for example for an object pk, but here i didn't know i can use this,is it possible in this case?
Peak
it should be a teamplate variable
would you please give me an example?
Peak
it should be a teamplate variable
here i have a js var in my template
Tukhtamurod
you cant pass for example id of your "a" tag to view in that method, you can use ajax or make a separate post request
Tukhtamurod
here i have a js var in my template
no you cant pass js variables alongside url
Anonymous
How to add slug in url
Anonymous
How to add slug in url
Please give me example
Tukhtamurod
i used ajax but when it goes to url, it returns None for that var.
your ajax call does nothing when server responds you didnt implement success function. what are you expecting?
Sri
Can someone tell me how to add speech recognition functn in django form fields
Anonymous
# hi friends! need help # i have this query on my table it`s return to me all DE and UA nad DK rows and merge them to queryset # i want to get only first match like if we have DE in db return this rows i don`t need UA and DK # i we don`t have it please return UA how can i do it? queryset5 = GeoProxyServerModel.objects.filter( Q(ip_address__country_code="DE") | Q(ip_address__country_code="UA") | Q(ip_address__country_code="DK") )
Dambe
queryset5 = GeoProxyServerModel.objects.filter( ip_address__country_code="DE" )
Anonymous
so if i want to check 30 Countrys it will create 30 querys
Dambe
You want only the first match of every country code. Do i get it?
Anonymous
yes
Anonymous
if DE exists return it if not try get UA if exists ua return it
Anonymous
so db will do this work and not python
Dambe
for code in list_code: query = Model.objects.get(ip_address__country_code==code) if query: return query
Dambe
this will create each time new query
Check it again I just edited it
Dambe
You will need to create a function to execute this
Dambe
The function will return the first query that matches
Anonymous
The function will return the first query that matches
thx for your examples but this is not what i am looking for because each get() will create query request to database and lets say i have 30 countrys so i will make 30 querys to db
Anonymous
what i am looking is one query to db that will return first match of country from Q object like in python where OR operator works for c in countrys_list: if c.code == "DE" or c.code == "UA" or c.code =="DK": return c i want same logic but for db query so i thought it will be something like this queryset5 = GeoProxyServerModel.objects.filter( Q(ip_address__country_code="DE") | Q(ip_address__country_code="UA") | Q(ip_address__country_code="DK") ) but expected result is different its fetch data about DE,UA.DK into one queryset
Peak
your ajax call does nothing when server responds you didnt implement success function. what are you expecting?
I implemented success function first but again it did not work and as it makes no error, i can't debug that. it was like this:https://del.dog/cidonuhahi.txt any better way to call the url with variable named reg? thanks.
Tukhtamurod
I implemented success function first but again it did not work and as it makes no error, i can't debug that. it was like this:https://del.dog/cidonuhahi.txt any better way to call the url with variable named reg? thanks.
you didnt understand me, you are receiving request from client and do some job and then return response in json format(since you are using ajax), then do smth with that response in your client side script. What you are doing now is meaningless!
Rahul
Hi guys, any pointers for DRF security best practices ?
Nova
https://stackoverflow.com/questions/64430630/django-model-filefield-upload-file-from-one-server-to-another Anyone know django model FileField ?
Sourav
Can anyone tell me how to integrate elastic search into django rest framework based project?
Doragonsureiyā
Can anyone tell me how to integrate elastic search into django rest framework based project?
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box, write down the same words you asked here Step 4: Read the first results
Anonymous
Can anyone help with how to create product variation
Anonymous
https://del.dog/my_app
Please someone should help me please
Anonymous
how i create video streaming app in django
Doragonsureiyā
how i create video streaming app in django
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box, write down the same words you asked here Step 4: Read the first results
հօรรεiռ
Hi I have problem with implementing django admin panel with mongo db I already use djongo But forms not working well It stucks with lots of errors Anyone has experience mongo and django project?
հօรรεiռ
I use django 3.0.5