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 .models import Message, Supporter, DGGallery, DGPicture
# from .models import Message, Supporter, DGGallery, DGPicture
class DGPictureInline(admin.StackedInline):
model = DGPicture
class DGGalleryAdmin(admin.ModelAdmin):
inlines = [DGPictureInline]
admin.site.register(DGGallery, DGGalleryAdmin)
admin.site.register(Message)
admin.site.register(Supporter)
# class DGPictureInline(admin.StackedInline):
# model = DGPicture
#
# class DGGalleryAdmin(admin.ModelAdmin):
# inlines = [DGPictureInline]
#
# admin.site.register(DGGallery, DGGalleryAdmin)
# admin.site.register(Message)
# admin.site.register(Supporter)

View file

@ -1,36 +1,36 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.wizards import wizard_base
from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
from django.utils.translation import ugettext as _
# from cms.plugin_base import CMSPluginBase
# from cms.plugin_pool import plugin_pool
# from cms.wizards import wizard_base
# from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
# from django.utils.translation import ugettext as _
class CMSGalleryPlugin(CMSPluginBase):
model = DGGalleryPlugin
name = _("Digital Glarus Gallery")
render_template = "digitalglarus/gallery.html"
def render(self, context, instance, placeholder):
context.update({
'gallery':instance.dgGallery,
'object':instance,
'placeholder':placeholder
})
return context
class CMSSupportersPlugin(CMSPluginBase):
name = _("Digital Glarus Supporters")
model = DGSupportersPlugin
render_template = "digitalglarus/supporters_plugin.html"
def render(self, context, instance, placeholder):
context.update({
'supporters': Supporter.objects.all().order_by('name'),
'object': instance,
'placeholder':placeholder
})
return context
# class CMSGalleryPlugin(CMSPluginBase):
# model = DGGalleryPlugin
# name = _("Digital Glarus Gallery")
# render_template = "digitalglarus/gallery.html"
#
# def render(self, context, instance, placeholder):
# context.update({
# 'gallery':instance.dgGallery,
# 'object':instance,
# 'placeholder':placeholder
# })
# return context
#
# class CMSSupportersPlugin(CMSPluginBase):
# name = _("Digital Glarus Supporters")
# model = DGSupportersPlugin
# render_template = "digitalglarus/supporters_plugin.html"
#
# def render(self, context, instance, placeholder):
# context.update({
# 'supporters': Supporter.objects.all().order_by('name'),
# 'object': instance,
# 'placeholder':placeholder
# })
# return context
plugin_pool.register_plugin(CMSGalleryPlugin)
plugin_pool.register_plugin(CMSSupportersPlugin)
# plugin_pool.register_plugin(CMSGalleryPlugin)
# 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)
class Supporter(models.Model):
name = models.CharField(max_length=200)
description = models.TextField(null=True, blank=True)
# class Supporter(models.Model):
# name = models.CharField(max_length=200)
# 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):
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'
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
# 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 %}
<article id="post-{{ post.slug }}" class="post-item col-lg-12 text-center">
{% if post.main_image %}
<div class="blog-visual">

View file

@ -9,7 +9,7 @@ urlpatterns = [
url(r'old_letscowork$', views.letscowork, name='letscowork'),
url(r'old_home$', views.home, name='home'),
url(r'supporters/$', views.supporters, name='supporters'),
url(r'', views.index, name='index')
# url(r'blog/',views.blog,name='blog'),
# url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'),
url(r'', views.index, name='index'),
url(r'blog/',views.blog,name='blog'),
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 django.core.urlresolvers import resolve
from .models import Message, Supporter
from .models import Message#, Supporter
class MessageForm(ModelForm):
required_css_class = 'form-control'

View file

@ -59,7 +59,7 @@ INSTALLED_APPS = (
'parler',
'taggit',
'taggit_autosuggest',
'django_select2',
# 'django_select2',
'meta',
'meta_mixin',
'bootstrap3',
@ -67,6 +67,14 @@ INSTALLED_APPS = (
'filer',
'djangocms_blog',
'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
'sekizai', # for javascript and css management
'menus', # helper for model independent hierarchical website navigation
@ -78,7 +86,6 @@ INSTALLED_APPS = (
'djangocms_picture',
'djangocms_video',
'djangocms_flash',
'djangocms_googlemap',
'djangocms_inherit',
'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
django-reversion
pylibmc
django_extensions
django-debug-toolbar

View file

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