fmartingr
/
shelfzilla
Archived
1
0
Fork 0

Base FAQ app

This commit is contained in:
Felipe Martín 2015-04-09 15:35:38 +00:00
parent a5c7e99e46
commit 50ba30b7ba
9 changed files with 95 additions and 0 deletions

View File

View File

@ -0,0 +1,17 @@
# coding: utf-8
# django
from django.contrib import admin
# app
from .models import Question, TranslatedQuestion
class TranslatedQuestionInline(admin.TabularInline):
model = TranslatedQuestion
class QuestionAdmin(admin.ModelAdmin):
inlines = (TranslatedQuestionInline, )
admin.site.register(Question, QuestionAdmin)

View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TranslatedQuestion',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=256)),
('answer', models.TextField()),
('question', models.ForeignKey(to='faq.Question')),
],
options={
},
bases=(models.Model,),
),
]

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('manga', '0001_initial'),
('faq', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='translatedquestion',
name='language',
field=models.ForeignKey(default=1, to='manga.Language'),
preserve_default=False,
),
]

View File

@ -0,0 +1,16 @@
from django.db import models
# Create your models here.
class Question(models.Model):
def __unicode__(self):
return self.translations.get(language__code='es').title
class TranslatedQuestion(models.Model):
question = models.ForeignKey(Question, related_name='translations')
language = models.ForeignKey('manga.Language')
title = models.CharField(max_length=256)
answer = models.TextField()
def __unicode__(self):
return self.title

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

@ -69,6 +69,7 @@ INSTALLED_APPS = (
'shelfzilla.apps.mailing',
'shelfzilla.apps.manga',
'shelfzilla.apps.blog',
'shelfzilla.apps.faq',
'shelfzilla.apps.pjax',
# API