python - Define node with a unique property in neo4django -


i've defined graph structure in project contains 2 type of nodes: user , post. have installed neo4django on django framework , define models.py below:

from neo4django.db import models   class user(models.nodemodel):     #firstname of user registered in first time     firstname = models.stringproperty(max_length=20)      #lastname of user registered in first time     lastname = models.stringproperty(max_length=20)      #password of user selected user     password = models.stringproperty(max_length=50)      #email use verification     email = models.emailproperty()      #status of user can 1 online , 0 offline     status = models.booleanproperty()      #date of birth user selected register form     #birthdate = models.dateproperty()      #sex of user can male , female (0=male,1=female)     gender = models.booleanproperty() 

i want use email address , password login email must unique in database. how can in models.py?

you can pass unique=true property subclass. unique properties have indexed, so:

email = models.emailproperty(indexed=true, unique=true) 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -