fixed orphaned plugins and add post functionality

This commit is contained in:
Tomislav R 2016-03-25 19:18:07 +01:00
parent 78e66862bf
commit ddb4de2954
12 changed files with 186 additions and 86 deletions

View file

@ -1,12 +1,12 @@
from django.contrib import admin from django.contrib import admin
from .models import Message, Supporter, DGGallery, DGPicture # from .models import Message, Supporter, DGGallery, DGPicture
class DGPictureInline(admin.StackedInline): # class DGPictureInline(admin.StackedInline):
model = DGPicture # model = DGPicture
#
class DGGalleryAdmin(admin.ModelAdmin): # class DGGalleryAdmin(admin.ModelAdmin):
inlines = [DGPictureInline] # inlines = [DGPictureInline]
#
admin.site.register(DGGallery, DGGalleryAdmin) # admin.site.register(DGGallery, DGGalleryAdmin)
admin.site.register(Message) # admin.site.register(Message)
admin.site.register(Supporter) # admin.site.register(Supporter)

View file

@ -1,36 +1,36 @@
from cms.plugin_base import CMSPluginBase # from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool # from cms.plugin_pool import plugin_pool
from cms.wizards import wizard_base # from cms.wizards import wizard_base
from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter # from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
from django.utils.translation import ugettext as _ # from django.utils.translation import ugettext as _
class CMSGalleryPlugin(CMSPluginBase): # class CMSGalleryPlugin(CMSPluginBase):
model = DGGalleryPlugin # model = DGGalleryPlugin
name = _("Digital Glarus Gallery") # name = _("Digital Glarus Gallery")
render_template = "digitalglarus/gallery.html" # render_template = "digitalglarus/gallery.html"
#
def render(self, context, instance, placeholder): # def render(self, context, instance, placeholder):
context.update({ # context.update({
'gallery':instance.dgGallery, # 'gallery':instance.dgGallery,
'object':instance, # 'object':instance,
'placeholder':placeholder # 'placeholder':placeholder
}) # })
return context # return context
#
class CMSSupportersPlugin(CMSPluginBase): # class CMSSupportersPlugin(CMSPluginBase):
name = _("Digital Glarus Supporters") # name = _("Digital Glarus Supporters")
model = DGSupportersPlugin # model = DGSupportersPlugin
render_template = "digitalglarus/supporters_plugin.html" # render_template = "digitalglarus/supporters_plugin.html"
#
def render(self, context, instance, placeholder): # def render(self, context, instance, placeholder):
context.update({ # context.update({
'supporters': Supporter.objects.all().order_by('name'), # 'supporters': Supporter.objects.all().order_by('name'),
'object': instance, # 'object': instance,
'placeholder':placeholder # 'placeholder':placeholder
}) # })
return context # return context
plugin_pool.register_plugin(CMSGalleryPlugin) # plugin_pool.register_plugin(CMSGalleryPlugin)
plugin_pool.register_plugin(CMSSupportersPlugin) # plugin_pool.register_plugin(CMSSupportersPlugin)

View file

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-24 23:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0013_urlconfrevision'),
('digitalglarus', '0001_initial'),
]
operations = [
]

View file

@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-25 16:59
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0013_urlconfrevision'),
('digitalglarus', '0002_auto_20160324_2321'),
]
operations = [
migrations.RemoveField(
model_name='dggallery',
name='parent',
),
migrations.RemoveField(
model_name='dggalleryplugin',
name='cmsplugin_ptr',
),
migrations.RemoveField(
model_name='dggalleryplugin',
name='dgGallery',
),
migrations.RemoveField(
model_name='dgpicture',
name='gallery',
),
migrations.RemoveField(
model_name='dgpicture',
name='image',
),
migrations.RemoveField(
model_name='dgsupportersplugin',
name='cmsplugin_ptr',
),
migrations.DeleteModel(
name='Supporter',
),
migrations.DeleteModel(
name='DGGallery',
),
migrations.DeleteModel(
name='DGGalleryPlugin',
),
migrations.DeleteModel(
name='DGPicture',
),
migrations.DeleteModel(
name='DGSupportersPlugin',
),
]

View file

