سؤال

I am writing an app using django 1.4.5 and neo4django (github version). I have created a model

e.g.

class FloatValues(models.NodeModel):
    a_float_value = models.StringProperty()

It looks like there is no a float property in neo4django, so I am thinking that I should either use a StringProperty or use an IntArrayProperty.

What is the best way to store a float value? (besides implementing a FloatProperty)

هل كانت مفيدة؟

المحلول

I'm going to go with- implementing a FloatProperty :) Really, it should already be in neo4django. Here's a simple implementation that doesn't support indexing.

class FloatProperty(Property):
    def get_default(self):
        return 0.0

    def to_neo(self, value):
        return float(value)

I'll raise an issue and try to get a real implementation out for the next release.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top