Skip to content

Commit 47e18c7

Browse files
committed
Ready for first alpha
1 parent 2fdbea0 commit 47e18c7

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

DESCRIPTION.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,30 @@ This includes:
88
* Abstract UserPref Class
99
* Admin interface
1010
* Templates for an userspecific settings page
11+
12+
13+
Basic usage
14+
===========
15+
16+
Just define a abstract model that can be used in the applications.
17+
In you app you should define something like:
18+
19+
.. code:: python
20+
21+
from userpref.models import Userpref
22+
23+
class MyappSettings(Userpref):
24+
special_setting = models.BooleanField(default=False, verbose_name='Make me a superhero')
25+
another_field = models.CharField(max_length=100, default="<unset>")
26+
27+
class Meta:
28+
verbose_name = "My Custom Setting for app Myapp"
29+
30+
31+
In your application or template you can access the settings over the users attributes
32+
33+
.. code:: html
34+
35+
{% if request.user.myappsettings.special_settings %}
36+
You are special man!
37+
{% endif %}

README.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,22 @@ Basic usage
1616
Just define a abstract model that can be used in the applications.
1717
In you app you should define something like:
1818

19+
.. code:: python
20+
1921
from userpref.models import Userpref
2022
2123
class MyappSettings(Userpref):
2224
special_setting = models.BooleanField(default=False, verbose_name='Make me a superhero')
2325
another_field = models.CharField(max_length=100, default="<unset>")
2426
2527
class Meta:
26-
verbose_name = "My Custom Setting for app Myapp"
28+
verbose_name = "My Custom Setting for app Myapp"
29+
30+
31+
In your application or template you can access the settings over the users attributes
32+
33+
.. code:: html
34+
35+
{% if request.user.myappsettings.special_settings %}
36+
You are special man!
37+
{% endif %}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Versions should comply with PEP440. For a discussion on single-sourcing
1414
# the version across setup.py and the project code, see
1515
# https://packaging.python.org/en/latest/single_source_version.html
16-
version='0.1.0a3',
16+
version='0.1.0a5',
1717

1818
description='Django user preferences',
1919
long_description=long_description,

0 commit comments

Comments
 (0)