-
Notifications
You must be signed in to change notification settings - Fork 19
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
Odstrani razred ProblemText #79
Conversation
71220e6
to
d444098
Compare
|
||
class Meta: | ||
model = Generator | ||
exclude = ["content_type", "document"] | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.fields["text"].queryset = content_type.problemtext_set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tega dela ne razumem čisto. Ali je to treba spremeniti zaradi izbrisa razreda ProblemText, ali je samo neodpravljena posledica pull requesta #71?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ne, to je po novem, saj smo odstranili atribut text
, ki se je prej skliceval na razred ProblemText
. Tega razreda in s tem polja ni več, zato ni treba povedati, kakšne izbire so na voljo zanj.
|
||
class ProblemForm(forms.ModelForm): | ||
instruction = forms.CharField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Če prav razumem, je ta razred nek boolean field, ki glede na to, ali imamo privzeto besedilo ali ne, pridobi ustrezne atribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ja, to je dodatni atribut, ki ga ni v modelu, ampak je samo v obrazcu in se nastavi glede na to, ali uporabnik klikne na izbiro (radio button) pri privzetem ali lastnem besedilu. Podatke pa shranimo tako, da sta instruction
in solution
pri privzetem besedilu prazna, pri lastnem besedilu pa ne.
@@ -54,14 +33,13 @@ class Problem(models.Model): | |||
on_delete=models.PROTECT, | |||
limit_choices_to=limit_content_type_choices, | |||
) | |||
text = models.ForeignKey( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ali je mogoče, da z izbrisom tega kaj ne bi ustrezno delalo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideja te spremembe je, da ne :) Torej namesto text
, ki je svoj model, imamo dve običajni polji instruction
in solution
. Treba je bilo veliko prilagotiev, ampak se mi zdi, da zdaj dela, kot bi moralo.
Kot smo se pogovarjali, je s to izbiro besedil za naloge sama zmeda, po #72 bo pa še večja. Trenutno se je npr. dalo pri treh nalogah uporabiti isto besedilo in če si ga popravil pri eni, se je spremenil tudi pri ostalih dveh.
V PR je enostavnejša rešitev, kjer ima vsak tip naloge privzeto besedilo, potem se ga pa lahko pri vsaki nalogi posebej povozi.