Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-25 Thread Mikkel Kromann
Thank you so much for your help, Melvyn. With your help I managed to the the code running :) Here it is, if somebody should find it helpful. cheers, Mikkel >From somewhere, e.g. models.py # The list of model names (just add your model names to it) def GetItemNames(): return [ 'Year', 'Vintage

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-23 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 14:30:08 CEST Mikkel Kromann wrote: > In models.py: > def GetItemPaths():paths = [ ] > for i in [ 'Model1', 'Model2', 'Model3' ]: > p = path( i + '/list/', ItemListView.as_view(model=i), name=i + > '_list' ) > paths.append(p) > > return paths >

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-23 Thread Mikkel Kromann
So, I think I have a neat idea for solving my problem, simply make a function which returns a list of path() returns. In urls.py urlpatterns = GetItemPaths() + [ # other paths ] In models.py: def GetItemPaths():paths = [ ] for i in [ 'Model1', 'Model2', 'Model3' ]: p = path( i +

Re: Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-21 Thread Melvyn Sopacua
On donderdag 21 juni 2018 10:19:08 CEST Mikkel Kromann wrote: > However, I'd really like to give all my urls names so that they can be > easily reversed (e.g. success links). > urlpatterns = [ > path('list//',ItemListView.as_view(), name= > mName+'_list'), > ] > > From what I

Is it possible to construct reversible url names in urls.py using , regex etc

2018-06-21 Thread Mikkel Kromann
I have a lot of models (say 30 or 40) which are so similar, that I have handled them using slightly modified class based views. In urls.py: urlpatterns = [ path('list//',ItemListView.as_view()), path('create//', ItemCreateView.as_view()), path('update//', Ite

Re: url names

2011-07-19 Thread Alasdair Nicol
On 19/07/11 11:08, NISA BALAKRISHNAN wrote: how to add url names to the following entry in urls.py. ( r'^all/synchro/download/file/', "get_all_data_download" ) Use the url function [1] url( r'^all/synchro/download/file/', "get_all_data_download", n

url names

2011-07-19 Thread NISA BALAKRISHNAN
how to add url names to the following entry in urls.py. ( r'^all/synchro/download/file/', "get_all_data_download" ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

Re: Should namespaces be used to clean up url names

2011-01-15 Thread Mike Ramirez
On Saturday, January 15, 2011 11:23:02 am Vitaly Babiy wrote: > The url docs talks about naming urls like this: myapp-comment, does it make > sense to do this still when we have namespaces? With a namespace we could > do myapp:comment this way the url name only describes the view and has no > refer

Should namespaces be used to clean up url names

2011-01-15 Thread Vitaly Babiy
The url docs talks about naming urls like this: myapp-comment, does it make sense to do this still when we have namespaces? With a namespace we could do myapp:comment this way the url name only describes the view and has no reference to the application name that its in. -- You received this me

Seeking design advice: Passing url names to a template

2008-01-25 Thread Julien
Hello there! I'm seeking some design advice, and I hope you'll have some suggestions :) I'm storing my site's menu structure into the database so that I can edit it from the admin. Here's the code: class MenuItem(models.Model): caption = models.CharField(max_length=30) url = models.Char