On Wed, 2007-02-14 at 17:00 +0100, Frank Tegtmeyer wrote: > "James Bennett" <[EMAIL PROTECTED]> writes: > > > you had two apps named "payment", it wouldn't just affect templates -- > > Right. Thanks for all the answers. > > My next question is about parameters for applications: how does one do > that in Django? > > Say I want to have two different photo galleries, both of course > served by the same application. > In Zope and skunkweb I have products with parameters - I think there > must be something similar in Django. > > Different instances would be made by URL mapping, but that's one way - > may be the application has to know where it is located in URL space, > maybe there are other things like a separate database table for every > instance, separate users for every instance, number of thumbnails per > page or such things that have to be adjusted. > > How can I achieve this in Django? Do I have to analyze the URL inside > the application and then switch to different parameter sets?
You can pass whatever extra arguments you like to views as the optional third argument in the urlpatterns tuples (in your URL configuration file). Usually, it is going to be easier to pass in some ident for the photo gallery as a parameter that way, since the URLConf has already distinguished the incoming requests for the two instances by that point. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

