相关疑难解决方法(0)

Django admin模型可以继承吗?

在管理模型中可以继承吗?

例如,请考虑以下内容,

档案: models.py

class AbstractModel ( models.Model ):
    # Meta Information common to all classes
    author = models.ForeignKey(auth.models.User , null = False ,related_name="%(class)s_related_author" ) # The user who created 
    editor = models.ForeignKey(auth.models.User , null = True,related_name="%(class)s_related_editor" ) # The user who last edited                   
    created_at = models.DateTimeField(auto_now_add  = True) # Create Time
    edited_at = models.DateTimeField(auto_now = True) # Modify Time

    class Meta:
                abstract = True


class Topic( AbstractModel ):
    name = models.CharField(max_length = NameMaxLength , unique = True)
    version_number = …
Run Code Online (Sandbox Code Playgroud)

python django django-models django-admin pinax

5
推荐指数
2
解决办法
7332
查看次数

标签 统计

django ×1

django-admin ×1

django-models ×1

pinax ×1

python ×1