from django.db import models
from django.contrib.auth.models import User
from student import Student
from eventtype import EventType
from django import forms
import datetime
class Event(models.Model):
user = models.ForeignKey(User)
student = models.ForeignKey(Student)
place = models.CharField(max_length=200, null=True)
type = models.ForeignKey(EventType)
start = models.DateTimeField('event start', default=datetime.datetime.now)
end = models.DateTimeField('event end', default=datetime.datetime.now)
absence = models.NullBooleanField()
note = models.TextField(null=True)
created = models.DateTimeField('created time')
created_by = models.ForeignKey(User, related_name='event creator')
description = models.TextField(null=True)
class Meta:
app_label = 'jvc'
def __unicode__(self):
return
self.type.name +' '+ self.student.fullname +' '+self.start.strftime('%d.%m.%Y')
I should mention that I have my models in separated files in "models" folder inside app called "jvc"
Dne úterý, 26. listopadu 2013 8:25:40 UTC+1 Leo napsal(a):