{{{
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.
* Attachment "Screen Shot 2016-12-26 at 12.17.15 PM.png" added.
* 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>