Merge branch 'master' of https://github.com/sfrischkorn/rockviewer
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
*.pyc
|
||||
|
||||
.DS_Store
|
||||
|
||||
@@ -2,3 +2,4 @@ Django==1.5.1
|
||||
South==0.8.1
|
||||
distribute==0.6.34
|
||||
wsgiref==0.1.2
|
||||
-g git+http://github.com/sfrischkorn/rockviewer.git#egg=rockviewer
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# -*- 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']
|
||||
@@ -0,0 +1,38 @@
|
||||
# -*- 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']
|
||||
@@ -14,9 +14,11 @@ class CommonInfo(models.Model):
|
||||
|
||||
class Category(CommonInfo):
|
||||
parent = models.ForeignKey('self', blank=True, null=True,
|
||||
on_delete=models.SET_NULL)
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='children')
|
||||
|
||||
|
||||
class Sample(CommonInfo):
|
||||
model_filename = models.CharField(max_length=1000)
|
||||
parent = models.ForeignKey(Category, blank=True, null=True,
|
||||
on_delete=models.SET_NULL)
|
||||
|
||||
Binary file not shown.
@@ -156,3 +156,11 @@ LOGGING = {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Custom config settings
|
||||
MODEL_DIRS = (
|
||||
# put model directories here, separated by commas. If there are
|
||||
# models with the same name under different directories, the first
|
||||
# directory will be used
|
||||
)
|
||||
|
||||
7
templates/children.html
Normal file
7
templates/children.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<ul>
|
||||
{% for child in children %}
|
||||
<li> <a href="{{ child.get_absolute_url }}">{{ child }}</a></li>
|
||||
{% child.children.count > 0 %}
|
||||
{% children_list child %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
1
templates/main.html
Normal file
1
templates/main.html
Normal file
@@ -0,0 +1 @@
|
||||
{% children_tag parent %}
|
||||
Reference in New Issue
Block a user