Skip to content
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

get_FOO_display #250

Open
tapia opened this issue Jun 16, 2014 · 0 comments
Open

get_FOO_display #250

tapia opened this issue Jun 16, 2014 · 0 comments

Comments

@tapia
Copy link

tapia commented Jun 16, 2014

neo4django allows a choices parameter when defining a property. With the Django model properties you can use that to show the choice value (documentation), but, AFAIK, you can't do that with neo4django.

I mean something like this:

class User(models.NodeModel):
    GENDER_MALE = 1
    GENDER_FEMALE = 2
    GENDER_CHOICES = (
        (GENDER_MALE, _(u"Male")),
        (GENDER_FEMALE, _(u"Female")),
    )
    gender = models.IntegerProperty(choices=GENDER_CHOICES, default=GENDER_MALE)

This way we can build an internacionalized template using that field, while storing just an integer in our node:

<div class="gender">
    {{ user.get_gender_display }}
</div>

Is there any way (or expected way) we can achieve this with neo4django?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant