#16319 closed New feature (fixed)
add success_message in ClassViews
Reported by: | Owned by: | Paul Collins | |
---|---|---|---|
Component: | contrib.messages | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | d1fffuz0r@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
sample:
class CreatePersonView(CreateView): model = Person success_url = "/" success_message = "%(name)s was created successfully"
after object created calls messages.sucess_message
:-)
Attachments (2)
Change History (20)
comment:1 by , 14 years ago
Description: | modified (diff) |
---|
comment:2 by , 14 years ago
Component: | Generic views → contrib.messages |
---|---|
Easy pickings: | set |
Triage Stage: | Unreviewed → Accepted |
It should be quite easy to create a Mixin that does that (and put it in contrib.messages). I wouldn't incorporate that into the @CreateView@, as CBVs should be independent from contrib apps.
comment:3 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 13 years ago
Attachment: | SuccessMessageMixin.diff added |
---|
Add SuccessMessageMixin to django.contrib.messages.views
comment:4 by , 13 years ago
Has patch: | set |
---|
comment:5 by , 13 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Not sure if every corner of django needs to provide mixins. This is a good snippet, but needs docs and tests.
by , 12 years ago
Attachment: | ticket_16319.patch added |
---|
comment:7 by , 12 years ago
Easy pickings: | unset |
---|---|
Needs documentation: | unset |
Needs tests: | unset |
Patch needs improvement: | unset |
Version: | 1.3 → master |
this patch was improved, added tests and documentation (need to improve, English language non native for me.)
comment:8 by , 12 years ago
Cc: | added |
---|
comment:9 by , 12 years ago
Owner: | changed from | to
---|---|
Patch needs improvement: | set |
Grabbing this one and updating for the current master.
comment:10 by , 12 years ago
Patch needs improvement: | unset |
---|
Pull request created https://github.com/django/django/pull/922
comment:12 by , 12 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Pull request looks good. Tests run.
follow-up: 14 comment:13 by , 12 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Unfortunately, the .format()
does not work well with the gettext-based translation system. So for all translatable strings in Django, we should stick with the %(name)s
placeholder style.
http://savannah.gnu.org/bugs/?30854
comment:14 by , 12 years ago
Replying to claudep:
Unfortunately, the
.format()
does not work well with the gettext-based translation system.
Oh? Didn't know that. Okay I'll update the patch and resubmit
comment:15 by , 12 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
PR updated. (https://github.com/django/django/pull/922)
Since the change was pretty straight forward and all tests are still passing I've bounced this back to Ready, but if that's not kosher please let me know.
comment:16 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:18 by , 11 years ago
SuccessMessageMixin is useful for django.views.generic.edit.DeleteView but it should be implemented as mixin.
Just reformatted code excerpt.