Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forms.py 524B

6 years ago
123456789101112131415161718192021222324
  1. from django import forms
  2. from datetime import datetime
  3. from .models import Post, CustomUser
  4. from django.forms import ModelForm, ValidationError
  5. from taggit.forms import *
  6. #extended code customised
  7. #import from https://tutorial.djangogirls.org/en/django_forms/
  8. class PostForm(forms.ModelForm):
  9. class Meta:
  10. model = Post
  11. fields = ('title', 'text', 'published_date','tags')
  12. class NewTagForm(forms.ModelForm):
  13. tags = TagField()
  14. class Meta:
  15. model = CustomUser
  16. fields = ['tags']