summaryrefslogtreecommitdiff
path: root/apps/projects
diff options
context:
space:
mode:
Diffstat (limited to 'apps/projects')
-rw-r--r--apps/projects/admin.py14
-rw-r--r--apps/projects/models/__init__.py3
-rw-r--r--apps/projects/models/code.py25
-rw-r--r--apps/projects/views.py2
4 files changed, 42 insertions, 2 deletions
diff --git a/apps/projects/admin.py b/apps/projects/admin.py
index c128c86..a0f1a16 100644
--- a/apps/projects/admin.py
+++ b/apps/projects/admin.py
@@ -163,6 +163,20 @@ class NationalParksAdmin(OSMGeoAdmin):
#debug = False
#widget = OpenLayersWidget
+from django.contrib import admin
+
+from projects.models.code import Code
+
+class CodeAdmin(admin.ModelAdmin):
+ list_display = ('name', 'date_created', 'status')
+ search_fields = ['name','body_html']
+ list_filter = ['status',]
+ fieldsets = (
+ (None, {'fields': ('name','date_created','slug','status','body_html')}),
+ )
+
+admin.site.register(Code, CodeAdmin)
+
admin.site.register(Project, ProjectAdmin)
admin.site.register(FiveBy, FiveByAdmin)
admin.site.register(NationalParks, NationalParksAdmin) \ No newline at end of file
diff --git a/apps/projects/models/__init__.py b/apps/projects/models/__init__.py
index fdee7fc..7fe6077 100644
--- a/apps/projects/models/__init__.py
+++ b/apps/projects/models/__init__.py
@@ -1,3 +1,4 @@
from base import Project
from fiveby import FiveBy
-from natparks import NationalParks \ No newline at end of file
+from natparks import NationalParks
+from code import Code \ No newline at end of file
diff --git a/apps/projects/models/code.py b/apps/projects/models/code.py
new file mode 100644
index 0000000..14a66f0
--- /dev/null
+++ b/apps/projects/models/code.py
@@ -0,0 +1,25 @@
+from django.db import models
+
+
+PUB_STATUS = (
+ (0, 'Draft'),
+ (1, 'Published'),
+ )
+
+
+
+class Code(models.Model):
+ name = models.CharField(max_length=254)
+ slug = models.SlugField()
+ date_created = models.DateField('Date Created')
+ status = models.IntegerField(choices=PUB_STATUS, default=0)
+ body_html = models.TextField(blank=True)
+
+ class Meta:
+ verbose_name_plural = "Code"
+ app_label = 'projects'
+ ordering = ('-date_created',)
+ # Returns the string representation of the model.
+ def __unicode__(self):
+ return self.slug
+
diff --git a/apps/projects/views.py b/apps/projects/views.py
index 65de8ae..64857a7 100644
--- a/apps/projects/views.py
+++ b/apps/projects/views.py
@@ -10,7 +10,7 @@ from projects.models.base import Project
from projects.models.fiveby import FiveBy
from projects.models.natparks import NationalParks
-projects = {'5x5':'FiveBy','6x6':'SixBy','national-parks':'NationalParks'}
+projects = {'5x5':'FiveBy','6x6':'SixBy','national-parks':'NationalParks','code':'Code'}
"""
Projects by slug