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_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',))
# 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 template
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 fnpdjango.utils.text import slughifi
-from django.core.mail import mail_managers
-from django import template
def get_submit_form(*args, **kwargs):
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
{% 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 }}
{% 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:"" }}