├── tests ├── __init__.py ├── settings.py ├── test_mixins.py ├── test_models.py └── test_views.py ├── qa ├── migrations │ ├── __init__.py │ ├── 0012_remove_question_views.py │ ├── 0006_question_total_points.py │ ├── 0007_answer_total_points.py │ ├── 0009_auto_20160919_1528.py │ ├── 0010_auto_20160919_2033.py │ ├── 0002_auto_20160412_1336.py │ ├── 0004_answer_updated.py │ ├── 0008_auto_20160719_0729.py │ ├── 0011_question_slug.py │ ├── 0005_auto_20160519_1057.py │ ├── 0003_auto_20160414_1413.py │ └── 0001_initial.py ├── __init__.py ├── static │ ├── qa │ │ ├── icon.ico │ │ ├── user.png │ │ ├── qa_index.jpeg │ │ ├── qa_page.jpeg │ │ └── question.jpg │ └── css │ │ └── qa.css ├── templates │ ├── 403.html │ └── qa │ │ ├── update_answer.html │ │ ├── update_question.html │ │ ├── create_comment.html │ │ ├── profile.html │ │ ├── create_question.html │ │ ├── create_answer.html │ │ ├── base.html │ │ ├── index.html │ │ └── detail_question.html ├── apps.py ├── signals.py ├── admin.py ├── forms.py ├── mixins.py ├── utils.py ├── urls.py ├── models.py └── views.py ├── test_project ├── core │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── admin.py │ ├── models.py │ ├── apps.py │ ├── forms.py │ ├── templates │ │ ├── register.html │ │ └── login.html │ └── views.py ├── simpleqa │ ├── __init__.py │ ├── urls.py │ ├── wsgi.py │ └── settings.py ├── requirements.txt └── manage.py ├── .coveragerc ├── requirements.txt ├── manage.py ├── MANIFEST.in ├── docs ├── index.rst ├── installation.rst ├── make.bat ├── base.rst ├── settings.rst ├── conf.py └── Makefile ├── .travis.yml ├── AUTHORS.rst ├── runtests.py ├── LICENSE.md ├── .gitignore ├── setup.py ├── Makefile ├── CONTRIBUTING.rst └── README.rst /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_project/core/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_project/simpleqa/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_project/core/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /qa/__init__.py: -------------------------------------------------------------------------------- 1 | default_app_config = 'qa.apps.QAConfig' 2 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | include = qa/* 3 | omit = *migrations*, *tests* 4 | -------------------------------------------------------------------------------- /qa/static/qa/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swappsco/django-qa/HEAD/qa/static/qa/icon.ico -------------------------------------------------------------------------------- /qa/static/qa/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swappsco/django-qa/HEAD/qa/static/qa/user.png -------------------------------------------------------------------------------- /test_project/core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /test_project/core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /qa/static/qa/qa_index.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swappsco/django-qa/HEAD/qa/static/qa/qa_index.jpeg -------------------------------------------------------------------------------- /qa/static/qa/qa_page.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swappsco/django-qa/HEAD/qa/static/qa/qa_page.jpeg -------------------------------------------------------------------------------- /qa/static/qa/question.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swappsco/django-qa/HEAD/qa/static/qa/question.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | django-annoying>=0.10.4 2 | django-markdown-app>=0.9.4.1 3 | django-taggit>=0.22.2 4 | pytz>=2018.5 5 | django-hitcount>=1.3.0 6 | -------------------------------------------------------------------------------- /test_project/core/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /qa/templates/403.html: -------------------------------------------------------------------------------- 1 | {% extends 'qa/base.html' %} 2 | 3 | {% block content %} 4 |

Sorry, but you're not allowed to do that

5 | {% endblock content %} 6 | -------------------------------------------------------------------------------- /qa/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class QAConfig(AppConfig): 5 | name = 'qa' 6 | 7 | def ready(self): 8 | import qa.signals 9 | -------------------------------------------------------------------------------- /test_project/core/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class CoreConfig(AppConfig): 7 | name = 'core' 8 | -------------------------------------------------------------------------------- /qa/templates/qa/update_answer.html: -------------------------------------------------------------------------------- 1 | {% extends 'qa/create_answer.html' %} 2 | 3 | {% block action_url %} 4 | {% url 'qa_update_answer' view.kwargs.answer_id %} 5 | {% endblock action_url %} 6 | -------------------------------------------------------------------------------- /qa/templates/qa/update_question.html: -------------------------------------------------------------------------------- 1 | {% extends 'qa/create_question.html' %} 2 | 3 | {% block action_url %} 4 | {% url 'qa_update_question' view.kwargs.question_id %} 5 | {% endblock action_url %} 6 | -------------------------------------------------------------------------------- /test_project/requirements.txt: -------------------------------------------------------------------------------- 1 | # Your app requirements. 2 | -r ../requirements.txt 3 | 4 | # Your app in editable mode. 5 | -e ../ 6 | 7 | # This project requirements 8 | django-bootstrap3==10.0.1 9 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | import os 2 | from django.core import management 3 | 4 | os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' 5 | if __name__ == "__main__": 6 | management.execute_from_command_line() 7 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS.rst 2 | include CONTRIBUTING.rst 3 | include LICENSE 4 | include README.rst 5 | recursive-include qa *.html *.png *.gif *js *.css *jpg *jpeg *svg *py 6 | recursive-include qa/templates * 7 | recursive-include qa/static * 8 | recursive-include qa/migrations * 9 | -------------------------------------------------------------------------------- /test_project/manage.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | if __name__ == "__main__": 5 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "simpleqa.settings") 6 | 7 | from django.core.management import execute_from_command_line 8 | 9 | execute_from_command_line(sys.argv) 10 | -------------------------------------------------------------------------------- /test_project/core/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.contrib.auth import get_user_model 3 | 4 | 5 | class UserForm(forms.ModelForm): 6 | password = forms.CharField(widget=forms.PasswordInput()) 7 | 8 | class Meta: 9 | model = get_user_model() 10 | fields = ('username', 'email', 'password') 11 | -------------------------------------------------------------------------------- /qa/signals.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import User 2 | from django.db.models.signals import post_save 3 | from django.dispatch import receiver 4 | 5 | from .models import UserQAProfile 6 | 7 | 8 | @receiver(post_save, sender=User) 9 | def ensure_profile_exists(sender, **kwargs): 10 | if kwargs.get('created', False): 11 | UserQAProfile.objects.get_or_create(user=kwargs.get('instance')) 12 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. django-qa documentation master file. 2 | .. include:: base.rst 3 | 4 | Welcome to django-qa's documentation! 5 | ===================================== 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | :caption: Contents: 10 | 11 | installation 12 | settings 13 | 14 | Indices and tables 15 | ================== 16 | 17 | * :ref:`genindex` 18 | * :ref:`modindex` 19 | * :ref:`search` 20 | -------------------------------------------------------------------------------- /qa/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django_markdown.admin import MarkdownModelAdmin 3 | from qa.models import (Answer, AnswerComment, AnswerVote, Question, 4 | QuestionComment) 5 | 6 | admin.site.register(Question) 7 | admin.site.register(Answer, MarkdownModelAdmin) 8 | admin.site.register(AnswerComment) 9 | admin.site.register(QuestionComment) 10 | admin.site.register(AnswerVote) 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.5" 4 | - "3.6" 5 | 6 | env: 7 | matrix: 8 | - DJANGO="Django>=2.0,<2.1" 9 | 10 | branches: 11 | only: 12 | - master 13 | 14 | install: 15 | - pip install -r requirements.txt 16 | - pip install "$DJANGO" 17 | - pip install python-coveralls 18 | - pip install coverage 19 | 20 | script: "coverage run manage.py test" 21 | 22 | after_success: 23 | - coveralls 24 | -------------------------------------------------------------------------------- /test_project/simpleqa/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url, include 2 | from django.contrib import admin 3 | 4 | from core.views import register, user_login, user_logout 5 | 6 | urlpatterns = [ 7 | url(r'^admin/', admin.site.urls), 8 | url(r'^register/$', register, name='register'), 9 | url(r'^login/$', user_login, name='login'), 10 | url(r'^logout/$', user_logout, name='logout'), 11 | url(r'^', include('qa.urls')), 12 | ] 13 | -------------------------------------------------------------------------------- /test_project/simpleqa/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for simpleqa project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "simpleqa.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | Credits 3 | ======= 4 | 5 | The Begining 6 | ------------ 7 | 8 | django-qa was started by Arjun Komath () in 2015 as a 9 | way to have a simple and pluggable Q&A App for Django projects. 10 | 11 | Development Lead 12 | ---------------- 13 | 14 | * Cristian Vargas 15 | 16 | Contributors 17 | ------------ 18 | 19 | Arjun Komath 20 | Cristian Vargas 21 | Sebastian Reyes 22 | Jose Ariza 23 | The SWAPPS development team 24 | -------------------------------------------------------------------------------- /qa/migrations/0012_remove_question_views.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-01-05 19:45 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('qa', '0011_question_slug'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name='question', 17 | name='views', 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /qa/migrations/0006_question_total_points.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('qa', '0005_auto_20160519_1057'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='question', 16 | name='total_points', 17 | field=models.IntegerField(default=0), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /qa/migrations/0007_answer_total_points.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('qa', '0006_question_total_points'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='answer', 16 | name='total_points', 17 | field=models.IntegerField(default=0), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /qa/templates/qa/create_comment.html: -------------------------------------------------------------------------------- 1 | {% extends 'qa/base.html' %} 2 | {% load django_markdown %} 3 | 4 | {% block content %} 5 | 6 | {% if message %} 7 | Enter a valid Answer! 8 | {% endif %} 9 | 10 |
11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
15 | 16 | 17 | 18 | {% markdown_editor "#ans" %} 19 | {% markdown_media %} 20 | {% endblock content %} 21 | -------------------------------------------------------------------------------- /qa/migrations/0009_auto_20160919_1528.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-09-19 15:28 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('qa', '0008_auto_20160719_0729'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterModelOptions( 16 | name='answer', 17 | options={'ordering': ['answer', '-pub_date']}, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /qa/migrations/0010_auto_20160919_2033.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2016-09-19 20:33 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('qa', '0009_auto_20160919_1528'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterModelOptions( 16 | name='answer', 17 | options={'ordering': ['-answer', '-pub_date']}, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /qa/templates/qa/profile.html: -------------------------------------------------------------------------------- 1 | {% extends 'qa/base.html' %} 2 | {% load django_markdown %} 3 | 4 | {% block content %} 5 |

Points: {{ user.points }}

6 |