2013-09-28 10:44:29 +02:00
|
|
|
from django.db import models
|
2013-09-28 18:02:13 +02:00
|
|
|
from django.contrib.auth.models import User
|
2013-09-28 20:01:09 +02:00
|
|
|
from django.forms import ModelForm
|
2013-09-28 18:02:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Host(models.Model):
|
2013-09-28 22:17:24 +02:00
|
|
|
"""TODO: hash update_secret"""
|
2013-09-29 00:28:31 +02:00
|
|
|
fqdn = models.CharField(max_length=256,unique=True)
|
2013-09-28 18:02:13 +02:00
|
|
|
update_secret = models.CharField(max_length=256)
|
2013-09-29 00:28:31 +02:00
|
|
|
comment = models.CharField(max_length=256,default='',blank=True, null=True)
|
2013-09-28 18:02:13 +02:00
|
|
|
|
|
|
|
last_update = models.DateTimeField(auto_now=True)
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
|
|
created_by = models.ForeignKey(User)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return u"%s (%s)" % (self.fqdn, self.created_by)
|
2013-09-28 10:44:29 +02:00
|
|
|
|
2013-09-28 20:01:09 +02:00
|
|
|
|
2013-09-28 22:17:24 +02:00
|
|
|
|
2013-09-28 20:01:09 +02:00
|
|
|
class HostForm(ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Host
|
|
|
|
fields = ['fqdn', 'update_secret','comment']
|