kiddouk / redisco

A Python Library for Simple Models and Containers Persisted in Redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating an object with a unique field raises a validation exception.

aanastasiou opened this issue · comments

With Redisco 0.1.4

class Foo(models.Model):
Field1 = models.Attribute(indexed = True)
Field2 = models.Attribute(unique = True)

Foo(Field1="1", Field2 = "blah").save(); Foo(Field1="Alpha", Field2 = "Beta").save()

Q = Foo.objects.all()[0]
Q.update_attributes(Field1 = "Whatever")
Q.save()

This returns a failed validation message that Field2 is not unique.

If i am not missing something here, this is a simple update, not even touching the field that is declared as unique and after that operation the "unique" condition would still hold.

BTW, in the above example, if the field is not declared as unique then everything works as expected...but then i really want the field to be declared as unique :)