I created a model to save map,
a map is contains many room(RoomConfig).
# model
class RoomConfig(models.Model):
room_name = models.CharField(max_length = 64)
room_to_room = models.ManyToManyField('self', through =
'RoomToRoomConfig')
class RoomToRoom(models.Model):
DIRECTION_CHOICES = ((0, "up"), (1, "right"), (2, "down"), (3,
"left"))
from_room = models.ForeignKey('RoomConfig')
to_room = models.ForeignKey('RoomConfig')
from_direction = models.IntegerField(choices = DIRECTION_CHOICES)
to_direction = models.IntegerField(choices = DIRECTION_CHOICES)
why it raise Error: One or more models did not validate:
configs.roomconfig: Many-to-many fields with intermediate tables
cannot be symmetrical.
configs.roomtoroomconfig: Accessor for field 'from_room' clashes with
related field 'RoomConfig.roomtoroomconfig_set'. Add a related_name
argument to the definition for 'from_room'.
configs.roomtoroomconfig: Accessor for field 'to_room' clashes with
related field 'RoomConfig.roomtoroomconfig_set'. Add a related_name
argument to the definition for 'to_room'.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.