Skip to content

Commit

Permalink
- removed models.py
Browse files Browse the repository at this point in the history
- updated example project
- fixed problem with commit and admin integration
  • Loading branch information
kunitoki committed Jun 25, 2015
1 parent 97c3339 commit ffa4064
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -6,7 +6,10 @@ Only important changes are mentioned below.
v0.11 (unreleased)
-----------------

* Fixed admin integration
* Updated example project
* Removed validate_unique for fields so your subclass can decide what to do with fields with the same name
* Removed models.py (useless with Django>=1.7)
* Dropped support for Django < 1.7 (insecure)
* Dropped support for Python 3.2 and 3.3

Expand Down
5 changes: 5 additions & 0 deletions custard/builder.py
Expand Up @@ -559,4 +559,9 @@ class CustomFieldModelBaseAdmin(base_admin):
def __init__(self, *args, **kwargs):
super(CustomFieldModelBaseAdmin, self).__init__(*args, **kwargs)

def save_model(self, request, obj, form, change):
obj.save()
if hasattr(form, 'save_custom_fields'):
form.save_custom_fields()

return CustomFieldModelBaseAdmin
3 changes: 0 additions & 3 deletions custard/models.py

This file was deleted.

3 changes: 3 additions & 0 deletions example/example/demo/admin.py
Expand Up @@ -11,6 +11,7 @@
class ExampleForm(builder.create_modelform()):
class Meta:
model = Example
fields = '__all__'


class ExampleAdmin(builder.create_modeladmin()):
Expand All @@ -33,6 +34,7 @@ class MyUserChangeForm(builder.create_modelform(base_form=UserChangeForm)):

class Meta:
model = User
fields = '__all__'

class MyUserCreationForm(builder.create_modelform(base_form=UserCreationForm)):
custom_name = 'Custom fields'
Expand All @@ -41,6 +43,7 @@ class MyUserCreationForm(builder.create_modelform(base_form=UserCreationForm)):

class Meta:
model = User
fields = '__all__'

class MyUserAdmin(builder.create_modeladmin(base_admin=UserAdmin)):
form = MyUserChangeForm
Expand Down
4 changes: 2 additions & 2 deletions example/example/settings.py
Expand Up @@ -105,6 +105,6 @@
# Custard configuration

CUSTOM_CONTENT_TYPES = (
'example',
'user',
'demo.example',
'auth.user',
)

0 comments on commit ffa4064

Please sign in to comment.