Opened 7 years ago

Closed 7 years ago

#27643 closed Bug (invalid)

ModelAdmin.save_as is ignored

Reported by: Flavio Curella Owned by: nobody
Component: contrib.admin Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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'

Attachments (1)

Screen Shot 2016-12-26 at 12.17.15 PM.png (88.8 KB ) - added by Flavio Curella 7 years ago.

Download all attachments as: .zip

Change History (2)

by Flavio Curella, 7 years ago

comment:1 by Flavio Curella, 7 years ago

Resolution: invalid
Status: newclosed

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,

Note: See TracTickets for help on using tickets.
Back to Top