-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add identifier to EmailTemplate #324
base: master
Are you sure you want to change the base?
Conversation
Add unique `identifier` field to model `EmailTemplate`. It can be used to access templates from Python code and leaves the `name` field as a human readable representation of that template. This additionally simplifies the unqiue constraints on that model.
Hi @jrief I think, however, that this could be the best approach. |
@madEng84 OK, valid point. However, since after the change we will have a human readable label ( |
@jrief i think there will be both, because the identifier is useful for devs (it will be obviously in the backend code) and the name is useful for staff users. The human readable one should be a normal input text. |
One proposal for a smooth transition would be to rename However, since this is a breaking API change, consensus from @selwin is required. |
I'm still struggling to see why we need another field for this. We currently already have three fields:
|
First, I wasn't convinced about this pull-request from @madEng84 either – see my comments here. The problem occurs, if you need a reference from your Python code, to one of the |
Ok, the "non portable across instantiations" part is fair enough. I think we can proceed with adding Please don't change the translated name bit, since it should always follow the parent template. So for example if you have a template named EmailTemplate.objects.get(name='welcome_email', language=my_lang) If you want to have a single identifier that can uniquely identify a template, we'll have the |
but then the So I don't understand what part of this pull request shall be changed. |
Sorry for the delay in replying. To reiterate my previous comment, we currently have three fields.
I'll try to go through your concerns and see how we can address them.
The upside of having a unique index for
Natural keys partly address this requirement. I can sympathize with wanting to have a single identifier field for convenience, for this I propose a unique field like
|
That's just what I did. I added an This |
Add unique
identifier
field to modelEmailTemplate
.It can be used to access templates from Python code and leaves the
name
field as a human readable representation of that template.This additionally simplifies the unique constraints on that model.
The idea is the same as for #320, however instead of adding
label
as a human readable field, it adds anidentifier
as an explicitly machine readable field.In addition to this, the
name
anddescription
field are now editable in all languages.