Skip to content

Instantly share code, notes, and snippets.

@rdegges
Created March 12, 2010 06:25
Show Gist options
  • Save rdegges/330084 to your computer and use it in GitHub Desktop.
Save rdegges/330084 to your computer and use it in GitHub Desktop.
from django.db import models
from django.forms import ModelForm
class Server(models.Model):
"""
This class represents a physical server.
"""
hostname = models.CharField('Server Name',
help_text = 'Hostname of the server.',
max_length = 50
)
ip = models.IPAddressField('Server IP Address',
help_text = 'Public IP of the server.',
unique = True
)
disk_space = models.IntegerField('Disk Space on Server',
help_text = 'Total disk space in MB.'
)
ram = models.IntegerField('RAM on Server',
help_text = 'Total RAM in MB.'
)
cpu = models.IntegerField('Processing Power',
help_text = 'Total Processing Power in MHz.'
)
def __unicode__(self):
"""
Make the model human readable.
"""
return self.hostname
class ServerForm(ModelForm):
"""
Auto generated form to create Server models.
"""
class Meta:
model = Server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment