我现有的django项目的admin.py
为
from django.contrib import admin
from .models import ScholarProfile
admin.site.register(ScholarProfile)
和models.py
为
class ScholarProfile(models.Model):
author_name= models.CharField(max_length=100)
profile_url= models.URLField(max_length=200, primary_key= True)
Company= models.CharField(max_length=100, null=True)
Website= models.CharField(max_length=100, null=True)
publication_title= ArrayField(models.CharField(max_length=500))
normalized_citations= ArrayField(models.CharField(max_length=50), null= True)
citations= ArrayField(models.CharField(max_length=50), null= True)
coAuthors= ArrayField(models.CharField(max_length=50), null= True)
created_at= models.DateTimeField(auto_now_add= True)
country= models.CharField(max_length=100, null= True)
publications= models.CharField(max_length=100, null= True)
Tcitations= models.CharField(max_length=100, null= True)
Hindex= models.CharField(max_length=100, null= True)
Gindex= models.CharField(max_length=100, null= True)
Mindex= models.CharField(max_length=100, null= True)
Oindex= models.CharField(max_length=100, null= True)
Eindex= models.CharField(max_length=100, null= True)
Hmedian= models.CharField(max_length=100, null= True)
TNCc= models.CharField(max_length=100, default= '00', )
Year= ArrayField(models.CharField(max_length=100), null=True)
def __str__(self):
return (self.author_name)
我想创建一个新模型,例如AuthorPublications
,只包含上述类中的一些字段,例如Company
和Year
。如何在新类中使用它们(继承他们。)此外,此新模型应该与上述模型的author_name
(外键?)相关联