from django.db import models

class Poll(models.Model):
	question = models.CharField(max_length=200)
	pub_date = models.DateTimeField('date_published')
	
	class Admin:
		pass
	
	def __unicode__(self):
		return "<Poll '%s'>" % self.question

class Tag(models.Model):
	name = models.CharField(max_length=200)

class Choice(models.Model):
	poll = models.ForeignKey(Poll)
	tags = models.ManyToManyField(Tag)
	choice = models.CharField(max_length=200)
	votes = models.IntegerField()

	class Admin:
		pass
	
	def __unicode__(self):
		return "<Choice '%s'>" % self.choice

class SelfRef(models.Model):
	parent = models.ForeignKey('self',null=True)
	name = models.CharField(max_length=50)

class MultiSelfRef(models.Model):
	name = models.CharField(max_length=50)
	ref = models.ManyToManyField('self')

from django.db import models

class Poll(models.Model):
	question = models.CharField(max_length=200)
	pub_date = models.DateTimeField('date_published')
	
	class Admin:
		pass
	
	def __unicode__(self):
		return "<Poll '%s'>" % self.question

class Tag(models.Model):
	name = models.CharField(max_length=200)

class Choice(models.Model):
	poll = models.ForeignKey(Poll)
	tags = models.ManyToManyField(Tag)
	choice = models.CharField(max_length=200)
	votes = models.IntegerField()

	class Admin:
		pass
	
	def __unicode__(self):
		return "<Choice '%s'>" % self.choice

class SelfRef(models.Model):
	parent = models.ForeignKey('self',null=True)
	name = models.CharField(max_length=50)

class MultiSelfRef(models.Model):
	name = models.CharField(max_length=50)
	ref = models.ManyToManyField('self')

class PositionedTag(Tag):
	position = models.IntegerField()


Add a test for django model inheritance of the foreign key kind.
Add a test for django model inheritance of the foreign key kind.

  from django.db import models
  
  class Poll(models.Model):
  	question = models.CharField(max_length=200)
  	pub_date = models.DateTimeField('date_published')
  	
  	class Admin:
  		pass
  	
  	def __unicode__(self):
  		return "<Poll '%s'>" % self.question
  
  class Tag(models.Model):
  	name = models.CharField(max_length=200)
  
  class Choice(models.Model):
  	poll = models.ForeignKey(Poll)
  	tags = models.ManyToManyField(Tag)
  	choice = models.CharField(max_length=200)
  	votes = models.IntegerField()
  
  	class Admin:
  		pass
  	
  	def __unicode__(self):
  		return "<Choice '%s'>" % self.choice
  
  class SelfRef(models.Model):
  	parent = models.ForeignKey('self',null=True)
  	name = models.CharField(max_length=50)
  
  class MultiSelfRef(models.Model):
  	name = models.CharField(max_length=50)
  	ref = models.ManyToManyField('self')
  
+ class PositionedTag(Tag):
+ 	position = models.IntegerField()
+ 
+ 
Add a test for django model inheritance of the foreign key kind.
## Code Before:
from django.db import models

class Poll(models.Model):
	question = models.CharField(max_length=200)
	pub_date = models.DateTimeField('date_published')
	
	class Admin:
		pass
	
	def __unicode__(self):
		return "<Poll '%s'>" % self.question

class Tag(models.Model):
	name = models.CharField(max_length=200)

class Choice(models.Model):
	poll = models.ForeignKey(Poll)
	tags = models.ManyToManyField(Tag)
	choice = models.CharField(max_length=200)
	votes = models.IntegerField()

	class Admin:
		pass
	
	def __unicode__(self):
		return "<Choice '%s'>" % self.choice

class SelfRef(models.Model):
	parent = models.ForeignKey('self',null=True)
	name = models.CharField(max_length=50)

class MultiSelfRef(models.Model):
	name = models.CharField(max_length=50)
	ref = models.ManyToManyField('self')

## Instruction:
Add a test for django model inheritance of the foreign key kind.
## Code After:
from django.db import models

class Poll(models.Model):
	question = models.CharField(max_length=200)
	pub_date = models.DateTimeField('date_published')
	
	class Admin:
		pass
	
	def __unicode__(self):
		return "<Poll '%s'>" % self.question

class Tag(models.Model):
	name = models.CharField(max_length=200)

class Choice(models.Model):
	poll = models.ForeignKey(Poll)
	tags = models.ManyToManyField(Tag)
	choice = models.CharField(max_length=200)
	votes = models.IntegerField()

	class Admin:
		pass
	
	def __unicode__(self):
		return "<Choice '%s'>" % self.choice

class SelfRef(models.Model):
	parent = models.ForeignKey('self',null=True)
	name = models.CharField(max_length=50)

class MultiSelfRef(models.Model):
	name = models.CharField(max_length=50)
	ref = models.ManyToManyField('self')

class PositionedTag(Tag):
	position = models.IntegerField()

