TypeError:getattr()不带关键字参数

时间:2019-07-15 20:49:28

标签: python django

这是我的模型。py

@python_2_unicode_compatible
class TaggedItem(models.Model):
    content_type = models.ForeignKey(
        ContentType,
        related_name=getattr(
            settings, 'USER_TAGS_RELATED_NAME', 'user_tags_tagged_items', on_delete=models.CASCADE),
    )
    object_id = models.PositiveIntegerField()
    content_object = GenericForeignKey('content_type', 'object_id')

    user_tags = models.ManyToManyField(
        'user_tags.UserTag',
        verbose_name=_('User tag'),
    )

    def __str__(self):
        return str(self.content_object)

0 个答案:

没有答案