November 2015
Beginner to intermediate
840 pages
26h 30m
English
StartupForm and NewsLinkFormAs with PostForm, we can use ModelForm inheritance to quickly create the forms for Startup and Newslink model classes in /organizer/forms.py, shown in Example 7.29.
Example 7.29: Project Code
organizer/forms.py in e90ec17deb
4 from .models import NewsLink, Startup, Tag 5 6 7 class NewsLinkForm(forms.ModelForm): 8 class Meta: 9 model = NewsLink 10 fields = '--all--' 11 12 13 class StartupForm(forms.ModelForm): 14 class Meta: 15 model = Startup 16 fields = '--all--'
Note that we are going to need to clean the slug field in our StartupForm just as we did for TagForm. In Example 7.30, we copy and paste the function from ...
Read now
Unlock full access