From 08e36dacb1433e7707275569532d96dd405bf2e4 Mon Sep 17 00:00:00 2001 From: Shane Frischkorn Date: Sat, 27 Jul 2013 22:23:05 +1000 Subject: [PATCH] changing namespace and urls --- .spyderproject | Bin 112 -> 91 bytes ...2_auto__add_field_sample_model_filename.py | 40 ------------------ ...3_auto__chg_field_sample_model_filename.py | 38 ----------------- project_directory/common/views.py | 1 - project_directory/db.sqlite3 | Bin 45056 -> 147456 bytes project_directory/rockviewer/settings.py | 2 +- project_directory/rockviewer/urls.py | 1 + .../{common => three_d_viewer}/__init__.py | 0 .../{common => three_d_viewer}/admin.py | 2 +- .../migrations/0001_initial.py | 28 ++++++------ .../migrations/__init__.py | 0 .../{common => three_d_viewer}/models.py | 0 .../three_d_viewer/templates}/children.html | 0 .../three_d_viewer/templates}/main.html | 0 .../templates/three_d_viewer/detail.html | 1 + .../templates/three_d_viewer/index.html | 9 ++++ .../{common => three_d_viewer}/tests.py | 0 project_directory/three_d_viewer/urls.py | 9 ++++ project_directory/three_d_viewer/views.py | 31 ++++++++++++++ 19 files changed, 68 insertions(+), 94 deletions(-) delete mode 100644 project_directory/common/migrations/0002_auto__add_field_sample_model_filename.py delete mode 100644 project_directory/common/migrations/0003_auto__chg_field_sample_model_filename.py delete mode 100644 project_directory/common/views.py rename project_directory/{common => three_d_viewer}/__init__.py (100%) rename project_directory/{common => three_d_viewer}/admin.py (64%) rename project_directory/{common => three_d_viewer}/migrations/0001_initial.py (61%) rename project_directory/{common => three_d_viewer}/migrations/__init__.py (100%) rename project_directory/{common => three_d_viewer}/models.py (100%) rename {templates => project_directory/three_d_viewer/templates}/children.html (100%) rename {templates => project_directory/three_d_viewer/templates}/main.html (100%) create mode 100644 project_directory/three_d_viewer/templates/three_d_viewer/detail.html create mode 100644 project_directory/three_d_viewer/templates/three_d_viewer/index.html rename project_directory/{common => three_d_viewer}/tests.py (100%) create mode 100644 project_directory/three_d_viewer/urls.py create mode 100644 project_directory/three_d_viewer/views.py diff --git a/.spyderproject b/.spyderproject index 8d700c2c0f83470d123c0cba8deece8b2d040ff7..ee9cfc2c2cb79ebc1472f716a874d06a70b75a89 100644 GIT binary patch literal 91 zcmZo*sx4&H2o)$w%}FdtO^Gik%FjwoE-5Z#iY;Ug6$T4umZioQRF-7q=M^NDWE8T* rhO*=(=B5_1MsP7OFcjq{XP0HBmZugKvW2qc7o_H;rWCSwl6a~=v+enR~e{G?0&@?13Xdiv36zx8Rrsw36E1ENhQv}GBo!zkopApxT vpWKlDQ{Pzm4ayo8LB(&=cj=9|5TU2V+3mPB9ysD5m1P*nm?KSPMZWj|HXbAN diff --git a/project_directory/common/migrations/0002_auto__add_field_sample_model_filename.py b/project_directory/common/migrations/0002_auto__add_field_sample_model_filename.py deleted file mode 100644 index 9577c63..0000000 --- a/project_directory/common/migrations/0002_auto__add_field_sample_model_filename.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Sample.model_filename' - db.add_column(u'common_sample', 'model_filename', - self.gf('django.db.models.fields.CharField')(max_length=1000, null=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Sample.model_filename' - db.delete_column(u'common_sample', 'model_filename') - - - models = { - u'common.category': { - 'Meta': {'object_name': 'Category'}, - 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['common.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) - }, - u'common.sample': { - 'Meta': {'object_name': 'Sample'}, - 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model_filename': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['common.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) - } - } - - complete_apps = ['common'] \ No newline at end of file diff --git a/project_directory/common/migrations/0003_auto__chg_field_sample_model_filename.py b/project_directory/common/migrations/0003_auto__chg_field_sample_model_filename.py deleted file mode 100644 index cf9f8c8..0000000 --- a/project_directory/common/migrations/0003_auto__chg_field_sample_model_filename.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Sample.model_filename' - db.alter_column(u'common_sample', 'model_filename', self.gf('django.db.models.fields.CharField')(default='', max_length=1000)) - - def backwards(self, orm): - - # Changing field 'Sample.model_filename' - db.alter_column(u'common_sample', 'model_filename', self.gf('django.db.models.fields.CharField')(max_length=1000, null=True)) - - models = { - u'common.category': { - 'Meta': {'object_name': 'Category'}, - 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['common.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) - }, - u'common.sample': { - 'Meta': {'object_name': 'Sample'}, - 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model_filename': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['common.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) - } - } - - complete_apps = ['common'] \ No newline at end of file diff --git a/project_directory/common/views.py b/project_directory/common/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/project_directory/common/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. diff --git a/project_directory/db.sqlite3 b/project_directory/db.sqlite3 index a14ce1b42b571e0fd210799e1e5296affe5549e1..517581f62a7a086020d74e817e6cc05af9b03176 100644 GIT binary patch delta 2939 zcmd5;e{2(V6u)n;U3b^J?;9`}6WDIE1M1kg{=9Bu3w2v`(v6J?%thGRwTv>l+HxBM z!BHGjl*q<6CK?eVXkyevmO}&sY9J(pC_ywD6m=*ffA}NO#KnNoYq!p=bmL!}Tyyt* z@B2RQec$_j-rF^-*|m#V(%9e*$bMl%C=&F@f|bgk5Tcd~0!2|J>SI)&#Bagi601}~ z6@72isY?iM#RT`jE!@IA&a;Mcu9W$Jy{Z3zc{Xi>eyh%#X3{E}e>7>Rm-=BaT1!rO zs?Z#QyiLU6v7_1Q+bq)SsUYR8r6`m1w4NsJRZGzh4^QSO0Si^%Puzx1kq2P!8GnZ~QeriJ!yk@Dj}O-}CSDhxi?QGjHcv z?mO;HF2vcm48sk>DZ@cSx1nB{!Tm-n0yj(#4V2T$wN1H53Hb);DmG@EAEe+H_yRtJ zci|!-lmhyQ*sHo5WDLMKoKBM5)Lk z31&;FD3+S-#U+x%VYZV`rJQ-{s=3teEVWvS9cIyPHpg;^V1$B^JA6?SJ~*(RjFjr zNY|pf_z~8q$uow!Y#m{%RV)dHyEn-mzrCwN?hMOLN$L(n!q)9E3P5n3g6pZFR*>s! zg){`0D7chbLn{4k-hEA25yzr<>PZKyTe&A{;t)oeO=-sKQWm@{sik$uo zr9YGY88ef$u)PLssN|M&QT{DV!6)f`%=64u_6R#{*w0tuW%w+#D2I*fX$6~(qj4f1 zr}+6X26s;-{RZjz*bz`uGGwNPN=M90<`Gt4*BLnOBmN{_j<3Q_{m!(@X?eOM zIzjt9eOhxylZT!jimpMu(K&hgtQrYLO9Guff6wI1w2a=V7Mof0i5^c|N~y7ORkiEk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`aXz`+>ER(M)?QwYtLlACqujRq88onH3kq`zM%(NVM#B>JQjc e!>Avj9x+`#@3Goow70P^iTzSiavSoiRq!9CrhC)? diff --git a/project_directory/rockviewer/settings.py b/project_directory/rockviewer/settings.py index e30fe51..44d7284 100644 --- a/project_directory/rockviewer/settings.py +++ b/project_directory/rockviewer/settings.py @@ -124,7 +124,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', # Uncomment the next line to enable admin documentation: 'django.contrib.admindocs', - 'common', + 'three_d_viewer', 'south', ) diff --git a/project_directory/rockviewer/urls.py b/project_directory/rockviewer/urls.py index e775b3e..d35bbf9 100644 --- a/project_directory/rockviewer/urls.py +++ b/project_directory/rockviewer/urls.py @@ -13,5 +13,6 @@ urlpatterns = patterns('', # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: + url(r'', include('three_d_viewer.urls', namespace="three_d_viewer")), url(r'^admin/', include(admin.site.urls)), ) diff --git a/project_directory/common/__init__.py b/project_directory/three_d_viewer/__init__.py similarity index 100% rename from project_directory/common/__init__.py rename to project_directory/three_d_viewer/__init__.py diff --git a/project_directory/common/admin.py b/project_directory/three_d_viewer/admin.py similarity index 64% rename from project_directory/common/admin.py rename to project_directory/three_d_viewer/admin.py index f8bc84d..b8930a3 100644 --- a/project_directory/common/admin.py +++ b/project_directory/three_d_viewer/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from common.models import Category, Sample +from three_d_viewer.models import Category, Sample admin.site.register(Category) admin.site.register(Sample) diff --git a/project_directory/common/migrations/0001_initial.py b/project_directory/three_d_viewer/migrations/0001_initial.py similarity index 61% rename from project_directory/common/migrations/0001_initial.py rename to project_directory/three_d_viewer/migrations/0001_initial.py index c8d810f..076f6a9 100644 --- a/project_directory/common/migrations/0001_initial.py +++ b/project_directory/three_d_viewer/migrations/0001_initial.py @@ -9,47 +9,49 @@ class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Category' - db.create_table(u'common_category', ( + db.create_table(u'three_d_viewer_category', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=100)), ('active', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['common.Category'], null=True, on_delete=models.SET_NULL, blank=True)), + ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, on_delete=models.SET_NULL, to=orm['three_d_viewer.Category'])), )) - db.send_create_signal(u'common', ['Category']) + db.send_create_signal(u'three_d_viewer', ['Category']) # Adding model 'Sample' - db.create_table(u'common_sample', ( + db.create_table(u'three_d_viewer_sample', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(max_length=100)), ('active', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['common.Category'], null=True, on_delete=models.SET_NULL, blank=True)), + ('model_filename', self.gf('django.db.models.fields.CharField')(max_length=1000)), + ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['three_d_viewer.Category'], null=True, on_delete=models.SET_NULL, blank=True)), )) - db.send_create_signal(u'common', ['Sample']) + db.send_create_signal(u'three_d_viewer', ['Sample']) def backwards(self, orm): # Deleting model 'Category' - db.delete_table(u'common_category') + db.delete_table(u'three_d_viewer_category') # Deleting model 'Sample' - db.delete_table(u'common_sample') + db.delete_table(u'three_d_viewer_sample') models = { - u'common.category': { + u'three_d_viewer.category': { 'Meta': {'object_name': 'Category'}, 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['common.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['three_d_viewer.Category']"}) }, - u'common.sample': { + u'three_d_viewer.sample': { 'Meta': {'object_name': 'Sample'}, 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model_filename': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['common.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['three_d_viewer.Category']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}) } } - complete_apps = ['common'] \ No newline at end of file + complete_apps = ['three_d_viewer'] \ No newline at end of file diff --git a/project_directory/common/migrations/__init__.py b/project_directory/three_d_viewer/migrations/__init__.py similarity index 100% rename from project_directory/common/migrations/__init__.py rename to project_directory/three_d_viewer/migrations/__init__.py diff --git a/project_directory/common/models.py b/project_directory/three_d_viewer/models.py similarity index 100% rename from project_directory/common/models.py rename to project_directory/three_d_viewer/models.py diff --git a/templates/children.html b/project_directory/three_d_viewer/templates/children.html similarity index 100% rename from templates/children.html rename to project_directory/three_d_viewer/templates/children.html diff --git a/templates/main.html b/project_directory/three_d_viewer/templates/main.html similarity index 100% rename from templates/main.html rename to project_directory/three_d_viewer/templates/main.html diff --git a/project_directory/three_d_viewer/templates/three_d_viewer/detail.html b/project_directory/three_d_viewer/templates/three_d_viewer/detail.html new file mode 100644 index 0000000..12002b5 --- /dev/null +++ b/project_directory/three_d_viewer/templates/three_d_viewer/detail.html @@ -0,0 +1 @@ +

