ponder-lab / Imperative-DL-Study-Web-App

0 stars 0 forks source link

Modify code to use the django admin page instead of the Categorizers table #132

Open mZneit opened 2 years ago

mZneit commented 2 years ago

https://github.com/ponder-lab/Imperative-DL-Study-Web-App/issues/100#issuecomment-949769381

khatchad commented 2 years ago

We know that a new categorizer hasn't logged in before if they are in the categorizers Django but do not have a row in the categorizers table. At that point, complete the rest of the table by asking them for their name and initials. Doing it this way, we don't need to trigger any row insertion. As soon as they login for the first time, ask them right away for the info you need (name and initials) and immediately create the row in the categorizers table.

khatchad commented 2 years ago
  1. User logs in.
  2. If they are a categorizer per the Django group but do not have a corresponding row in the categorizers table, then:
  3. Redirect to the categorizer form (view). Make sure they are logged in on the view.
  4. Once they submit the categorizer form, redirect to the main page.
khatchad commented 2 years ago

Test case: Mess with the URL. Instead of filling out the categorizer form, go to the main page and try to make a categorization. This should fail because there is no foreign key into the categorizers table to insert the categorization.

khatchad commented 2 years ago

Use a form for categorizers. See https://docs.djangoproject.com/en/3.2/topics/forms/