Hey Guys, I'm trying to create a "router" as recommended in IRC for several different views. My Views are UpdateViews, so they are the new CBVs. I don't mind my router being a simple function based view, though.
Basically, a User can edit some data. This data changes based upon the user's "class" ... although when I say that, it's not programmatically what I mean. A user can have a Band object, OR they can have a Musician object, or later on there'll be more choices. I want there to be one URL to edit that data. For example, they could go to http://www.example.com/edit-profile and based upon what type of an object the user has, they will be presented a specific ModelView. So if the user goes to that URL and they are a Musician, they will be presented my MusicianProfileUpdateView. If they are a Band, they will be presented my BandProfileUpdatedView. And so forth.... I'm just really not sure what the simplest way to do this is. My views have quite a bit of custom logic and overrides so in a best case scenario, I'd be able to do the following: if Band.objects.filter(user = user).exists(): return BandProfileUpdateView elif Musician.objects.filter(user = user).exists(): return MusicianProfileUpdateView Currently, I just give them different URLs but I think it's a horrible approach from a User-experience point of view. I'm open to any suggestions, and if it's something pretty complex then feel free to throw in a short snippet example. Thanks :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.