{{ sample.name }}

\ No newline at end of file diff --git a/project_directory/three_d_viewer/templates/three_d_viewer/index.html b/project_directory/three_d_viewer/templates/three_d_viewer/index.html new file mode 100644 index 0000000..9854e21 --- /dev/null +++ b/project_directory/three_d_viewer/templates/three_d_viewer/index.html @@ -0,0 +1,9 @@ +{% if active_samples %} + +{% else %} +

No samples are available.

+{% endif %} \ No newline at end of file diff --git a/project_directory/common/tests.py b/project_directory/three_d_viewer/tests.py similarity index 100% rename from project_directory/common/tests.py rename to project_directory/three_d_viewer/tests.py diff --git a/project_directory/three_d_viewer/urls.py b/project_directory/three_d_viewer/urls.py new file mode 100644 index 0000000..9b0ea0f --- /dev/null +++ b/project_directory/three_d_viewer/urls.py @@ -0,0 +1,9 @@ +from django.conf.urls import patterns, url +from three_d_viewer import views + +urlpatterns = patterns('', + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^(?P\d+)/$', views.DetailView.as_view(), name='detail'), +) + + diff --git a/project_directory/three_d_viewer/views.py b/project_directory/three_d_viewer/views.py new file mode 100644 index 0000000..4b7b287 --- /dev/null +++ b/project_directory/three_d_viewer/views.py @@ -0,0 +1,31 @@ +from django import template +from django.shortcuts import get_object_or_404, render +from django.http import HttpResponseRedirect, HttpResponse +from django.core.urlresolvers import reverse +from django.views import generic + +from three_d_viewer.models import Sample +register = template.Library() + + +@register.inclusion_tag('children.html') +def children_tag(category): + children = category.children.all() + return {'children': children} + + +class IndexView(generic.ListView): + template_name = 'three_d_viewer/index.html' + context_object_name = 'active_samples' + + def get_queryset(self): + """ + Return the last five published polls (not including those set to be + published in the future). + """ + return Sample.objects.filter(active=True) + + +class DetailView(generic.DetailView): + model = Sample + template_name = 'three_d_viewer/detail.html'