I'd like to specify my main problem a bit more.

The biggest issue is how to implement the ranking system's calculations and 
input. The way it is currently done is manually on a Spreadsheet, which is 
functional but cumbersome in the event of a slight human error, as well as 
fact that the members change a bit. The way I implemented a Java app to 
deal with it is:

The database is stored in a CSV file, in the form of a spreadsheet, with 
columns labeled: Rank, Name, Grade, Index (Overall score), Contest 1 score, 
Contest 2 score, etc.

To add a new contest's scores:
For every participating student:
    Enter the student's name
    Enter the student's grade
    Enter the student's score, s
End for
Find the top 15 scores' average, a
For every participating student:
    Compute s/a, find the student in the CSV, and append the result
For every student not added:
    If the student has a score for that contest already
        Leave it
    Else
        Append 0
If it's the student's first contest:
    Append a row with the student's name, grade, and 0's for all previous 
contests, completed with that student's index, s/a
For every student:
    Replace their Index with the average of all their contest scores
Sort the students by Index in decreasing order
Replace the CSV file with the new, completed data

The problem with the Java program is it's cumbersome to store the numbers 
in a CSV and reread it each time, plus we already have a website, which 
combined with all the flexibility the ability to give each student a 
Profile makes the Django app so appealing.

Does anyone have more specific ideas about how to implement this?

As far the Django REST Framework goes, I'm not sure if making an API is 
really what I want to be doing here. As you can tell by how this app will 
be used, I'm a student who doesn't have much experience with "real-world" 
programming, especially those users can interact with easily. Sorry again 
if I'm not being clear, I'll try harder to specify what I mean if you need 
more.


On Sunday, June 16, 2019 at 9:49:07 PM UTC-4, Yoo wrote:
>
> Based off the context:
>
> https://simpleisbetterthancomplex.com/tutorial/2016/11/23/how-to-add-user-profile-to-django-admin.html
>
> I'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+unsubscr...@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/fca35f4a-7de9-4a41-88bb-e19e5edc9431%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to