emencia / emencia-django-newsletter

An app for sending newsletter by email to a contact list.
189 stars 72 forks source link

Add gender for contacts #24

Closed DNX closed 13 years ago

DNX commented 13 years ago

I propose to add gender field in Contact model. This one permits us to personalize better the text of the Newsletter.

The choises:

    GENDER_CHOICES = (
            ('u',          _('Undefined')),
            ('m',          _('Male')),
            ('f',          _('Female')),
        )

the field:

    gender = models.CharField(_('gender'), max_length=1,
            choices=GENDER_CHOICES)

For instance to greet a person we can add this piece of code in our Content:

Hello 
{% if contact.gender == "f" %}
Mrs.
{% else %}{% if contact.gender == "m" %}
Mr.
{% else %}
dear 
{% endif %}{% endif %}
 {{ contact.first_name }} {{ contact.last_name }}.

So the output can be:

  1. for female: Hello Mrs. Mary Louis.
  2. for male: Hello Mr. Barack Obama.
  3. undefined, we don't have the gender: Hello Orange Face.

I hope that you enjoy it!

Fantomas42 commented 13 years ago

Hi denis,

good suggestion, but I have already thought about this possibility and decided to don't implement it. Why ?

First of all, EDN is not a CRM, after gender information, someone could ask to add an age field in the Contact model. I don't want to maintain this kind of code, that's why I have implemented the content type into the Contact model to add a full profile.

http://pypi.python.org/pypi/emencia.django.newsletter#content-types

The second problem with gender is that Female, Male is too restrictive, in another project I had to implement a dozen of civility... and the list of civility should be extended in the future.

Nothing to do with the gender issue, but I would rather use this kind of code for display. :

{{ contact.get_gender_display }}

Regards

DNX commented 13 years ago

Ok Fantomas42, I agree with your statements. Thanks.