Merge pull request #17 from jerzyk/master

django 1.4 plus small extension to allow empty fields and optional non-superuser access to the settings
This commit is contained in:
Jannis Leidel 2013-02-21 09:44:47 -08:00
commit 00985ed40f
6 changed files with 75 additions and 10 deletions

View file

@ -6,7 +6,7 @@ from django import forms
from django.contrib import admin, messages
from django.contrib.admin import widgets
from django.contrib.admin.options import csrf_protect_m
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
from django.forms import fields
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
@ -116,11 +116,11 @@ class ConstanceAdmin(admin.ModelAdmin):
def has_delete_permission(self, *args, **kwargs):
return False
def has_change_permission(self, request, obj=None, *args, **kwargs):
if request.user.is_superuser:
return True
def has_change_permission(self, request, obj=None):
if settings.SUPERUSER_ONLY:
return request.user.is_superuser
else:
return False
return super(ConstanceAdmin, self).has_change_permission(request, obj)
class Config(object):

View file

@ -1,6 +1,5 @@
from django.core.exceptions import ImproperlyConfigured
from django.db.models.signals import post_save
from django.utils.functional import memoize
from django.core.cache import get_cache
from django.core.cache.backends.locmem import CacheClass as LocMemCacheClass

Binary file not shown.

View file

@ -0,0 +1,60 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 0.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-09-03 02:32+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Janusz Harkot <janusz.harkot@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2)\n"
#: admin.py:79
msgid "Live settings updated successfully."
msgstr "Parametry zostały zaktualizowane"
#: admin.py:83
msgid "Constance config"
msgstr "Konfiguracja Constance"
#: backends/database/models.py:18
msgid "constance"
msgstr "parametr"
#: backends/database/models.py:19
msgid "constances"
msgstr "parametry"
#: templates/admin/constance/change_list.html:39
msgid "Name"
msgstr "Nazwa"
#: templates/admin/constance/change_list.html:40
msgid "Default"
msgstr "Domyślnie"
#: templates/admin/constance/change_list.html:41
msgid "Value"
msgstr "Wartość"
#: templates/admin/constance/change_list.html:42
msgid "Is modified"
msgstr "Zmodyfikowana"
#: templates/admin/constance/change_list.html:68
msgid "Save"
msgstr "Zapisz"
#: templates/admin/constance/change_list.html:78
msgid "Home"
msgstr "Początek"

View file

@ -20,3 +20,5 @@ REDIS_CONNECTION = getattr(settings, 'CONSTANCE_REDIS_CONNECTION',
DATABASE_CACHE_BACKEND = getattr(settings, 'CONSTANCE_DATABASE_CACHE_BACKEND',
None)
SUPERUSER_ONLY = getattr(settings, 'CONSTANCE_ACCESS_SUPERUSER_ONLY', True)

View file

@ -1,11 +1,11 @@
{% extends "admin/base_site.html" %}
{% load adminmedia admin_list i18n %}
{% load admin_static admin_list i18n %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/changelists.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/forms.css' %}" />
{{ media.css }}
<style>
#result_list .changed {
@ -55,7 +55,11 @@
{{item.form_field}}
</td>
<td>
<img src="{% admin_media_prefix %}img/icon-{% if item.modified %}yes{% else %}no{% endif %}.gif" alt="{{ item.modified }}" />
{% if item.modified %}
<img src="{% static 'admin/img/icon-yes.gif' %}" alt="{{ item.modified }}" />
{% else %}
<img src="{% static 'admin/img/icon-no.gif' %}" alt="{{ item.modified }}" />
{% endif %}
</td>
</tr>
{% endfor %}