Skip to content

Python Django application for user based and project wide preferences

License

Notifications You must be signed in to change notification settings

soerenbe/django-userpref

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 %}

About

Python Django application for user based and project wide preferences

Resources

License

Stars

Watchers

Forks

Packages

No packages published