You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.
The subclasses of Question that I created earlier for convenience (Paragraph, Checkbox, Radiobutton, Dropdown) were in retrospect a big mistake. Here's why:
If we want to change the question type of an existing question, we can just change the string attribute Question.question_type, but that won't make the question show up in the sublass's queries. Consider the following code:
The above is a bit of a contrived example, but the point is that because Django creates separate database tables for each subclass, the queries using the convenience classes are fundamentally broken. Luckily we don't have a huge amount of code that relies on them, but we should delete the convenience subclasses as soon as possible and change all of our code to use the base class Question instead.
The text was updated successfully, but these errors were encountered:
The subclasses of
Question
that I created earlier for convenience (Paragraph
,Checkbox
,Radiobutton
,Dropdown
) were in retrospect a big mistake. Here's why:If we want to change the question type of an existing question, we can just change the string attribute
Question.question_type
, but that won't make the question show up in the sublass's queries. Consider the following code:The above is a bit of a contrived example, but the point is that because Django creates separate database tables for each subclass, the queries using the convenience classes are fundamentally broken. Luckily we don't have a huge amount of code that relies on them, but we should delete the convenience subclasses as soon as possible and change all of our code to use the base class
Question
instead.The text was updated successfully, but these errors were encountered: