Merge branch 'iss02'
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ old_stuff/
|
|||||||
static/
|
static/
|
||||||
templates/blogindex.html-media
|
templates/blogindex.html-media
|
||||||
tippy/static/
|
tippy/static/
|
||||||
|
warnings.txt
|
||||||
|
|||||||
@@ -51,8 +51,13 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<p>© Martin Bley, 2014-2015 | Dank an <a href="http://openligadb.de">OpenLigaDB</a> für
|
<p>
|
||||||
die Bereitstellung der Spielergebnisse.</p>
|
<div class="pull-left">
|
||||||
|
© Martin Bley, 2014-2016 | Dank an
|
||||||
|
<a href="http://openligadb.de">OpenLigaDB</a> für die Bereitstellung der
|
||||||
|
Spielergebnisse.
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,8 +24,7 @@
|
|||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{post.author.first_name}} schrieb {{post.created|naturaltime}},
|
{{post.author.first_name}} schrieb {{post.created|naturaltime}}
|
||||||
<a href="{{post.get_absolute_url}}">{{post.title}}</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if avatar %}
|
{% if avatar %}
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
{% for post, avatar in posts %}
|
{% for post, avatar in posts %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{post.author.first_name}} schrieb {{post.created|naturaltime}},
|
{{post.author.first_name}} schrieb {{post.created|naturaltime}}
|
||||||
<a href="{{post.get_absolute_url}}">{{post.title}}</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if avatar %}
|
{% if avatar %}
|
||||||
|
|||||||
@@ -23,13 +23,6 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<form class="form-horizontal" action="" method="post">{% csrf_token %}
|
<form class="form-horizontal" action="" method="post">{% csrf_token %}
|
||||||
<div class="form-group">
|
|
||||||
{{form.title.errors}}
|
|
||||||
<label for="id_title" class="col-sm-4 control-label required">{% trans 'Title' %}</label>
|
|
||||||
<div class="col-sm-5">
|
|
||||||
<input id="id_title" maxlength="32" name="title" class="form-control" type="text" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{form.content.errors}}
|
{{form.content.errors}}
|
||||||
<label for="id_content" class="col-sm-4 control-label required">{% trans 'Content' %}</label>
|
<label for="id_content" class="col-sm-4 control-label required">{% trans 'Content' %}</label>
|
||||||
|
|||||||
@@ -23,19 +23,15 @@ from django.contrib import admin
|
|||||||
|
|
||||||
class PostAdmin(admin.ModelAdmin):
|
class PostAdmin(admin.ModelAdmin):
|
||||||
# fields display on change list
|
# fields display on change list
|
||||||
list_display = ['title']
|
list_display = ['content']
|
||||||
# fields to filter the change list with
|
# fields to filter the change list with
|
||||||
list_filter = ['published', 'created']
|
list_filter = ['published', 'created']
|
||||||
# fields to search in change list
|
# fields to search in change list
|
||||||
search_fields = ['title', 'content']
|
search_fields = ['content']
|
||||||
# enable the date drill down on change list
|
# enable the date drill down on change list
|
||||||
date_hierarchy = 'created'
|
date_hierarchy = 'created'
|
||||||
# enable the save buttons on top on change form
|
# enable the save buttons on top on change form
|
||||||
save_on_top = True
|
save_on_top = True
|
||||||
# prepopulate the slug from the title - big timesaver!
|
|
||||||
prepopulated_fields = {"slug": ("title",)}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Team)
|
admin.site.register(Team)
|
||||||
admin.site.register(Match)
|
admin.site.register(Match)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class TippForm(forms.Form):
|
|||||||
class BlogpostForm(ModelForm):
|
class BlogpostForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Post
|
model = Post
|
||||||
fields = ['title', 'content']
|
fields = ['content']
|
||||||
|
|
||||||
class UserForm(forms.ModelForm):
|
class UserForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -112,8 +112,6 @@ class RelUserMandant(models.Model):
|
|||||||
return (str(self.user) + " -> " + str(self.mandant))
|
return (str(self.user) + " -> " + str(self.mandant))
|
||||||
|
|
||||||
class Post(models.Model):
|
class Post(models.Model):
|
||||||
title = models.CharField(max_length=255, null=False, blank=False)
|
|
||||||
slug = models.SlugField(unique=True, max_length=255)
|
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
published = models.BooleanField(default=True)
|
published = models.BooleanField(default=True)
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
@@ -123,9 +121,6 @@ class Post(models.Model):
|
|||||||
ordering = ['-created']
|
ordering = ['-created']
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'%s' % self.title
|
return u'%s' % self.created
|
||||||
|
|
||||||
def get_absolute_url(self):
|
|
||||||
return reverse('tipp.views.blogpost', args=[self.slug])
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -481,17 +481,6 @@ def blogindex(request, page):
|
|||||||
'page': page
|
'page': page
|
||||||
})
|
})
|
||||||
|
|
||||||
@login_required
|
|
||||||
def blogpost(request, slug):
|
|
||||||
# get the Post object
|
|
||||||
post = get_object_or_404(Post, slug=slug)
|
|
||||||
# now return the rendered template
|
|
||||||
return render(request, 'blogpost.html', {
|
|
||||||
'post': post,
|
|
||||||
'ls': get_current_ls(),
|
|
||||||
'season': get_current_season()
|
|
||||||
})
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def newBlogpost(request):
|
def newBlogpost(request):
|
||||||
"""
|
"""
|
||||||
@@ -502,12 +491,8 @@ def newBlogpost(request):
|
|||||||
form = BlogpostForm(request.POST)
|
form = BlogpostForm(request.POST)
|
||||||
# check whether it's valid:
|
# check whether it's valid:
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
# process the data
|
|
||||||
# fix me
|
|
||||||
# What to to, if subject is empty?
|
|
||||||
data = form.cleaned_data
|
data = form.cleaned_data
|
||||||
slug = slugify(data['title'])
|
p = Post(author_id=request.user.id, content=data['content'])
|
||||||
p = Post(author_id=request.user.id, slug=slug, title=data['title'], content=data['content'])
|
|
||||||
p.save()
|
p.save()
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
@@ -532,13 +517,17 @@ def logout(request):
|
|||||||
|
|
||||||
def get_current_md(ls,season):
|
def get_current_md(ls,season):
|
||||||
""" get current matchday """
|
""" get current matchday """
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
current_md = Match.objects.filter(leagueShortcut=ls, season=season, \
|
current_md = Match.objects.filter(leagueShortcut=ls, season=season, \
|
||||||
finished=False).order_by('matchday').values_list('matchday', \
|
finished=False).order_by('matchday').values_list('matchday', \
|
||||||
flat=True).distinct()[0]
|
flat=True).distinct()[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
current_md = Match.objects.filter(leagueShortcut=ls, season=season).aggregate(Max('matchday'))
|
current_md = Match.objects.filter(leagueShortcut=ls, season=season).aggregate(Max('matchday'))
|
||||||
|
except:
|
||||||
|
current_md = 34
|
||||||
|
"""
|
||||||
|
current_md = 34
|
||||||
return(current_md)
|
return(current_md)
|
||||||
|
|
||||||
def get_current_ls():
|
def get_current_ls():
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ MEDIA_URL = '/media/'
|
|||||||
# Don't put anything in this directory yourself; store your static files
|
# Don't put anything in this directory yourself; store your static files
|
||||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||||
# Example: "/home/media/media.lawrence.com/static/"
|
# Example: "/home/media/media.lawrence.com/static/"
|
||||||
STATIC_ROOT = '/home/martin/dev/tippy/TipPy/static/'
|
STATIC_ROOT = '/home/martin/Entwicklung/tippy/TipPy/static/'
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
||||||
|
|
||||||
# URL prefix for static files.
|
# URL prefix for static files.
|
||||||
@@ -85,7 +85,7 @@ STATICFILES_DIRS = (
|
|||||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||||
# Always use forward slashes, even on Windows.
|
# Always use forward slashes, even on Windows.
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
'/home/martin/dev/tippy/TipPy/tippy/static',
|
'/home/martin/Entwicklung/tippy/TipPy/tippy/static',
|
||||||
)
|
)
|
||||||
|
|
||||||
# List of finder classes that know how to find static files in
|
# List of finder classes that know how to find static files in
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ urlpatterns = patterns('',
|
|||||||
url(r'^accounts/', include('django.contrib.auth.urls')),
|
url(r'^accounts/', include('django.contrib.auth.urls')),
|
||||||
url(r'^blog/newpost$', 'tipp.views.newBlogpost'),
|
url(r'^blog/newpost$', 'tipp.views.newBlogpost'),
|
||||||
url(r'^blog/(?P<page>\d)$', 'tipp.views.blogindex'),
|
url(r'^blog/(?P<page>\d)$', 'tipp.views.blogindex'),
|
||||||
url(r'^blog/(?P<slug>[\w\-]+)', 'tipp.views.blogpost'),
|
|
||||||
|
|
||||||
# Uncomment the admin/doc line below to enable admin documentation:
|
# Uncomment the admin/doc line below to enable admin documentation:
|
||||||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||||
|
|||||||
Reference in New Issue
Block a user