diff --git a/stagestatus/apps/machines/migrations/0002_auto_20170401_1258.py b/stagestatus/apps/machines/migrations/0002_auto_20170401_1258.py new file mode 100644 index 0000000..f4feb51 --- /dev/null +++ b/stagestatus/apps/machines/migrations/0002_auto_20170401_1258.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-04-01 17:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('machines', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='machinenote', + name='notes', + field=models.TextField(help_text='Reason you are checking out the server.'), + ), + ] diff --git a/stagestatus/apps/machines/models.py b/stagestatus/apps/machines/models.py index e7510d8..e14b659 100644 --- a/stagestatus/apps/machines/models.py +++ b/stagestatus/apps/machines/models.py @@ -52,8 +52,7 @@ class MachineNote(models.Model): """ machine = models.OneToOneField('Machine') - notes = models.CharField( - max_length=256, + notes = models.TextField( help_text='Reason you are checking out the server.') user = models.ForeignKey( User, diff --git a/stagestatus/apps/machines/urls.py b/stagestatus/apps/machines/urls.py index 8a7145d..1d40c87 100644 --- a/stagestatus/apps/machines/urls.py +++ b/stagestatus/apps/machines/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import url -from django.views.generic import TemplateView +from machines.views import MachineList urlpatterns = [ - url(r'^', TemplateView.as_view(template_name='machines/index.html')), + url(r'^$', MachineList.as_view()), ] diff --git a/stagestatus/apps/machines/views.py b/stagestatus/apps/machines/views.py index 2536b37..4bde3c1 100644 --- a/stagestatus/apps/machines/views.py +++ b/stagestatus/apps/machines/views.py @@ -1 +1,7 @@ -from django.shortcuts import render +from django.views.generic import ListView +from machines.models import Machine + + +class MachineList(ListView): + context_object_name = 'machines' + queryset = Machine.objects.all() diff --git a/stagestatus/settings/base.py b/stagestatus/settings/base.py index 74ac2e6..97c583e 100644 --- a/stagestatus/settings/base.py +++ b/stagestatus/settings/base.py @@ -18,7 +18,6 @@ DEBUG = True ALLOWED_HOSTS = [] # Application definition - INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -26,15 +25,15 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - # Third Party apps - 'rest_framework', ] - PROJECT_APPS = [ 'machines', ] - +THIRD_PARTY_APPS = [ + 'rest_framework', +] INSTALLED_APPS += PROJECT_APPS +INSTALLED_APPS += THIRD_PARTY_APPS MIDDLEWARE_CLASSES = [ 'django.middleware.security.SecurityMiddleware', diff --git a/stagestatus/templates/machines/index.html b/stagestatus/templates/index.html similarity index 100% rename from stagestatus/templates/machines/index.html rename to stagestatus/templates/index.html diff --git a/stagestatus/templates/machines/machine_list.html b/stagestatus/templates/machines/machine_list.html new file mode 100644 index 0000000..ac97edd --- /dev/null +++ b/stagestatus/templates/machines/machine_list.html @@ -0,0 +1,28 @@ + + +
+