Hi group,
Right now, we use Django primarily because of the administration panel.
It's easy to conjure up some models and then have a nice front end to
create and change them. We use it for managing a detector network and I
have the following (simplified for the sake of this example) models:
class Organization(models.Model):
name = models.CharField(max_length=40)
class Location(models.Model):
organization = models.ForeignKey(Organization)
name = models.CharField(max_length=40)
address = models.CharField(max_length=40)
class Station(models.Model):
number = models.IntegerField(unique=True)
location = models.ForeignKey(Location)
That is, we have several organizations managing one or a few detector
stations. Each organization has one or a few locations at which they
have one or a few detectors set up. For example: organization 'Org A'
has locations 'Loc A' and 'Loc B'. At 'Loc A', there's station 101. At
'Loc B', there're stations 102 and 103.
When a new partner joins our network, to add a station, we first have to
add an organization, then a location and only then can we add a station.
Clicking on 'add station' and then using the convenient 'green pluses'
opens up a few windows which clutter the interface.
Since new partners join our network regularly and since the most common
setup is one organization, one location, one station, I'd like to add a
convenient form. First, I thought about inline models in the admin
interface but, alas, I can only specify Location as inline to
Organization, but I can't show a Station form at the same time. Then, I
thought about a Wizard, but populating the Location.name field from the
Organization.name field is not documented. I tried some things, but
can't figure it out. Then, I thought about building my own view with
multiple Forms but I'd like to reuse the admin CSS. However, creating
the right template context is proving too much of a challenge. Clearly,
I don't really understand much of the admin site magic going on.
I want something like this:
Add organization:
<OrganizationForm>
Location:
<LocationForm>
Station:
<StationForm>
on one page. Preferably, looking like something resembling the admin
change pages. I've seen
http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-more-than-one-formset-in-a-view
but then I really have to build my own admin resembling template. Or do I? And
maybe, knowing which parts to override, this might be easy?
Does someone know of the Django-Way (tm) to do something like this?
Thanks!
Regards,
David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---