syedj
Have anyone used flask framework
syedj
I have a query
syedj
Using flask rest api can we define endpoint without extending Resource module?
syedj
Like i want to define only one method should that be in class extending Resource
syedj
Can't there be function based
entropy
entropy
thx!
welcome. fieldname_before and fieldname_after will be used for the date range you are filtering
Алишер
Hi, guys! Question about Django ORM I have models that referenced by ForeignKey and OneToOneFields. E.g. [Model1, Model2] ref. to Model3. Model3 ref. to Model4. After save Model4 will other referenced models be saved? Or I must save all models manually?
Mohit
I want to block deletion of an object based on a boolean field of the object in model. I want to override the delete method in serializer. I'm using django rest framework. What is the method to override? I'm using generic views.. Retrieveupdatedestroy api view
Mohit
Thanks
Anonymous
Wah gwaan.. Is there anyone using django-machina?
raven
what it is?
🏳️‍🌈Robby [ Private Message = Spam]
Wah gwaan.. Is there anyone using django-machina?
Stop asking meta questions and just ask your actual question.
🏳️‍🌈Robby [ Private Message = Spam]
what it is?
Nobody actually cares until they ask an actual question versus a meta question
raven
👍
Shubham
Hello caught with an error
Shubham
TypeError at / init() takes 1 positional argument but 2 were given
Shubham
from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('',include('account.urls')) ]
Shubham
and an app url
Shubham
from django.urls import path from account import views urlpatterns = [ path('', views.CustomRegisterView) ]
🏳️‍🌈Robby [ Private Message = Spam]
TypeError at / init() takes 1 positional argument but 2 were given
https://www.google.com/search?q=init()+takes+1+positional+argument+but+2+were+given+django
Shubham
resolved
Shubham
thanks @robbyoconnor
Shubham
path('', views.CustomRegisterView.as_view())
🏳️‍🌈Robby [ Private Message = Spam]
Anonymous
Stop asking meta questions and just ask your actual question.
I need a tutorial for django-machina apart from official I don't understand it
🏳️‍🌈Robby [ Private Message = Spam]
I need a tutorial for django-machina apart from official I don't understand it
What don't you understand? https://django-machina.readthedocs.io/en/stable/getting_started.html
🏳️‍🌈Robby [ Private Message = Spam]
Can you really not understand that?
Anonymous
Can you really not understand that?
I'm far from pc but later on I will show up what I get
🏳️‍🌈Robby [ Private Message = Spam]
I'm far from pc but later on I will show up what I get
Well that guide explains exactly how to get started and they provide example applications, so you're not trying hard enough. Sometimes you have to actually read and can't just copy/paste your whole app.
P
okay, actually I am not piratting but I got on fb_group so thought to give it way, anyway its cool! I will take care here onward
Yes please send the book bro hope it's 2.2 I'm trying to make small website for farmer group but have to deal with lots of error
inchidi
@Inchidi
its fine
Shubham
Hello I have created the custom model authentication in django rest , so far I dont have front end , so my question is , Im I done with the API, since on browser it gives an error TemplateDoesNotExist at / rest_framework/api.html that of course due to I dont have template, in postmen its giving { "detail": "Method \"GET\" not allowed." } , Am I going right?
Shubham
https://github.com/shubham1507/school
Alibek
Hello there. I want to make microservices w/ Django. In particular I want to make auth microservice w/ JWT auth. Well the question is: I have some other microservices, and there is a special ms called test. There I make some test stuff and if it passess, I apply it to other ms (for example, I setup Redis on test ms and it works, so I setup Redis on other ms like Task Manager). And I want to use 2 JWT tokens. One for test microservice only, and another one for other microservices. How can I achieve this? Any resource would be appreciated.
Manish
I want to add popup file upload on click button if file is not exist
Manish
Hey buddies
Manish
Getting problems in configuring django rest auth with jwt
🏳️‍🌈Robby [ Private Message = Spam]
Manish
pasting code..😁😁
Manish
https://dpaste.de/etOM urlpatterns
Manish
https://dpaste.de/2wSN settings.py
🏳️‍🌈Robby [ Private Message = Spam]
and the error
Manish
login endpoint output { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImtyaXNobmEiLCJleHAiOjE1NTU5OTYxNTksImVtYWlsIjoiIn0.nllvIiTzKf2rAb8h3VQPAAdELjRFmd9JumTO8hmFTjM", "user": { "pk": 1, "username": "krishna", "email": "", "first_name": "", "last_name": "" } }
Manish
{ "detail": "Given token not valid for any token type", "code": "token_not_valid", "messages": [ { "token_class": "AccessToken", "token_type": "access", "message": "Token is invalid or expired" } ] }
🏳️‍🌈Robby [ Private Message = Spam]
The token or invalid.
Manish
The token or invalid.
that i see but i don't know why.
🏳️‍🌈Robby [ Private Message = Spam]
that i see but i don't know why.
JWT tokens are short-lived.
Manish
JWT tokens are short-lived.
i tried just after 1 sec of login
Manish
https://dpaste.de/2wSN#L9 see this
Manish
i think there should be something like rest_auth.jwt
🏳️‍🌈Robby [ Private Message = Spam]
https://github.com/davesque/django-rest-framework-simplejwt
Manish
i am following this https://django-rest-auth.readthedocs.io/en/latest/installation.html#jwt-support-optional
Manish
help someone please
Manish
Hey @robbyoconnor i fixed it.
🏳️‍🌈Robby [ Private Message = Spam]
Manish
in authorization header by default we have to use JWT then token But i was using Bearer and Token
🏳️‍🌈Robby [ Private Message = Spam]
Manish
This is covered in the JWT spec.
yeah i saw this when i read documentation again and again
Manish
but there is a problem with jwt
Manish
which is logout
🏳️‍🌈Robby [ Private Message = Spam]
which is logout
JWT is stateless. Since the tokens are shortlived, it doesn't matter
Manish
🏳️‍🌈Robby [ Private Message = Spam]
blacklisting token are not available by default.
If you actually care, then use that — otherwise — the way I handled this was i passed two tokens, the actual token PLUS a refresh token, can be anything, but this is stored in case of the token expiring and I only query for if I need to
Manish
i will say last thing django is much harder than flask.😂
🏳️‍🌈Robby [ Private Message = Spam]
Manish
THanks BTW @robbyoconnor
inchidi
blacklisting token are not available by default.
if you blacklist JWT technically you are abusing JWT, use token based auth instead
Manish
non expiring token are more dangerous than jwt