diff options
author | luxagraf <sng@luxagraf.net> | 2015-12-07 20:19:06 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2015-12-07 20:19:06 -0500 |
commit | 6ad212ae8a542e93d173c2b8e6efcd68109380c8 (patch) | |
tree | a0ed068b994e40373a506196d57e48fdd673e6a2 /app/pages | |
parent | e4a7f290d373427c36d7925e7381aadf16524936 (diff) |
added ability to edit resume landing and cv from pages app
Diffstat (limited to 'app/pages')
-rw-r--r-- | app/pages/admin.py | 2 | ||||
-rw-r--r-- | app/pages/migrations/0001_initial.py | 27 | ||||
-rw-r--r-- | app/pages/migrations/0002_page_path.py | 20 | ||||
-rw-r--r-- | app/pages/migrations/__init__.py | 0 | ||||
-rw-r--r-- | app/pages/models.py | 2 | ||||
-rw-r--r-- | app/pages/views.py | 11 |
6 files changed, 60 insertions, 2 deletions
diff --git a/app/pages/admin.py b/app/pages/admin.py index 844007e..977a0cf 100644 --- a/app/pages/admin.py +++ b/app/pages/admin.py @@ -22,7 +22,7 @@ class PageAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ('title',)} fieldsets = ( ('Page', { - 'fields': ('title', 'body_markdown', 'slug'), + 'fields': ('title', 'body_markdown', ('slug', 'path')), 'classes': ('show', 'extrapretty', 'wide') }), ('Metadata', { diff --git a/app/pages/migrations/0001_initial.py b/app/pages/migrations/0001_initial.py new file mode 100644 index 0000000..4e138f7 --- /dev/null +++ b/app/pages/migrations/0001_initial.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2015-12-03 17:02 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Page', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('slug', models.SlugField()), + ('body_html', models.TextField(blank=True)), + ('body_markdown', models.TextField()), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ], + ), + ] diff --git a/app/pages/migrations/0002_page_path.py b/app/pages/migrations/0002_page_path.py new file mode 100644 index 0000000..e09bfbc --- /dev/null +++ b/app/pages/migrations/0002_page_path.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2015-12-03 17:12 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='page', + name='path', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/app/pages/migrations/__init__.py b/app/pages/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/pages/migrations/__init__.py diff --git a/app/pages/models.py b/app/pages/models.py index ed7b94e..9b7be7f 100644 --- a/app/pages/models.py +++ b/app/pages/models.py @@ -10,7 +10,7 @@ class Page(models.Model): body_html = models.TextField(blank=True) body_markdown = models.TextField() meta_description = models.CharField(max_length=256, null=True, blank=True) - #path = models.CharField(max_length=200, null=True, blank=True) + path = models.CharField(max_length=200, null=True, blank=True) def __unicode__(self): return self.title diff --git a/app/pages/views.py b/app/pages/views.py index 934cb40..026ab36 100644 --- a/app/pages/views.py +++ b/app/pages/views.py @@ -6,3 +6,14 @@ def page(request, slug): obj = get_object_or_404(Page, slug__exact=slug) context = {'object': obj, } return render_to_response(["details/%s.html" % obj.slug, 'details/page.html'], context, context_instance=RequestContext(request)) + +from django.views.generic.detail import DetailView + + +class PageDetailView(DetailView): + model = Page + slug_field = "slug" + + def get_template_names(self): + obj = self.get_object() + return ["details/%s.html" % obj.slug, 'details/page.html'] |