当我使用Python3.4在相关名称中使用%(app_label)s_%(class)s
时出现以下错误
'app_label': cls._meta.app_label.lower()
TypeError: unsupported operand type(s) for %: 'bytes' and 'dict'
还有另一种方法吗?
修改
class TimeStampModel(models.Model):
modified = models.DateTimeField(auto_now=True)
created = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, related_name = "%(app_label)s_%(class)s_created_by" ,)
edited_by = models.ForeignKey(User, related_name = "%(app_label)s_%(class)s_edited_by" , blank=True, null=True)
class Meta:
abstract = True