Django
1
Вклад в тег
mkdir myproject
cd mypyroject
git init
git remote add MYSERVER git@MYSERVER:myproject.git
touch testfile
git add .
git commit -am 'add test file'
git push MYSERVER master:refs/heads/master
git init --bare myserver ssh://git@myserver:2280/home/git/repositories/test.git
url(r'^news/(?P(\d){8})?(\-)?(?P(\d)+)?$', news_views.show_news, name="news-url"),
models.py:
class News(models.Model):
...........
def get_absolute_url(self):
return "/news/%s" % (self.news_date.strftime('%Y%m%d') + '-' + str(self.id))
template.html:
{{ news.title }}