Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

newforms-admin: Moved save_on_top from AdminOptions to ModelAdmin.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4338 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a2b25f721691d98f0ee23e4e65e9797499eddfe1 1 parent 052363f
@adrianholovaty adrianholovaty authored
View
1  django/contrib/admin/options.py
@@ -41,6 +41,7 @@ class ModelAdmin(object):
search_fields = ()
date_hierarchy = None
save_as = False
+ save_on_top = False
ordering = None
def __init__(self, model):
View
2  django/contrib/admin/templates/admin/change_form.html
@@ -26,7 +26,7 @@
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
-{% if opts.admin.save_on_top %}{% submit_row %}{% endif %}
+{% if save_on_top %}{% submit_row %}{% endif %}
{% if form.error_dict %}
<p class="errornote">
{% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
View
1  django/contrib/admin/views/main.py
@@ -192,6 +192,7 @@ def render_change_form(model, manipulator, context, add=False, change=False, for
'form_url': form_url,
'opts': opts,
'content_type_id': ContentType.objects.get_for_model(model).id,
+ 'save_on_top': opts.ModelAdmin.save_on_top,
}
context.update(extra_context)
return render_to_response([
View
2  django/db/models/base.py
@@ -137,7 +137,7 @@ def add_to_class(cls, name, value):
# of ModelAdmin.
cls._meta.ModelAdmin = type('ModelAdmin', (value, ModelAdmin), {})
# This AdminOptions stuff is legacy and will eventually be removed.
- value = AdminOptions(**dict([(k, v) for k, v in value.__dict__.items() if not k.startswith('_') and k not in ('list_display', 'list_display_links', 'list_filter', 'date_hierarchy', 'save_as', 'search_fields', 'list_select_related', 'list_per_page', 'ordering')]))
+ value = AdminOptions(**dict([(k, v) for k, v in value.__dict__.items() if not k.startswith('_') and k not in ('list_display', 'list_display_links', 'list_filter', 'date_hierarchy', 'save_as', 'search_fields', 'list_select_related', 'list_per_page', 'ordering', 'save_on_top')]))
value.contribute_to_class(cls, name)
elif hasattr(value, 'contribute_to_class'):
value.contribute_to_class(cls, name)
View
3  django/db/models/options.py
@@ -200,10 +200,9 @@ def has_field_type(self, field_type, follow=None):
class AdminOptions(object):
def __init__(self, fields=None, js=None,
- save_on_top=False, manager=None):
+ manager=None):
self.fields = fields
self.js = js or []
- self.save_on_top = save_on_top
self.manager = manager or Manager()
def get_field_sets(self, opts):

0 comments on commit a2b25f7

Please sign in to comment.
Something went wrong with that request. Please try again.