I've noticed that after I log in with Django registration it redirects me to accounts/profile/
. By default Django registration's url.py
doesn't handle accounts/profile/
, so I need to create my own.
Actually this questions is three-fold:
accounts/profile/
? Is there a way to change that? Preferably after successfully logging in I would like Django to redirect back to the page before the login page.accounts/profile/
, then where should I put it? Django's built-in users
(auth_user
) is shared among all Django apps inside a project, so should I place the view.py
in the project folder and not inside the app folder?account/profiles/
thing? I already extended Django's User
class with my own UserProfile
, but it's more like additional fields to the User
table than an actual "profile" (I didn't create avatars or anything like that, just simple stuff like addresses and phone numbers, but most importantly, some custom user types that my app depends on).Why does after logging in, it redirects to accounts/profile/? Is there a way to change that? Preferably after successfully logging in I would like Django to redirect back to the page before the login page.
Just change setting LOGIN_REDIRECT_URL
If I were to create my own view and template for accounts/profile/, then where should I put it? Django's built-in users (auth_user) is shared among all Django apps inside a project, so should I place the view.py in the project folder and not inside the app folder?
I like to create an app called "project_specific" in every project. That's where I put all the stuff that's not meant to be reusable and that couples many apps.
You can also create a views.py at the project level, but that is sort of messy compared to making a project specific app.
In reality it does not matter where you put it.
Or does Django profile actually takes care of this whole account/profiles/ thing? I already extended Django's User class with my own UserProfile, but it's more like additional fields to the User table than an actual "profile" (I didn't create avatars or anything like that, just simple stuff like addresses and phone numbers, but most importantly, some custom user types that my app depends on).
That's not the way to add extra user fields. I recommend that you read the docs on Storing additional information about users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With