Removed ModelForm for Course and changed labels and updated widgets for the Assignment ModelForm

parent 5620d77f
from django.forms import ModelForm from django.forms import ModelForm
from .models import Course, Assignment from .models import Assignment
from django import forms
class CourseForm(ModelForm):
class Meta:
model = Course
fields = "__all__"
class AssignmentForm(ModelForm): class AssignmentForm(ModelForm):
class Meta: class Meta:
model = Assignment model = Assignment
fields = "__all__" fields = "__all__"
labels = {
'name': '',
'description': '',
'course': 'Course: ',
'perfect_score': '',
}
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Assignment Name'}),
'description': forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Description'}),
'course': forms.Select(attrs={'class': 'form-control', 'placeholder': 'Course'}),
'perfect_score': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Perfect Score'}),
'passing_score': forms.HiddenInput(),
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment