Skip to content

Instantly share code, notes, and snippets.

@Brachamul
Created September 3, 2014 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brachamul/3347397c1736d78482c1 to your computer and use it in GitHub Desktop.
Save Brachamul/3347397c1736d78482c1 to your computer and use it in GitHub Desktop.
class Feature(models.Model):
# A feature is what occupies a slot, it can be a man-made constuct or natural terrain.
name = models.CharField(max_length=255)
class MapLayout(models.Model):
name = models.CharField(max_length=255)
image = models.ImageField(upload_to=/maps/)
class Slot(models.Model):
map_layout = models.ForeignKey(MapLayout)
number = models.PositiveSmallIntegerField() # The ID of this Slot within a map.
longitude = models.PositiveSmallIntegerField()
latitude = models.PositiveSmallIntegerField()
starting_feature = models.ForeignKey(Feature) # The feature feature exists on the Slot when a game begins.
class Town(models.Model):
name = models.CharField(max_length=255)
map_layout = models.ForeignKey(MapLayout)
class TownSlot(models.Model):
town = models.ForeignKey(Town)
slot = models.ForeignKey(Slot) # Defines the coordinates and starting feature of this Slot
feature = models.ForeignKey(Feature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment