fnp
/
django-migdal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add published entry manager
[django-migdal.git]
/
migdal
/
admin.py
diff --git
a/migdal/admin.py
b/migdal/admin.py
index
6bdfb59
..
0df9352
100644
(file)
--- a/
migdal/admin.py
+++ b/
migdal/admin.py
@@
-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,15
+30,22
@@
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'
date_hierarchy = 'date'
- readonly_fields = ('date', 'changed_at') + \
+ readonly_fields = ('date', 'changed_at'
, 'first_published_at'
) + \
translated_fields(('published_at',))
_promo_if_necessary = ('promo',) if typ.promotable else ()
fieldsets = (
(None, {
'fields': _promo_if_necessary + (
translated_fields(('published_at',))
_promo_if_necessary = ('promo',) if typ.promotable else ()
fieldsets = (
(None, {
'fields': _promo_if_necessary + (
- 'author', 'author_email', 'image', 'date', 'changed_at')
+ 'in_stream', 'author', 'author_email', 'image',
+ 'date', 'first_published_at', 'changed_at')
}),
) + tuple(
(ln, {'fields': (
}),
) + tuple(
(ln, {'fields': (
@@
-75,6
+82,7
@@
def filtered_entry_admin(typ):
app_settings.OBLIGATORY_LANGUAGES) + \
('date', 'author') + \
_promo_if_necessary + \
app_settings.OBLIGATORY_LANGUAGES) + \
('date', 'author') + \
_promo_if_necessary + \
+ ('in_stream', 'first_published_at',) + \
translated_fields(('published_at',)) + \
translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES)
list_filter = _promo_if_necessary + \
translated_fields(('published_at',)) + \
translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES)
list_filter = _promo_if_necessary + \