ups, forgot to add app
This commit is contained in:
parent
d59911bbfc
commit
6062d4782f
14
padmaTexts/texts/admin.py
Normal file
14
padmaTexts/texts/admin.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from models import PadmaText
|
||||||
|
from django.contrib import admin
|
||||||
|
from django import forms
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class PadmaTextAdmin(admin.ModelAdmin):
|
||||||
|
formfield_overrides = { models.TextField: {'widget': forms.Textarea(attrs={'class':'ckeditor'})}, }
|
||||||
|
prepopulated_fields = {'slug': ('title',)}
|
||||||
|
|
||||||
|
|
||||||
|
class Media:
|
||||||
|
js = ('ckeditor/ckeditor.js',) # The , at the end of this list IS important.
|
||||||
|
|
||||||
|
admin.site.register(PadmaText,PadmaTextAdmin)
|
16
padmaTexts/texts/models.py
Normal file
16
padmaTexts/texts/models.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class PadmaText(models.Model):
|
||||||
|
slug = models.SlugField()
|
||||||
|
title = models.CharField(max_length=512)
|
||||||
|
author = models.CharField(max_length=512, blank=True)
|
||||||
|
author_bio = models.TextField(blank=True)
|
||||||
|
abstract = models.TextField(blank=True)
|
||||||
|
html = models.TextField()
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return self.slug
|
||||||
|
|
8
padmaTexts/texts/views.py
Normal file
8
padmaTexts/texts/views.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Create your views here.
|
||||||
|
from models import PadmaText
|
||||||
|
from django.http import HttpResponse
|
||||||
|
from django.shortcuts import get_object_or_404, render_to_response
|
||||||
|
|
||||||
|
def text(request, slug):
|
||||||
|
text = get_object_or_404(PadmaText, slug=slug)
|
||||||
|
return render_to_response("text_embed.html", {'text': text})
|
Loading…
Reference in New Issue
Block a user