在事件中添加人之前,我想对其进行搜索。
我在admin.py
中用不同的方法尝试了很多次,但我无法获得。
有人可以帮我解决admin.py
吗?
models.py
class Person (models.Model):
dni= models.CharField(primary_key = True, max_length=9 )
name= models.CharField(max_length = 30)
surname1 = models.CharField(max_length = 30)
surname2 = models.CharField(max_length = 30)
table = models.PositiveIntegerField(default=0)
def __str__(self):
return self.dni
class Meta:
ordering = ('dni',)
class Event (models.Model):
name = models.CharField(max_length = 100)
people= models.ManyToManyField(Person,blank = True, default = None)
date = models.DateField('date event')
category = models.CharField (choices = TYPE_EVENT, max_length = 1)
def __str__(self):
return self.name
class Meta:
ordering = ('name',)
我想得到类似这样的东西(link),但是我没有得到解决方案:S。