from django.db import models

# Create your models here.
class Event(models.Model):
	description = models.CharField(max_length=256)
	start_date = models.DateTimeField()
	end_date = models.DateTimeField()

	def __str__ (self):
		return "desc="+self.description+" start="+str(self.start_date)+" end="+str(self.end_date)+"\n"

class Participant(models.Model):
	lastname = models.CharField(max_length=256)
	firstname = models.CharField(max_length=256)
	email = models.EmailField()
	event = models.ForeignKey(Event)

	def participant_count(self):
		return self.participant_set.count()

	def participant_mail_list(self):
		return ','.join([p.email for p in self.participant_set.all()])