Skip to content

Commit

Permalink
fixed migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbit463 committed Feb 28, 2021
1 parent 9587ead commit 10caec5
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Quick start

1. pip install::

pip install https://github.com/rabbit463/django-easy-faq/blob/master/dist/django-easy-faq-0.4.tar.gz?raw=true
pip install https://github.com/rabbit463/django-easy-faq/blob/master/dist/django-easy-faq-0.5.tar.gz?raw=true

1. Add "easy-faq" to your INSTALLED_APPS setting like this::

Expand Down Expand Up @@ -287,4 +287,5 @@ Template Variables

change log
----------
0.4 fixed bug that logged out users can vote - which then raises exceptions
0.4 fixed bug that logged out users can vote - which then raises exceptions
0.5 fixed migrations
Binary file added dist/django-easy-faq-0.5.tar.gz
Binary file not shown.
7 changes: 4 additions & 3 deletions django_easy_faq.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-easy-faq
Version: 0.4
Version: 0.5
Summary: A Django app to add great faq functionality to website.
Home-page: UNKNOWN
Author: UNKNOWN
Expand All @@ -18,7 +18,7 @@ Description: ========

1. pip install::

pip install https://github.com/rabbit463/django-easy-faq/blob/master/dist/django-easy-faq-0.4.tar.gz?raw=true
pip install https://github.com/rabbit463/django-easy-faq/blob/master/dist/django-easy-faq-0.5.tar.gz?raw=true

1. Add "easy-faq" to your INSTALLED_APPS setting like this::

Expand Down Expand Up @@ -92,7 +92,7 @@ Description: ========
{% endfor %}


2. categories_detail.html - faq category detail view if using categories::
2. category_detail.html - faq category detail view if using categories::

<h1>choose a FAQ Question</h1>
<h2>{{category}}</h2>
Expand Down Expand Up @@ -296,6 +296,7 @@ Description: ========
change log
----------
0.4 fixed bug that logged out users can vote - which then raises exceptions
0.5 fixed migrations
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Expand Down
2 changes: 2 additions & 0 deletions django_easy_faq.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ faq/snippets.py
faq/tests.py
faq/urls.py
faq/views.py
faq/migrations/0001_initial.py
faq/migrations/__init__.py
faq/templates/faq/answer_form.html
faq/templates/faq/categories_list.html
faq/templates/faq/category_detail.html
Expand Down
96 changes: 96 additions & 0 deletions faq/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Generated by Django 3.1.7 on 2021-02-28 16:07

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Answer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('answer', models.TextField()),
('slug', models.SlugField(max_length=10)),
('helpful', models.IntegerField(default=0)),
('not_helpful', models.IntegerField(default=0)),
],
),
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50, unique=True)),
('description', models.TextField()),
('slug', models.SlugField(unique=True)),
],
options={
'verbose_name_plural': 'categories',
},
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question', models.CharField(max_length=150, unique=True)),
('slug', models.SlugField(max_length=150, unique=True)),
('helpful', models.IntegerField(default=0)),
('not_helpful', models.IntegerField(default=0)),
('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='faq.category')),
],
),
migrations.CreateModel(
name='QuestionHelpful',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vote', models.BooleanField()),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='faq.question')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['question', 'vote'],
},
),
migrations.CreateModel(
name='FAQComment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('comment', models.TextField()),
('post_time', models.DateTimeField(auto_now_add=True)),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='faq.question')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['question', '-post_time'],
},
),
migrations.CreateModel(
name='AnswerHelpful',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vote', models.BooleanField()),
('answer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='faq.answer')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['answer', 'vote'],
},
),
migrations.AddField(
model_name='answer',
name='question',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='faq.question'),
),
migrations.AlterOrderWithRespectTo(
name='answer',
order_with_respect_to='question',
),
]
Empty file added faq/migrations/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions faq/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def get_not_helpful(self):
def __str__(self):
return self.answer

class Meta:
order_with_respect_to = 'question'

def save(self,*args,**kwargs):
# if first time saving add a new slug
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = django-easy-faq
version = 0.4
version = 0.5
description = A Django app to add great faq functionality to website.
long_description = file: README.rst
license = BSD-3-Clause # Example license
Expand Down

0 comments on commit 10caec5

Please sign in to comment.