Commits

Anonymous committed a71a2fc

Initial checkin

Comments (0)

Files changed (7)

+syntax: glob
+*~
+*.pyc
+This is a _trivially_ simple FAQ system.
+
+Some people really don't need much.
+
+
+==========================
+What do you mean no Views?
+==========================
+
+Because you don't need them!
+
+Generic views do it, and will do it in your urls.py
+
+OK, so I included category_detail if you want to show a list of questions from
+just one category.

gnocchi_faq/__init__.py

Empty file added.

gnocchi_faq/models.py

+from django.db import models
+
+class Category(models.Model):
+    title = models.CharField(max_length=1024, unique=True)
+    slug = models.SlugField()
+    order = models.IntegerField(default=1)
+
+    class Meta:
+        ordering = ('order',)
+    def __unicode__(self):
+        return self.title
+
+class QuestionManager(models.Manager):
+    def current():
+        return self.get_query_set().filter(is_published=True)
+
+class Question(models.Model):
+    category = models.ForeignKey(Category)
+    question = models.CharField(max_length=200)
+    order = models.IntegerField(default=1)
+    answer = models.TextField()
+    is_published = models.BooleanField(default=False)
+
+    objects = QuestionManager()
+
+    class Meta:
+        ordering = ('category__order', 'order',)
+    def __unicode__(self):
+        return self.question

gnocchi_faq/urls.py

Empty file added.

gnocchi_faq/views.py

+from gnocchi_faq.models import Category
+
+def category_detail(request, category_id =None, slug=None):
+    if slug:
+        category = get_object_or_404(Category, slug=slug)
+    else:
+        category = get_object_or_404(Category, pk=category_id)
+
+    return direct_to_template(request, 'gnocchi_faq/category_detail.html',
+        extra_context = {
+            'object': category,
+        }
+    )
+from setuptools import setup, find_packages
+
+setup( name='gnocchi-faq',
+    version = '1.0',
+    description = 'A simpler FAQ app',
+    author = 'Curtis Maloney',
+    author_email = 'curtis@tinbrain.net',
+    url = 'http://bitbucket.org/funkybob/gnocchi-blog/',
+    keywords = ['django', 'faq',],
+    packages = find_packages(),
+    zip_safe = False,
+    classifiers = [
+        'Environment :: Web Environment',
+        'Framework :: Django',
+        'License :: OSI Approved :: BSD License',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+    ],
+    install_requires = [
+        'Django>=1.2',
+    ]
+)