Fix notifications.
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 12 Nov 2012 10:49:32 +0000 (11:49 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 12 Nov 2012 10:49:32 +0000 (11:49 +0100)
migdal/admin.py
migdal/forms.py
migdal/templates/migdal/entry/entry_detail.html
migdal/templates/migdal/mail/manager_new_entry.txt

index 6bdfb59..1a7fdd7 100644 (file)
@@ -19,7 +19,7 @@ class AttachmentInline(admin.TabularInline):
 def filtered_entry_admin(typ):
     class EntryAdmin(admin.ModelAdmin):
         def queryset(self, request):
 def filtered_entry_admin(typ):
     class EntryAdmin(admin.ModelAdmin):
         def queryset(self, request):
-            return self.model.objects.filter(type=typ)
+            return self.model.objects.filter(type=typ.db)
 
         def has_add_permission(self, request):
             return request.user.has_perm('migdal.add_entry')
 
         def has_add_permission(self, request):
             return request.user.has_perm('migdal.add_entry')
@@ -30,6 +30,12 @@ def filtered_entry_admin(typ):
         def has_delete_permission(self, request, obj=None):
             return request.user.has_perm('migdal.delete_entry')
 
         def has_delete_permission(self, request, obj=None):
             return request.user.has_perm('migdal.delete_entry')
 
+        def formfield_for_dbfield(self, db_field, **kwargs):
+            field = super(EntryAdmin, self).formfield_for_dbfield(db_field, **kwargs)
+            if db_field.name == 'categories':
+                field.widget.attrs['style'] = 'height: 10em'
+            return field
+
         date_hierarchy = 'date'
         readonly_fields = ('date', 'changed_at') + \
             translated_fields(('published_at',))
         date_hierarchy = 'date'
         readonly_fields = ('date', 'changed_at') + \
             translated_fields(('published_at',))
index e7d6394..7c93ea8 100644 (file)
@@ -2,13 +2,14 @@
 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
+from django.contrib.sites.models import Site
+from django.core.mail import mail_managers
 from django import forms
 from django import forms
+from django import template
 from django.utils.translation import ugettext_lazy as _, get_language
 from django.utils.translation import ugettext_lazy as _, get_language
+from fnpdjango.utils.text.slughifi import slughifi
 from migdal.models import Entry
 from migdal import app_settings
 from migdal.models import Entry
 from migdal import app_settings
-from fnpdjango.utils.text import slughifi
-from django.core.mail import mail_managers
-from django import template
 
 
 def get_submit_form(*args, **kwargs):
 
 
 def get_submit_form(*args, **kwargs):
@@ -56,6 +57,9 @@ def get_submit_form(*args, **kwargs):
             mail_managers(u"Nowy wpis",
                 template.loader.get_template(
                     'migdal/mail/manager_new_entry.txt').render(
             mail_managers(u"Nowy wpis",
                 template.loader.get_template(
                     'migdal/mail/manager_new_entry.txt').render(
-                        template.Context({'object': entry})))
+                        template.Context({
+                            'object': entry,
+                            'site': Site.objects.get_current(),
+                        })))
 
     return SubmitForm(*args, **kwargs)
\ No newline at end of file
 
     return SubmitForm(*args, **kwargs)
\ No newline at end of file
index c19b49b..2e71d35 100644 (file)
@@ -6,7 +6,7 @@
 {% block "titleextra" %}{{ entry.title }} :: {% endblock %}
 {% block "ogtitle" %}{{ entry.title }}{% endblock %}
 {% block "ogtype" %}article{% endblock %}
 {% block "titleextra" %}{{ entry.title }} :: {% endblock %}
 {% block "ogtitle" %}{{ entry.title }}{% endblock %}
 {% block "ogtype" %}article{% endblock %}
-{% block "ogdescription"%}{{ entry.lead|striptags|truncatewords:10 }}{% endblock %}
+{% block "ogdescription"%}{{ entry.lead|striptags|truncatewords:16 }}{% endblock %}
 {% block "ogimage" %}{% spaceless %}
 {% if entry.image %}
     {{ entry.image.url|build_absolute_uri:request }}
 {% block "ogimage" %}{% spaceless %}
 {% if entry.image %}
     {{ entry.image.url|build_absolute_uri:request }}
index 59703e2..b468401 100644 (file)
@@ -1,5 +1,5 @@
 {% load url from future %}W serwisie pojawił się nowy wpis.
 {% load url from future %}W serwisie pojawił się nowy wpis.
-http://localhost:8000{% url 'admin:migdal_entry_change' object.pk %}
+http://{{ site.domain }}{% url 'admin:migdal_entry_'|add:object.type|add:'_change' object.pk %}
 
 Autor: {{ object.author|default_if_none:"" }}
 E-mail: {{ object.author_email|default_if_none:"" }}
 
 Autor: {{ object.author|default_if_none:"" }}
 E-mail: {{ object.author_email|default_if_none:"" }}