Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to get the admin and its password, what i want to do, is authentificate everything with its credentials.
How to do it instead of hardcoding it by:
user = authenticate(username='me', password='12345')
login(request, user)
You can't get password from database, it's only an hashed fingerprint. Django password documentation
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am new to django. My web application in django using auth functions to authenticate users with a custom made admin panel. Is it possible to authenticate user and admin at the same time from a browser?(without using incognito window)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Please explain how to get user.id and user.name of client who talking with my bot in balebot. There is a peer class, but i don't know how exactly it works?
its a simple way to use get_effective_user() function to get peer_id or accesshash, see:
user_peer=update.get_effective_user()
user_id = user_peer.peer_id
But if you need more you can get name and other feilds of user from an Update Json. like this :
def text_received(bot, update):
for user in update.users:
print(user.get_json_object())
....
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm having a little trouble figuring out if I should have an API for admins and for users splitted. So:
Admins should login using /admin/login with a POST request, and users just /login.
Admins should access/edit/etc resources on /admin/resourceName and users just /resourceName.
You should only have one endpoint, not one for each type of user. What if you have moderators? Will you also create a /mods/login ?
What each user should and shouldn't have access to should be sorted out with permissions.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to add an email into a path in Django. I did this code but I don't know how take the variable called email after username place.
path('validate_email/<slug:username>/(?P<email>[\w.%+-]+#[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/<slug:token>', views.validate_email, name="validate_email")
You cannot use a regex with path(). If you want to use a regex you'll need to use re_path() or url().
It might be easier to use simply <email> in the URL pattern, then you can validate the email in the view.
path('validate_email/<slug:username>/<email>/<slug:token>', views.validate_email, name="validate_email")
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
this is my view
def mydate(request):
date = datetime.datetime.strptime(request.GET.get('date'),"%Y-%m-%d")
return HttpResponse(data)
and i want call this view in another method in the django project
how to deal with this problem ?
yup you can do it
like this
def other_view(request):
item = mydate()
// now do what you need to do