Skip to content

Commit

Permalink
Merge pull request #14 from ChanTsune/Dev
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
ChanTsune authored Sep 10, 2019
2 parents 2a730e9 + b0ecf6e commit b53f959
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 4 deletions.
14 changes: 14 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,19 @@

## Versions

### 1.1

#### Add

- UrlSet class
- Http30X class
- register_all function
- adminsitelog Command

#### Change

- UUIDModelMixin class `editable=False`

### 1.0

First release
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ In the template you can use as follows.
{% url 'myapp:customer:delete' %}
```

### Routing Utility
### Routing Utilitys

#### UrlSet

Expand Down Expand Up @@ -589,6 +589,29 @@ urlpatterns = [

URLs are grouped for easy reading.

### Admin Site Utilitys

Easily register Models to Django admin site.

```py
from yourapp import models
from django_boost.admin.site import register_all

register_all(models)
```

Register all models defined in `models.py` in Django admin site.

Custom admin classes are also available.

```py
from your_app import models
from your_app import admin
from django_boost.admin.site import register_all

register_all(models, admin_class=admin.CustomAdmin)
```

### Template Tags

Make Python built-in functions available in DjangoTemplate.
Expand Down
2 changes: 1 addition & 1 deletion django_boost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.version import get_version

VERSION = (1, 0, 0, 'final', 0)
VERSION = (1, 1, 0, 'final', 0)

__version__ = get_version(VERSION)
12 changes: 12 additions & 0 deletions django_boost/admin/sites.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.contrib import admin
from django.db.models import Model

__all__ = ["register_all"]


def register_all(models, admin_class=admin.ModelAdmin):
for attr in dir(models):
attr = getattr(models, attr, None)
if isinstance(attr, type):
if issubclass(attr, Model) and not attr._meta.abstract:
admin.site.register(attr, admin_class)
3 changes: 2 additions & 1 deletion django_boost/models/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class UUIDModelMixin(models.Model):

class Meta:
abstract = True
id = models.UUIDField(default=uuid.uuid4, primary_key=True, unique=True)
id = models.UUIDField(default=uuid.uuid4,
primary_key=True, unique=True, editable=False)


class TimeStampModelMixin(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def read(fname):

setup(
name='django_boost',
version='1.0',
version='1.1',
description='Django Extension library',
long_description=read('README.md'),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b53f959

Please sign in to comment.