0
Good afternoon guys, I’m good a doubt! I am using 2 Apps in Django admin
App1 = Registrations
App2 = Controlling Fellows
I imported into "Stock Changers" (App2) the app1 model, the "Person" class in the "Stock Changer" class, but it only takes the "Name" attribute and can only list the name in the Display_list in the app2 admin.py.
Can I list the other attributes of the "Person" class, such as address or data_birth in the display_list in my App2(Controlbolsistas)? and how I do it?
Anyone who can help me, I thank you!
registers/models.py
class Pessoa(models.Model):
CPF = models.CharField(primary_key = True, max_length = 11)
Nome = models.CharField(max_length= 45)
Data_nascimento = models.DateField()
Endereço = models.CharField(max_length=45)
def __str__(self):
return "%s" % (self.Nome)
controledfellows/models.py
from django.db import models
from ..cadastros.models import Pessoa
class Bolsista(models.Model):
pessoa = models.ForeignKey("cadastros.Pessoa")
def __unicode__(self):
return 'Bolsista:' + self.pessoa
controledebolsistas/admin.py
from django.contrib import admin
from gestaobolsistas.controledebolsistas.models import Bolsista
class BolsistaAdmin(admin.ModelAdmin):
model=Bolsista
list_display = ['pessoa']
search_fields = ['pessoa']
admin.site.register(Bolsista, BolsistaAdmin)
Thanks friend, solved my problem here! Thank you very much, hug
– Walkyr Rosa