Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request.get_username #4

Open
aidswidjaja opened this issue Jan 31, 2023 · 3 comments
Open

request.get_username #4

aidswidjaja opened this issue Jan 31, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@aidswidjaja
Copy link
Member

get_username() fetches usernames which have been invalidated. See top-right corner

image

Low priority and zero impact on services, but good first issue.

@aidswidjaja aidswidjaja added bug Something isn't working good first issue Good for newcomers labels Jan 31, 2023
@vrii14
Copy link

vrii14 commented Feb 1, 2023

Hi, I would like to work on this.
What exactly is expected to be done for this? Should it not fetch username if it is invalid?

@aidswidjaja
Copy link
Member Author

aidswidjaja commented Feb 2, 2023

Hi @vrii14! Essentially, we use the Django get_username() method in the form of its Jinja templating equivalent {{ user.get_username}}. https://docs.djangoproject.com/en/dev/ref/contrib/auth/#django.contrib.auth.models.User.get_username. We extend the default User model with custom validation.

get_username is called to fetch the currently logged-in user's username and display it in the top-right button as shown in the screenshot in the original issue description (I call this the Magic Button internally).

Ideally, the expected behaviour is that it fetches the currently used validated username. An invalid form submission should not result in the invalidated username being submitted - which is what occurs when checking in Django /admin/. However, for some weird reason, the get_username method returns the invalidated username on my local dev server, at least on that page.

I am not sure if this is an (albeit low priority) bug in the method or my own misapplication of it's attributes. Logic may need to be implemented to work around this.

WajahatKanju added a commit to WajahatKanju/anipianolist that referenced this issue Aug 11, 2023
@WajahatKanju
Copy link

I have fix it. Please checkout Pull Request #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants