diff --git a/application/forms.py b/application/forms.py index 38e6cf0..54503d9 100644 --- a/application/forms.py +++ b/application/forms.py @@ -1,8 +1,15 @@ from django import forms from .models import Post, CustomUser +from taggit.forms import * +from django.contrib.auth.forms import UserCreationForm, UserChangeForm class PostForm(forms.ModelForm): - published_date = forms.DateField(widget=forms.widgets.DateInput(format="%d. %h %Y, %M:%S")) class Meta: model = Post - fields = ('title', 'text', 'published_date', 'tags') \ No newline at end of file + fields = ('title', 'text', 'published_date', 'tags') + +class NewTagForm(forms.ModelForm): + m_tags = TagField() + class Meta: + model = CustomUser + fields = ['m_tags'] diff --git a/application/models.py b/application/models.py index 7276bfc..c447e8c 100644 --- a/application/models.py +++ b/application/models.py @@ -4,8 +4,8 @@ from django.utils import timezone from taggit.managers import TaggableManager class CustomUser(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE) - mytags = TaggableManager() + user = models.OneToOneField(User, null = True, on_delete=models.CASCADE) + tags = TaggableManager() class Post(models.Model): diff --git a/application/templates/student_page.html b/application/templates/student_page.html index d98c169..2f5fab9 100644 --- a/application/templates/student_page.html +++ b/application/templates/student_page.html @@ -10,4 +10,10 @@