[Django] #27643: ModelAdmin.save_as is ignored

5 views
Skip to first unread message

Django

unread,
Dec 26, 2016, 1:17:48 PM12/26/16
to django-...@googlegroups.com
#27643: ModelAdmin.save_as is ignored
------------------------------------------+------------------------
Reporter: Flavio Curella | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
I have the following model:

{{{
from django.db import models


# Create your models here.
class MyModel(models.Model):
name = models.CharField(max_length=50)
}}}

and a basic admin class for the model:

{{{
from django.contrib import admin

from .models import MyModel


# Register your models here.
class MyModelAdmin(admin.ModelAdmin):
save_as = True


admin.site.register(MyModel, MyModelAdmin)

}}}

According to the documentation
(https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_as)
I should see three buttons: 'Save', 'Save and continue editing' and 'Save
as new', but I still get 'Save', 'Save and continue editing' and 'Save and
add another'

--
Ticket URL: <https://code.djangoproject.com/ticket/27643>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 26, 2016, 1:18:18 PM12/26/16
to django-...@googlegroups.com
#27643: ModelAdmin.save_as is ignored
--------------------------------+--------------------------------------

Reporter: Flavio Curella | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Flavio Curella):

* Attachment "Screen Shot 2016-12-26 at 12.17.15 PM.png" added.

Django

unread,
Dec 26, 2016, 3:16:51 PM12/26/16
to django-...@googlegroups.com
#27643: ModelAdmin.save_as is ignored
--------------------------------+--------------------------------------
Reporter: Flavio Curella | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.10
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Flavio Curella):

* status: new => closed
* resolution: => invalid


Comment:

after looking through the code, it's clear that the `save_as` option only
applies when _editing_ an existing object.

Although not explictly stated, it is somewhate implied in the docs
(emphasis added):

> Normally, **objects** have three save options: “Save”, “Save and
continue editing”, and “Save and add another”. If save_as is True, “Save
and add another” will be replaced by a “Save as new” button that creates a
new object (with a new ID) rather than updating the **existing object**.

Closing as invalid,

--
Ticket URL: <https://code.djangoproject.com/ticket/27643#comment:1>

Reply all
Reply to author
Forward
0 new messages