Based off the context:
https://simpleisbetterthancomplex.com/tutorial/2016/11/23/how-to-add-user-profile-to-django-admin.htmlI'm somewhat confused regarding where this is supposed to go, so here're some random ideas which hopefully might help you start off with some Google searches:
The above link is implementing a Profile model, which kinda extends the User model if that can help based off the context. Once you finish the tutorial above, runserver and access the admin at 127.0.0.1:8000/admin and enter the user model to see all the fields you added to the Profile model.
When processing the numbers, you can define a function based on PUT (update) requests. Or, whenever an object is created, a Django signal can be sent out to do some action like updating another table. (Unfortunately, I'm not too well-educated on signals...).
Indexes will have everything ordered based off your liking for improved querying; otherwise, ordering will do the trick when using a queryset (basically when you query for several tables, the server returns an ordering you specify e.g. ordered dates, numbers, letters, etc.).
Regarding authenticating users, you''ll have token authentication and some Django decorators that'll allow you to specify when an Authenticated User is allowed to do action X, Y, or Z. Unauthenticated users would be blocked from certain pages by utilizing the templates/html's with tags {% if user.is_authenticated %} then your HTML then another tag {% else %} with other tags. There are plenty of other ways such as redirecting a user in the views.py and yada yada if the user is NOT authenticated.
Something I think would help you is to utilize Django-rest-framework. It's designed as an API, but I think you'll understand Django much better through it. It's well-documented and there are plenty of tutorials (including those with Token authentication which I think you're seeking).
On Sunday, June 16, 2019 at 8:13:05 PM UTC-4, Derek Dong wrote:
How can I integrate OAuth with a ranking system in a Django application?I'm not too familiar with Django design philosophy, which is why I'm asking these questions.The way I understand it, OAuth doesn't let you manipulate information on the server authenticating a user, so I would still need a User model with information like "name." Is this right?Some quick context:Each user has float scores for each event (of which there are multiple); the average (or possibly total if that's easier) of these scores composes their overall score. Overall scores are used to rank all the users.Should I have separate models for things like "score," "ranking," and/or "event?"Where should processing the numbers go? I assume I should make a form to input scores for each event, possibly with an overall "update" button on the admin page, but would that go in the model.py, admin.py, views.py, or something else?Sorry for these questions possibly sounding strange, I'm used to object-oriented programming and have implemented a way to compute this in that way, but am confused by web applications' use of databases, views, and HTML for displays.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fb131034-faf6-4882-b661-f2d3532715fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment