SCT Development Cheat sheet
Development / CheatsheetBack to Snip <-- Previous Change | Next Change -->
Diff Summary | |||||
---|---|---|---|---|---|
Title | SCT Development Cheat sheet | SCT Development Cheat sheet | |||
Date | 2008-04-04 07:14:06 | 2008-04-04 07:15:39 | |||
Editor | Herbert Poul | Herbert Poul | |||
Tags |
2008-04-04 07:14:06 by Herbert Poul | 2008-04-04 07:15:39 by Herbert Poul | ||||
---|---|---|---|---|---|
n | 1 | n | |||
2 | # General | 1 | # General | ||
3 | 2 | ||||
4 | ## Reverse lookup for a view -> URL | 3 | ## Reverse lookup for a view -> URL | ||
5 | 4 | ||||
6 | ### in python: | 5 | ### in python: | ||
16 | {% sph_url2 view_name arg=value %} | 15 | {% sph_url2 view_name arg=value %} | ||
17 | 16 | ||||
18 | # Models | 17 | # Models | ||
19 | 18 | ||||
20 | ## Absolute URLs | 19 | ## Absolute URLs | ||
t | t | 20 | |||
21 | from sphene.community.middleware import get_cu | ||||
> | rrent_request | ||||
22 | from sphene.community.sphutils import sphperma | ||||
> | link as permalink | ||||
23 | |||||
24 | |||||
25 | class MyModel(models.Model): | ||||
26 | |||||
27 | def get_absolute_edit_url(self): | ||||
28 | return ('sphene.sphblockframework.view | ||||
> | s.edit_block_config', (), { 'groupName': self.grou | ||||
> | p.name, 'bock_config_id': self.id }) | ||||
29 | get_absolute_edit_url = permalink(get_absolute | ||||
> | _edit_url, get_current_request) |