Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 922 Bytes

README.rst

File metadata and controls

37 lines (23 loc) · 922 Bytes

Django-Userpref

django-userpref provides a abstract and reuseable framework for userspecific settings

This includes:

  • Abstract UserPref Class
  • Admin interface
  • Templates for an userspecific settings page

Basic usage

Just define a abstract model that can be used in the applications. In you app you should define something like:

from userpref.models import Userpref

class MyappSettings(Userpref):
    special_setting = models.BooleanField(default=False, verbose_name='Make me a superhero')
    another_field = models.CharField(max_length=100, default="<unset>")

    class Meta:
        verbose_name = "My Custom Setting for app Myapp"

In your application or template you can access the settings over the users attributes

{% if request.user.myappsettings.special_settings %}
    You are special man!
{% endif %}