From 26de99e7730504bd0b5f9c2aa59db130aa7011fe Mon Sep 17 00:00:00 2001 From: Tomislav R Date: Fri, 25 Mar 2016 19:18:07 +0100 Subject: [PATCH] fixed orphaned plugins and add post functionality --- digitalglarus/admin.py | 20 +++--- digitalglarus/cms_plugins.py | 64 ++++++++--------- .../migrations/0002_auto_20160324_2321.py | 16 +++++ .../migrations/0003_auto_20160325_1659.py | 55 ++++++++++++++ digitalglarus/models.py | 72 +++++++++---------- .../glarus_blog/includes/blog_item.html | 1 - digitalglarus/urls.py | 6 +- digitalglarus/views.py | 2 +- dynamicweb/settings/base.py | 11 ++- .../migrations/0002_auto_20160324_2336.py | 21 ++++++ requirements.txt | 2 + templates/djangocms_blog/post_detail.html | 2 +- 12 files changed, 186 insertions(+), 86 deletions(-) create mode 100644 digitalglarus/migrations/0002_auto_20160324_2321.py create mode 100644 digitalglarus/migrations/0003_auto_20160325_1659.py create mode 100644 membership/migrations/0002_auto_20160324_2336.py diff --git a/digitalglarus/admin.py b/digitalglarus/admin.py index 62a2dc89..14f5af7a 100644 --- a/digitalglarus/admin.py +++ b/digitalglarus/admin.py @@ -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) diff --git a/digitalglarus/cms_plugins.py b/digitalglarus/cms_plugins.py index afa27433..10989df9 100644 --- a/digitalglarus/cms_plugins.py +++ b/digitalglarus/cms_plugins.py @@ -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) diff --git a/digitalglarus/migrations/0002_auto_20160324_2321.py b/digitalglarus/migrations/0002_auto_20160324_2321.py new file mode 100644 index 00000000..85647316 --- /dev/null +++ b/digitalglarus/migrations/0002_auto_20160324_2321.py @@ -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 = [ + ] diff --git a/digitalglarus/migrations/0003_auto_20160325_1659.py b/digitalglarus/migrations/0003_auto_20160325_1659.py new file mode 100644 index 00000000..82e4471b --- /dev/null +++ b/digitalglarus/migrations/0003_auto_20160325_1659.py @@ -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', + ), + ] diff --git a/digitalglarus/models.py b/digitalglarus/models.py index 0f6742c3..0cc7e9fa 100644 --- a/digitalglarus/models.py +++ b/digitalglarus/models.py @@ -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 diff --git a/digitalglarus/templates/glarus_blog/includes/blog_item.html b/digitalglarus/templates/glarus_blog/includes/blog_item.html index 2a6dd122..4a776bee 100644 --- a/digitalglarus/templates/glarus_blog/includes/blog_item.html +++ b/digitalglarus/templates/glarus_blog/includes/blog_item.html @@ -1,5 +1,4 @@ {% load i18n thumbnail %} -
{% if post.main_image %}
diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index 9a2b3f5f..e8e97351 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -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\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\w[-\w]*)/$', views.blog_detail, name='blog-detail'), ] diff --git a/digitalglarus/views.py b/digitalglarus/views.py index ca08f865..617c1522 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -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' diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 031dff16..2e69a003 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -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', diff --git a/membership/migrations/0002_auto_20160324_2336.py b/membership/migrations/0002_auto_20160324_2336.py new file mode 100644 index 00000000..a8086a9b --- /dev/null +++ b/membership/migrations/0002_auto_20160324_2336.py @@ -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'), + ), + ] diff --git a/requirements.txt b/requirements.txt index 8c65e8ab..8559857a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -45,3 +45,5 @@ django-filer cmsplugin-filer django-reversion pylibmc +django_extensions +django-debug-toolbar diff --git a/templates/djangocms_blog/post_detail.html b/templates/djangocms_blog/post_detail.html index caadd70d..82a5be02 100644 --- a/templates/djangocms_blog/post_detail.html +++ b/templates/djangocms_blog/post_detail.html @@ -32,6 +32,6 @@ {# {% endblock %}#} {% endspaceless %} -
{{ post.abstract| safe }}
+
{% render_placeholder post.content %}
{% endblock content_blog %} \ No newline at end of file