Browse Source

edited tag code

newsletter
Esther Kleinhenz 6 years ago
parent
commit
b8a6c16ac2
4 changed files with 4 additions and 3 deletions
  1. 1
    1
      application/forms.py
  2. 1
    1
      application/models.py
  3. 1
    1
      application/urls.py
  4. 1
    0
      application/views.py

+ 1
- 1
application/forms.py View File

@@ -6,7 +6,7 @@ from django.contrib.auth.forms import UserCreationForm, UserChangeForm
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ('title', 'text', 'published_date', 'tags')
fields = ('title', 'text', 'published_date','tags')

class NewTagForm(forms.ModelForm):
m_tags = TagField()

+ 1
- 1
application/models.py View File

@@ -4,7 +4,7 @@ from django.utils import timezone
from taggit.managers import TaggableManager

class CustomUser(models.Model):
user = models.OneToOneField(User, null = True, on_delete=models.CASCADE)
user = models.OneToOneField('auth.User', null = True, on_delete=models.CASCADE)
tags = TaggableManager()



+ 1
- 1
application/urls.py View File

@@ -13,6 +13,6 @@ urlpatterns = [
url(r'^drafts/$', views.post_draft_list, name='post_draft_list'),
url(r'^post/(?P<pk>\d+)/publish/$', views.post_publish, name='post_publish'),
url(r'^post/(?P<pk>\d+)/remove/$', views.post_remove, name='post_remove'),
url(r'^tags/', include('taggit_templatetags2.urls')),
url(r'^tags/', include('taggit_templatetags2.urls')),
]


+ 1
- 0
application/views.py View File

@@ -79,6 +79,7 @@ def post_edit(request, pk):
post = form.save(commit=False)
post.author = request.user
post.save()
form.save_m2m()
return redirect('post_detail', pk=post.pk)
else:
form = PostForm(instance=post)

Loading…
Cancel
Save