1from __future__ import unicode_literals
2
3from django.db import models
4from django.core.urlresolvers import reverse
5
6class Server(models.Model):
7 name = models.CharField(max_length=200)
8ip = models.GenericIPAddressField()
9order = models.IntegerField()
10image = models.FileField(upload_to='pics/',default='download.jpg')
11
12def __unicode__(self):
13 return self.name
14
15def get_absolute_url(self):
16 return reverse('server_edit', kwargs={'pk': self.pk})