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 }}
class UserProfileForm(ModelForm):
def __init__(self, *args, **kwargs):
super(UserProfileForm, self).__init__(*args, **kwargs)
try:
country_id = self.instance.country.id
self.fields['city'].queryset = City.objects.filter(country=country_id)
except:
pass
class Meta:
model = UserProfile
exclude = ('deleted', 'deletion_date', 'blocked_until', 'activation_key', 'blocked_times', 'test_fails',)
* This source code was highlighted with Source Code Highlighter.
return HttpResponse(
js,
content_type = 'application/json; charset=utf8')
return HttpResponse(
js,
content_type = 'application/json; charset=utf-8')
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