Dear Django group,
in part 2 of the tutorial some ways are shown how to format the admin
site. This is really nice, how fast this can be set up. Does the admin
site bring also a way to display it the following way, without having
to write it by myself? I could not find it neither in its
documentation [2] nor using the search field in the documentation.
I have the following models defined in models.py. (I “normalized” the
models because for example siblings can have the same address.)
class Adresse(models.Model):
strasse = models.CharField(max_length=200)
nummer = models.CharField(max_length=5)
def __unicode__(self):
return u'%s %s' % (self.strasse, self.hausnummer)
class Person(models.Model):
name = models.CharField(max_length=200)
vorname = models.CharField(max_length=200)
adresse = models.ForeignKey(Adresse, blank=True, null=True)
def __unicode__(self):
return u'%s %s' % (self.vorname, self.name)
As decribed I am registering these two models in admin.py.
admin.site.register(Adresse)
admin.site.register(Person)
As you know it is displayed as follows when I want to add a Person.
Name: _______
Vorname: _______
Adresse: Selection Box + (+ for adding now record)
What I would like how it is displayed when adding a person is as
follows.
Name: _______
Vorname: _______
Strasse: ________ Nummer __ +
(When typing the already available records are shown to be selectable,
but if it is not there I can type in the street name and number and
hit plus and it is added to Adresse.)
With the provided inline-classes of the admin site I just could figure
out that I can get add an adress and right away several persons who
live there. But this is not very intuitive.
Is there an easy way to accomplish my goal as we have gotten used to
using Django?
Thanks a lot,
Paul
[1] http://docs.djangoproject.com/en/dev/intro/tutorial02/#intro-tutorial02
[2] http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---