| | | |
| through regular expressions which map against view | | through regular expressions which map against view |
| functions | | functions |
| | | |
| this were my url definitions: | | this were my url definitions: |
| | | |
n | [code]
| n |
|
| urlpatterns = patterns('barcrud.views', | | urlpatterns = patterns('barcrud.views', |
| (r'^$', 'list'), | | (r'^$', 'list'), |
| (r'^create.*$', 'edit'), | | (r'^create.*$', 'edit'), |
| (r'^edit/(?P<bar_id>\d+)/$' | | (r'^edit/(?P<bar_id>\d+)/$' |
| , 'edit'), | | , 'edit'), |
| (r'^details/(?P<bar_id>\d+) | | (r'^details/(?P<bar_id>\d+) |
| /$', 'details'), | | /$', 'details'), |
| (r'^postcomment/(?P<bar_id> | | (r'^postcomment/(?P<bar_id> |
| \d+)/$', 'postcomment'), | | \d+)/$', 'postcomment'), |
| ) | | ) |
n | [/code]
| n |
|
| | | |
| ** How can you link within templates to other acti | | ** How can you link within templates to other acti |
| ons/views/... ? ** | | ons/views/... ? ** |
| | | |
| unfortunately .. i was too lazy to implement it ev | | unfortunately .. i was too lazy to implement it ev |
| erywhere the "clean" way .. in a real application | | erywhere the "clean" way .. in a real application |
| it should definitifely be used: | | it should definitifely be used: |
| | | |
| it is possible to make reverse lookups which tries | | it is possible to make reverse lookups which tries |
| to apply a given set of parameters to the URL pat | | to apply a given set of parameters to the URL pat |
| terns .. a typical get_absolute_url method in the | | terns .. a typical get_absolute_url method in the |
| _model_ looks like this: | | _model_ looks like this: |
| | | |
n | [code]
| n |
|
| @permalink | | @permalink |
| def get_absolute_url(self): | | def get_absolute_url(self): |
| return ('barcrud.views.details', (), { 'ba | | return ('barcrud.views.details', (), { 'ba |
| r_id': self.id }) | | r_id': self.id }) |
t | [/code]
| t |
|
| | | |
| this could also be used for editing urls & co .. a | | this could also be used for editing urls & co .. a |
| nd .. you could use named URLs to link to URLs not | | nd .. you could use named URLs to link to URLs not |
| associated with models.. | | associated with models.. |
| | | |
| # Various Comments | | # Various Comments |
| | | |