diff --git a/.gitignore b/.gitignore index 06793bd..3900625 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ old_stuff/ static/ templates/blogindex.html-media tippy/static/ +warnings.txt diff --git a/templates/base.html b/templates/base.html index f219605..77140a8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -51,8 +51,13 @@
-

© Martin Bley, 2014-2015 | Dank an OpenLigaDB für - die Bereitstellung der Spielergebnisse.

+

+

+ © Martin Bley, 2014-2016 | Dank an + OpenLigaDB für die Bereitstellung der + Spielergebnisse. +
+

diff --git a/templates/blogindex.html b/templates/blogindex.html index e4f318f..faee0b6 100644 --- a/templates/blogindex.html +++ b/templates/blogindex.html @@ -24,8 +24,7 @@
- {{post.author.first_name}} schrieb {{post.created|naturaltime}}, - {{post.title}} + {{post.author.first_name}} schrieb {{post.created|naturaltime}}
{% if avatar %} diff --git a/templates/md.html b/templates/md.html index 9edcd98..37d58ca 100644 --- a/templates/md.html +++ b/templates/md.html @@ -20,8 +20,7 @@ {% for post, avatar in posts %}
- {{post.author.first_name}} schrieb {{post.created|naturaltime}}, - {{post.title}} + {{post.author.first_name}} schrieb {{post.created|naturaltime}}
{% if avatar %} diff --git a/templates/newblogpost.html b/templates/newblogpost.html index d1f60cc..2df5610 100644 --- a/templates/newblogpost.html +++ b/templates/newblogpost.html @@ -23,13 +23,6 @@
{% csrf_token %} -
- {{form.title.errors}} - -
- -
-
{{form.content.errors}} diff --git a/tipp/admin.py b/tipp/admin.py index 276fb46..2e054b2 100644 --- a/tipp/admin.py +++ b/tipp/admin.py @@ -23,19 +23,15 @@ from django.contrib import admin class PostAdmin(admin.ModelAdmin): # fields display on change list - list_display = ['title'] + list_display = ['content'] # fields to filter the change list with list_filter = ['published', 'created'] # fields to search in change list - search_fields = ['title', 'content'] + search_fields = ['content'] # enable the date drill down on change list date_hierarchy = 'created' # enable the save buttons on top on change form save_on_top = True - # prepopulate the slug from the title - big timesaver! - prepopulated_fields = {"slug": ("title",)} - - admin.site.register(Team) admin.site.register(Match) diff --git a/tipp/forms.py b/tipp/forms.py index c2a0ed7..6102244 100644 --- a/tipp/forms.py +++ b/tipp/forms.py @@ -46,7 +46,7 @@ class TippForm(forms.Form): class BlogpostForm(ModelForm): class Meta: model = Post - fields = ['title', 'content'] + fields = ['content'] class UserForm(forms.ModelForm): class Meta: diff --git a/tipp/models.py b/tipp/models.py index ee790f4..36496db 100644 --- a/tipp/models.py +++ b/tipp/models.py @@ -112,8 +112,6 @@ class RelUserMandant(models.Model): return (str(self.user) + " -> " + str(self.mandant)) 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() published = models.BooleanField(default=True) created = models.DateTimeField(auto_now_add=True) @@ -123,9 +121,6 @@ class Post(models.Model): ordering = ['-created'] def __unicode__(self): - return u'%s' % self.title - - def get_absolute_url(self): - return reverse('tipp.views.blogpost', args=[self.slug]) + return u'%s' % self.created diff --git a/tipp/views.py b/tipp/views.py index ae1127f..6e11477 100644 --- a/tipp/views.py +++ b/tipp/views.py @@ -481,17 +481,6 @@ def blogindex(request, 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 def newBlogpost(request): """ @@ -502,12 +491,8 @@ def newBlogpost(request): form = BlogpostForm(request.POST) # check whether it's valid: if form.is_valid(): - # process the data - # fix me - # What to to, if subject is empty? data = form.cleaned_data - slug = slugify(data['title']) - p = Post(author_id=request.user.id, slug=slug, title=data['title'], content=data['content']) + p = Post(author_id=request.user.id, content=data['content']) p.save() # ... @@ -532,13 +517,17 @@ def logout(request): def get_current_md(ls,season): """ get current matchday """ + """ try: current_md = Match.objects.filter(leagueShortcut=ls, season=season, \ finished=False).order_by('matchday').values_list('matchday', \ flat=True).distinct()[0] except IndexError: current_md = Match.objects.filter(leagueShortcut=ls, season=season).aggregate(Max('matchday')) - + except: + current_md = 34 + """ + current_md = 34 return(current_md) def get_current_ls(): diff --git a/tippy/settings.py b/tippy/settings.py index d81afca..8711aeb 100644 --- a/tippy/settings.py +++ b/tippy/settings.py @@ -73,7 +73,7 @@ MEDIA_URL = '/media/' # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # 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/') # URL prefix for static files. @@ -85,7 +85,7 @@ STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # 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 diff --git a/tippy/urls.py b/tippy/urls.py index bf4b38e..6aef1ea 100644 --- a/tippy/urls.py +++ b/tippy/urls.py @@ -19,7 +19,6 @@ urlpatterns = patterns('', url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^blog/newpost$', 'tipp.views.newBlogpost'), url(r'^blog/(?P\d)$', 'tipp.views.blogindex'), - url(r'^blog/(?P[\w\-]+)', 'tipp.views.blogpost'), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),