0

I'm working through the book Django 2 By Example, in which I'm trying to build a blog application with tagging functionality.

My code for including django-taggit (after installing version 0.22.2 with pip) is the following.

Add the app to INSTALLED_APPS:

INSTALLED_APPS = [
    #...
    'blog.apps.BlogConfig',
    'taggit',
]

Add TaggableManager provided by django-taggit to Post model.

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.urls import reverse
from taggit.managers import TaggableManager
# Create your models here.
class PublishedManager(models.Manager):
    def get_queryset(self):
        return super(PublishedManager, self).get_queryset().filter(status='published')


class Post(models.Model):
    STATUS_CHOICES = (
        ('draft', 'Draft'),
        ('published', 'Published'),
    )
    title = models.CharField(max_length=250)
    slug = models.SlugField(max_length=250, unique_for_date='publish')
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='blog_posts')
    body = models.TextField(default='')
    publish = models.DateTimeField(default=timezone.now)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)
    status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='draft')

    objects = models.Manager() # The default manager.
    published = PublishedManager() # Our custom manager.
    tags = TaggableManager()
    def get_absolute_url(self):
        return reverse('blog:post_detail',
                       args=[self.publish.year,
                             self.publish.month,
                             self.publish.day,
                             self.slug])
    class Meta:
        ordering = ('publish',)

    def __str__(self):
        return self.title

When I add the line tags = TaggableManager() to the Post model, I get the following error when trying to add a new post or edit an existing post via the admin site:

TypeError: render() got an unexpected keyword argument 'renderer'.

I have no idea why this error is being generated, so any advice would be greatly appreciated.

J Finer
  • 389
  • 1
  • 3
  • 10

2 Answers2

1

I've the same problem and I resolved installing django-taggit 0.23.0

I type into virtualenv: pip install django-taggit==0.23.0

I hope that help you. Best Regard.

Paolo
  • 21,270
  • 6
  • 38
  • 69
Matteo
  • 26
  • 1
0

I found the answer on this link. https://github.com/froala/django-froala-editor/issues/55

solution: Navigate to django/forms/boundfields.py And remove line 93 (renderer=self.form.renderer).