@ -15,40 +15,40 @@ class Message(models.Model):
return "%s - %s - %s" % (self.name, self.email, self.received_date) return "%s - %s - %s" % (self.name, self.email, self.received_date)
class Supporter(models.Model): # class Supporter(models.Model):
name = models.CharField(max_length=200) # name = models.CharField(max_length=200)
description = models.TextField(null=True, blank=True) # description = models.TextField(null=True, blank=True)
#
# def __str__(self):
# return "%s" % (self.name)
#
# def get_absolute_url(self):
# return reverse('dgSupporters_view', args=[self.pk])
#
#
# class DGGallery(models.Model):
# parent = models.ForeignKey('self', blank=True, null=True)
# name = models.CharField(max_length=30)
#
# def __str__(self):
# return "%s" % (self.name)
#
# def get_absolute_url(self):
# return reverse('dgGallery_view', args=[self.pk])
#
# class Meta:
# verbose_name_plural = 'dgGallery'
def __str__(self): # class DGPicture(models.Model):
return "%s" % (self.name) # gallery = models.ForeignKey(DGGallery)
# image = FilerImageField(related_name='dg_gallery')
def get_absolute_url(self): # description = models.CharField(max_length=60)
return reverse('dgSupporters_view', args=[self.pk]) #
# def __str__(self):
# return "%s" % (self.image.name)
class DGGallery(models.Model): #
parent = models.ForeignKey('self', blank=True, null=True) # class DGGalleryPlugin(CMSPlugin):
name = models.CharField(max_length=30) # dgGallery = models.ForeignKey(DGGallery)
#
def __str__(self): # class DGSupportersPlugin(CMSPlugin):
return "%s" % (self.name) # pass
def get_absolute_url(self):
return reverse('dgGallery_view', args=[self.pk])
class Meta:
verbose_name_plural = 'dgGallery'
class DGPicture(models.Model):
gallery = models.ForeignKey(DGGallery)
image = FilerImageField(related_name='dg_gallery')
description = models.CharField(max_length=60)
def __str__(self):
return "%s" % (self.image.name)
class DGGalleryPlugin(CMSPlugin):
dgGallery = models.ForeignKey(DGGallery)
class DGSupportersPlugin(CMSPlugin):
pass

View file

@ -1,5 +1,4 @@
{% load i18n thumbnail %} {% load i18n thumbnail %}
<article id="post-{{ post.slug }}" class="post-item col-lg-12 text-center"> <article id="post-{{ post.slug }}" class="post-item col-lg-12 text-center">
{% if post.main_image %} {% if post.main_image %}
<div class="blog-visual"> <div class="blog-visual">

View file

@ -9,7 +9,7 @@ urlpatterns = [
url(r'old_letscowork$', views.letscowork, name='letscowork'), url(r'old_letscowork$', views.letscowork, name='letscowork'),
url(r'old_home$', views.home, name='home'), url(r'old_home$', views.home, name='home'),
url(r'supporters/$', views.supporters, name='supporters'), url(r'supporters/$', views.supporters, name='supporters'),
url(r'', views.index, name='index') url(r'', views.index, name='index'),
# url(r'blog/',views.blog,name='blog'), url(r'blog/',views.blog,name='blog'),
# url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'), url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'),
] ]

View file

@ -8,7 +8,7 @@ from django.utils.translation import get_language
from djangocms_blog.models import Post from djangocms_blog.models import Post
from django.core.urlresolvers import resolve from django.core.urlresolvers import resolve
from .models import Message, Supporter from .models import Message#, Supporter
class MessageForm(ModelForm): class MessageForm(ModelForm):
required_css_class = 'form-control' required_css_class = 'form-control'

View file

@ -59,7 +59,7 @@ INSTALLED_APPS = (
'parler', 'parler',
'taggit', 'taggit',
'taggit_autosuggest', 'taggit_autosuggest',
'django_select2', # 'django_select2',
'meta', 'meta',
'meta_mixin', 'meta_mixin',
'bootstrap3', 'bootstrap3',
@ -67,6 +67,14 @@ INSTALLED_APPS = (
'filer', 'filer',
'djangocms_blog', 'djangocms_blog',
'cms', # django CMS itself 'cms', # django CMS itself
'aldryn_apphooks_config',
'aldryn_boilerplates',
'aldryn_categories',
'aldryn_common',
'aldryn_newsblog',
'aldryn_people',
'aldryn_reversion',
'aldryn_translation_tools',
'treebeard', # utilities for implementing a tree 'treebeard', # utilities for implementing a tree
'sekizai', # for javascript and css management 'sekizai', # for javascript and css management
'menus', # helper for model independent hierarchical website navigation 'menus', # helper for model independent hierarchical website navigation
@ -78,7 +86,6 @@ INSTALLED_APPS = (
'djangocms_picture', 'djangocms_picture',
'djangocms_video', 'djangocms_video',
'djangocms_flash', 'djangocms_flash',
'djangocms_googlemap', 'djangocms_googlemap',
'djangocms_inherit', 'djangocms_inherit',
'djangocms_link', 'djangocms_link',

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-24 23:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('membership', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='creditcards',
name='user_id',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.CustomUser'),
),
]

View file

@ -45,3 +45,5 @@ django-filer
cmsplugin-filer cmsplugin-filer
django-reversion django-reversion
pylibmc pylibmc
django_extensions
django-debug-toolbar

View file

@ -32,6 +32,6 @@
{# {% endblock %}#} {# {% endblock %}#}
</header> </header>
{% endspaceless %} {% endspaceless %}
<div class="digitalglarus-blog-content">{{ post.abstract| safe }}</div> <div class="digitalglarus-blog-content">{% render_placeholder post.content %}</div>
</article> </article>
{% endblock content_blog %} {% endblock content_blog %}