ups, forgot to add app

This commit is contained in:
sanj 2010-11-11 05:46:21 +05:30
parent d59911bbfc
commit 6062d4782f
3 changed files with 38 additions and 0 deletions

14
padmaTexts/texts/admin.py Normal file
View 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)

View 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

View 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})