├── .gitignore ├── .travis.yml ├── LICENSE ├── MANIFEST.in ├── Procfile ├── README.rst ├── app.json ├── django_simple_forum ├── __init__.py ├── apps.py ├── facebook.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20160628_1211.py │ ├── 0003_topic_tags.py │ ├── 0004_topic_no_of_likes.py │ ├── 0005_attachment.py │ ├── 0006_forumcategory_description.py │ ├── 0007_topic_no_of_votes.py │ ├── 0008_auto_20160707_1311.py │ ├── 0009_userprofile_profile_pic.py │ ├── 0010_forumcategory_parent.py │ ├── 0011_facebook_github_google_twitter.py │ ├── 0012_comment_mentioned.py │ ├── 0013_userprofile_send_mailnotifications.py │ ├── 0014_auto_20170208_0550.py │ └── __init__.py ├── mixins.py ├── models.py ├── sending_mail.py ├── static │ ├── css │ │ ├── bootstrap-suggest.css │ │ ├── dashboard.css │ │ ├── forum.css │ │ ├── jquery.tagsinput.css │ │ ├── login.css │ │ └── ref.css │ └── js │ │ ├── bootstrap-suggest.js │ │ ├── jquery.form.js │ │ └── jquery.tagsinput.js ├── templates │ ├── dashboard │ │ ├── badge_add.html │ │ ├── badges.html │ │ ├── categories.html │ │ ├── category_add.html │ │ ├── change_password.html │ │ ├── dashboard.html │ │ ├── dashboard_base.html │ │ ├── dashboard_login.html │ │ ├── edit_user.html │ │ ├── topics.html │ │ ├── users.html │ │ ├── view_badge.html │ │ ├── view_category.html │ │ ├── view_topic.html │ │ └── view_user.html │ ├── emails │ │ ├── comment_add.html │ │ ├── comment_mentioned.html │ │ └── new_topic.html │ ├── forum │ │ ├── badges.html │ │ ├── base.html │ │ ├── categories.html │ │ ├── left_menu.html │ │ ├── new_topic.html │ │ ├── profile.html │ │ ├── tags.html │ │ ├── topic_delete.html │ │ ├── topic_list.html │ │ ├── topics_list.html │ │ └── view_topic.html │ └── login.html ├── templatetags │ ├── __init__.py │ └── forum_tags.py ├── tests.py ├── urls.py └── views.py ├── docs ├── Makefile ├── __init__.py └── source │ ├── conf.py │ └── index.rst ├── requirements.txt ├── sandbox ├── manage.py ├── requirements.txt └── test_django_simple_forum │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── setup.py └── test_runner.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | .coverage 85 | *.pyc -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 4 | - "3.4.3" 5 | 6 | install: 7 | - python setup.py install 8 | - pip install -r requirements.txt 9 | 10 | script: 11 | - coverage run --source=django_simple_forum test_runner.py test 12 | 13 | after_success: 14 | coveralls -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 MicroPyramid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst 2 | recursive-include django_simple_forum/templates/dashboard * 3 | recursive-include django_simple_forum/templates/emails * 4 | recursive-include django_simple_forum/templates/forum * 5 | recursive-include django_simple_forum/static * 6 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: sh -c 'cd sandbox && gunicorn test_django_simple_forum.wsgi' 2 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-simple-forum: 2 | ===================================== 3 | .. image:: https://readthedocs.org/projects/django-simple-forum/badge/?version=latest 4 | :target: http://django-simple-forum.readthedocs.io/en/latest/ 5 | :alt: Documentation Status 6 | 7 | .. image:: https://travis-ci.org/MicroPyramid/django-simple-forum.svg?branch=master 8 | :target: https://travis-ci.org/MicroPyramid/django-simple-forum 9 | 10 | .. image:: https://img.shields.io/pypi/dm/django-simple-forum.svg 11 | :target: https://pypi.python.org/pypi/django-simple-forum 12 | :alt: Downloads 13 | 14 | .. image:: https://img.shields.io/pypi/v/django-simple-forum.svg 15 | :target: https://pypi.python.org/pypi/django-simple-forum 16 | :alt: Latest Release 17 | 18 | .. image:: https://coveralls.io/repos/github/MicroPyramid/django-simple-forum/badge.svg 19 | :target: https://coveralls.io/github/MicroPyramid/django-simple-forum 20 | 21 | .. image:: https://landscape.io/github/MicroPyramid/django-simple-forum/master/landscape.svg?style=flat 22 | :target: https://landscape.io/github/MicroPyramid/django-simple-forum/master 23 | :alt: Code Health 24 | 25 | .. image:: https://img.shields.io/github/license/micropyramid/django-simple-forum.svg 26 | :target: https://pypi.python.org/pypi/django-simple-forum/ 27 | :alt: Latest Release 28 | 29 | 30 | Introduction: 31 | ============= 32 | 33 | `django simple forum`_ is a discussion board where people with similar interests can create and discuss various topics. You can also mention any particpant those are involved in the repsective topic in the comment. You can also receive email notifications when there is an update in the topic, when you follow the topic. 34 | 35 | 36 | Source Code is available in `Micropyramid Repository`_. 37 | 38 | Modules used: 39 | 40 | * Python >= 2.6 (or Python 3.4) 41 | * Django = 1.9.6 42 | * JQuery >= 1.7 43 | * Microurl >=3.6.1 44 | * Boto == 2.40.0 45 | * Sendgrid == 2.2.1 46 | * django-ses-gateway 47 | 48 | Installation Procedure 49 | ====================== 50 | 51 | 1. Install django-simple-forum using the following command:: 52 | 53 | pip install django-simple-forum 54 | 55 | (or) 56 | 57 | git clone git://github.com/micropyramid/django-simple-forum.git 58 | 59 | cd django-simple-forum 60 | 61 | python setup.py install 62 | 63 | 2. Add app name in settings.py:: 64 | 65 | INSTALLED_APPS = [ 66 | '..................', 67 | 'compressor', 68 | 'django_simple_forum', 69 | '..................' 70 | ] 71 | 72 | 3. After installing/cloning, add the following details in settings file to send emails notifications:: 73 | 74 | # AWS details 75 | 76 | AWS_ACCESS_KEY_ID = "Your AWS Access Key" 77 | 78 | AWS_SECRET_ACCESS_KEY = "Your AWS Secret Key" 79 | 80 | or 81 | 82 | SG_USER = "Your Sendgrid Username" 83 | SG_PWD = "Your Sendgrid Password" 84 | 85 | 4. Use virtualenv to install requirements:: 86 | 87 | pip install -r requirements.txt 88 | 89 | 90 | You can view the complete documentation here. `Documentation`_ 91 | 92 | You can try it by hosting on your own or deploy to Heroku with a button click. 93 | 94 | Deploy To Heroku: 95 | 96 | .. image:: https://www.herokucdn.com/deploy/button.svg 97 | :target: https://heroku.com/deploy?template=https://github.com/MicroPyramid/django-simple-forum/ 98 | 99 | 100 | We are always looking to help you customize the whole or part of the code as you like. 101 | 102 | Visit our Django Page `Here`_ 103 | 104 | We welcome your feedback and support, raise `github ticket`_ if you want to report a bug. Need new features? `Contact us here`_ 105 | 106 | or 107 | 108 | mailto:: "hello@micropyramid.com" 109 | 110 | .. _contact us here: https://micropyramid.com/contact-us/ 111 | .. _Documentation: http://django-simple-forum.readthedocs.io/en/latest/ 112 | .. _github ticket: https://github.com/MicroPyramid/django-simple-forum/issues 113 | .. _django simple forum: https://micropyramid.com/oss/ 114 | .. _Micropyramid Repository: https://github.com/MicroPyramid/django-simple-forum.git 115 | .. _Here: https://micropyramid.com/django-development-services/ 116 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Django Forum", 3 | "description": "django forum application for quick integration of forum", 4 | "repository": "https://github.com/MicroPyramid/django-simple-forum/", 5 | "scripts": { 6 | "postdeploy": "python sandbox/manage.py makemigrations && python sandbox/manage.py migrate && echo \"from django.contrib.auth.models import User; User.objects.create_superuser('Admin001', 'admin001@djangosimpleforum.com', 'admin001')\" | python sandbox/manage.py shell" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /django_simple_forum/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicroPyramid/django-simple-forum/13ad478a7680df8e2aa466485f0abbaf7fa059db/django_simple_forum/__init__.py -------------------------------------------------------------------------------- /django_simple_forum/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class DjangoSimpleForumConfig(AppConfig): 5 | name = 'django_simple_forum' 6 | -------------------------------------------------------------------------------- /django_simple_forum/facebook.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import urllib 4 | try: 5 | import urllib.request as urllib2 6 | except ImportError: 7 | import urllib2 8 | import hashlib 9 | import hmac 10 | import base64 11 | import socket 12 | import requests 13 | 14 | # Find a JSON parser 15 | try: 16 | import simplejson as json 17 | except ImportError: 18 | try: 19 | from django.utils import simplejson as json 20 | except ImportError: 21 | import json 22 | _parse_json = json.loads 23 | 24 | # Find a query string parser 25 | try: 26 | from urlparse import parse_qs 27 | except ImportError: 28 | from cgi import parse_qs 29 | 30 | 31 | class GraphAPI(object): 32 | def __init__(self, access_token=None, timeout=None): 33 | self.access_token = access_token 34 | self.timeout = timeout 35 | 36 | def get_object(self, id, **args): 37 | return self.request(id, args) 38 | 39 | def get_objects(self, ids, **args): 40 | args["ids"] = ",".join(ids) 41 | return self.request("", args) 42 | 43 | def get_connections(self, id, connection_name, **args): 44 | return self.request(id + "/" + connection_name, args) 45 | 46 | def put_object(self, parent_object, connection_name, **data): 47 | if self.access_token: 48 | return self.request(parent_object + "/" + connection_name,post_args=data) 49 | else: 50 | raise AssertionError("access token not provided") 51 | 52 | def delete_object(self, id): 53 | """Deletes the object with the given ID from the graph.""" 54 | # x=self.request(id, post_args={"method": "delete"}) 55 | params = urllib.parse.urlencode({"method": "delete", 'access_token': str(id)}) 56 | u = requests.get("https://graph.facebook.com/" + str(id) + "?" + params) 57 | groups = u.json() 58 | return groups 59 | 60 | def request(self, path, args=None, post_args=None): 61 | 62 | args = args or {} 63 | 64 | if self.access_token: 65 | if post_args is not None: 66 | post_args["access_token"] = self.access_token 67 | else: 68 | args["access_token"] = self.access_token 69 | post_data = None if post_args is None else urllib.urlencode(post_args) 70 | try: 71 | file = urllib2.urlopen("https://graph.facebook.com/" + path + "?" + 72 | urllib.parse.urlencode(args), 73 | post_data, timeout=self.timeout) 74 | except (urllib2.HTTPError, error): 75 | response = _parse_json(error.read()) 76 | raise GraphAPIError(response) 77 | except TypeError: 78 | # Timeout support for Python <2.6 79 | if self.timeout: 80 | socket.setdefaulttimeout(self.timeout) 81 | file = urllib2.urlopen("https://graph.facebook.com/" + path + "?" + 82 | urllib.parse.urlencode(args), post_data) 83 | try: 84 | fileInfo = file.info() 85 | response = '' 86 | # if 'maintype' in fileInfo.keys(): 87 | # if fileInfo.maintype == 'text': 88 | response = _parse_json(file.read()) 89 | # elif fileInfo.maintype == 'image': 90 | # mimetype = fileInfo['content-type'] 91 | # response = { 92 | # "data": file.read(), 93 | # "mime-type": mimetype, 94 | # "url": file.url, 95 | # } 96 | # else: 97 | # raise GraphAPIError('Maintype was not text or image') 98 | finally: 99 | file.close() 100 | if response and isinstance(response, dict) and response.get("error"): 101 | raise GraphAPIError(response["error"]["type"], 102 | response["error"]["message"]) 103 | return response 104 | 105 | def fql(self, query, args=None, post_args=None): 106 | """FQL query. 107 | 108 | Example query: "SELECT affiliations FROM user WHERE uid = me()" 109 | 110 | """ 111 | args = args or {} 112 | if self.access_token: 113 | if post_args is not None: 114 | post_args["access_token"] = self.access_token 115 | else: 116 | args["access_token"] = self.access_token 117 | post_data = None if post_args is None else urllib.urlencode(post_args) 118 | 119 | """Check if query is a dict and 120 | use the multiquery method 121 | else use single query 122 | """ 123 | if not isinstance(query, basestring): 124 | args["queries"] = query 125 | fql_method = 'fql.multiquery' 126 | else: 127 | args["query"] = query 128 | fql_method = 'fql.query' 129 | 130 | args["format"] = "json" 131 | 132 | try: 133 | file = urllib2.urlopen("https://api.facebook.com/method/" + 134 | fql_method + "?" + urllib.urlencode(args), 135 | post_data, timeout=self.timeout) 136 | except TypeError: 137 | # Timeout support for Python <2.6 138 | if self.timeout: 139 | socket.setdefaulttimeout(self.timeout) 140 | file = urllib2.urlopen("https://api.facebook.com/method/" + 141 | fql_method + "?" + urllib.urlencode(args), 142 | post_data) 143 | 144 | try: 145 | content = file.read() 146 | response = _parse_json(content) 147 | #Return a list if success, return a dictionary if failed 148 | if type(response) is dict and "error_code" in response: 149 | raise GraphAPIError(response) 150 | except (Exception, e): 151 | raise e 152 | finally: 153 | file.close() 154 | 155 | return response 156 | def extend_access_token(self, app_id, app_secret): 157 | """ 158 | Extends the expiration time of a valid OAuth access token. See 159 | 161 | 162 | """ 163 | args = { 164 | "client_id": app_id, 165 | "client_secret": app_secret, 166 | "grant_type": "fb_exchange_token", 167 | "fb_exchange_token": self.access_token, 168 | } 169 | response = urllib2.urlopen("https://graph.facebook.com/oauth/" 170 | "access_token?" + 171 | urllib.parse.urlencode(args)).read().decode('utf-8') 172 | query_str = parse_qs(response) 173 | if "access_token" in query_str: 174 | result = {"accesstoken": query_str["access_token"][0]} 175 | if "expires" in query_str: 176 | result["expire"] = query_str["expires"][0] 177 | return result 178 | else: 179 | response = json.loads(response) 180 | raise GraphAPIError(response) 181 | 182 | 183 | class GraphAPIError(Exception): 184 | def __init__(self, result): 185 | #Exception.__init__(self, message) 186 | #self.type = type 187 | self.result = result 188 | try: 189 | self.type = result["error_code"] 190 | except: 191 | self.type = "" 192 | 193 | # OAuth 2.0 Draft 10 194 | try: 195 | self.message = result["error_description"] 196 | except: 197 | # OAuth 2.0 Draft 00 198 | try: 199 | self.message = result["error"]["message"] 200 | except: 201 | # REST server style 202 | try: 203 | self.message = result["error_msg"] 204 | except: 205 | self.message = result 206 | 207 | Exception.__init__(self, self.message) 208 | 209 | 210 | def get_user_from_cookie(cookies, app_id, app_secret): 211 | 212 | cookie = cookies.get("fbsr_" + app_id, "") 213 | if not cookie: 214 | return None 215 | parsed_request = parse_signed_request(cookie, app_secret) 216 | if not parsed_request: 217 | return None 218 | try: 219 | result = get_access_token_from_code(parsed_request["code"], "",app_id, app_secret) 220 | except GraphAPIError: 221 | return None 222 | result["uid"] = parsed_request["user_id"] 223 | return result 224 | 225 | 226 | def parse_signed_request(signed_request, app_secret): 227 | 228 | try: 229 | l = signed_request.split('.', 2) 230 | encoded_sig = str(l[0]) 231 | payload = str(l[1]) 232 | sig = base64.urlsafe_b64decode(encoded_sig + "=" * 233 | ((4 - len(encoded_sig) % 4) % 4)) 234 | data = base64.urlsafe_b64decode(payload + "=" * 235 | ((4 - len(payload) % 4) % 4)) 236 | except IndexError: 237 | # Signed request was malformed. 238 | return False 239 | except TypeError: 240 | # Signed request had a corrupted payload. 241 | return False 242 | 243 | data = _parse_json(data) 244 | if data.get('algorithm', '').upper() != 'HMAC-SHA256': 245 | return False 246 | 247 | # HMAC can only handle ascii (byte) strings 248 | # http://bugs.python.org/issue5285 249 | app_secret = app_secret.encode('ascii') 250 | payload = payload.encode('ascii') 251 | 252 | expected_sig = hmac.new(app_secret, 253 | msg=payload, 254 | digestmod=hashlib.sha256).digest() 255 | if sig != expected_sig: 256 | return False 257 | 258 | return data 259 | 260 | def get_app_access_token(app_id, app_secret): 261 | 262 | # Get an app access token 263 | args = {'grant_type': 'client_credentials', 264 | 'client_id': app_id, 265 | 'client_secret': app_secret} 266 | 267 | file = urllib2.urlopen("https://graph.facebook.com/oauth/access_token?" + 268 | urllib.urlencode(args)) 269 | 270 | try: 271 | result = file.read().split("=")[1] 272 | finally: 273 | file.close() 274 | 275 | return result 276 | 277 | 278 | def get_access_token_from_code(code, redirect_uri, app_id, app_secret): 279 | 280 | args = { 281 | "code": code, 282 | "redirect_uri": redirect_uri, 283 | "client_id": app_id, 284 | "client_secret": app_secret, 285 | } 286 | # We would use GraphAPI.request() here, except for that the fact 287 | # that the response is a key-value pair, and not JSON. 288 | response = urllib2.urlopen("https://graph.facebook.com/oauth/access_token" + 289 | "?" + urllib.parse.urlencode(args)).read().decode('utf-8') 290 | query_str = parse_qs(response) 291 | if "access_token" in query_str: 292 | result = {"access_token": query_str["access_token"][0]} 293 | if "expires" in query_str: 294 | result["expires"] = query_str["expires"][0] 295 | return result 296 | else: 297 | jsonResponse = json.loads(str(response)) 298 | # response = json.loads(response) 299 | encoding = response.info().get_content_charset('utf8') 300 | data = json.loads(response.read().decode(encoding)) 301 | return data 302 | 303 | 304 | def get_app_access_token(app_id, app_secret): 305 | 306 | # Get an app access token 307 | args = {'grant_type': 'client_credentials', 308 | 'client_id': app_id, 309 | 'client_secret': app_secret} 310 | 311 | file = urllib2.urlopen("https://graph.facebook.com/oauth/access_token?" + 312 | urllib.parse.urlencode(args)) 313 | 314 | try: 315 | result = file.read().decode('utf-8').split("=")[1] 316 | finally: 317 | file.close() 318 | 319 | return result 320 | 321 | 322 | def auth_url(app_id, canvas_url, perms=None, **kwargs): 323 | url = "https://www.facebook.com/dialog/oauth?" 324 | kvps = {'client_id': app_id, 'redirect_uri': canvas_url} 325 | if perms: 326 | kvps['scope'] = ",".join(perms) 327 | kvps.update(kwargs) 328 | return url + urllib.parse.urlencode(kvps) 329 | -------------------------------------------------------------------------------- /django_simple_forum/forms.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.forms import AuthenticationForm 2 | try: 3 | from django.contrib.auth import get_user_model 4 | User = get_user_model() 5 | except ImportError: 6 | from django.contrib.auth.models import User 7 | from django import forms 8 | from .models import ForumCategory, Badge, Topic, Comment, UserProfile 9 | from django.template.defaultfilters import slugify 10 | 11 | 12 | class LoginForm(AuthenticationForm): 13 | 14 | def clean_username(self): 15 | email = self.cleaned_data['username'] 16 | user = User.objects.filter(email=email) 17 | if not user: 18 | raise forms.ValidationError('Email is not registered.') 19 | elif not user[0].is_active: 20 | raise forms.ValidationError('Your account is not activated yet!') 21 | return email 22 | 23 | 24 | class RegisterForm(forms.ModelForm): 25 | 26 | class Meta: 27 | model = User 28 | fields = ['email', 'first_name', 'username', 'password'] 29 | 30 | 31 | class CategoryForm(forms.ModelForm): 32 | class Meta: 33 | model = ForumCategory 34 | exclude = ('slug', 'created_by') 35 | 36 | def clean_title(self): 37 | if ForumCategory.objects.filter(slug=slugify(self.cleaned_data['title'])).exclude(id=self.instance.id): 38 | raise forms.ValidationError('Category with this Name already exists.') 39 | 40 | return self.cleaned_data['title'] 41 | 42 | def __init__(self, *args, **kwargs): 43 | self.user = kwargs.pop('user', None) 44 | super(CategoryForm, self).__init__(*args, **kwargs) 45 | 46 | def save(self, commit=True): 47 | instance = super(CategoryForm, self).save(commit=False) 48 | instance.created_by = self.user 49 | instance.title = self.cleaned_data['title'] 50 | if str(self.cleaned_data['is_votable']) == 'True': 51 | instance.is_votable = True 52 | else: 53 | instance.is_votable = False 54 | if str(self.cleaned_data['is_active']) == 'True': 55 | instance.is_active = True 56 | else: 57 | instance.is_active = False 58 | if not self.instance.id: 59 | instance.slug = slugify(self.cleaned_data['title']) 60 | 61 | if commit: 62 | instance.save() 63 | return instance 64 | 65 | 66 | class BadgeForm(forms.ModelForm): 67 | class Meta: 68 | model = Badge 69 | exclude = ('slug',) 70 | 71 | def clean_title(self): 72 | if Badge.objects.filter(slug=slugify(self.cleaned_data['title'])).exclude(id=self.instance.id): 73 | raise forms.ValidationError('Badge with this Name already exists.') 74 | 75 | return self.cleaned_data['title'] 76 | 77 | def __init__(self, *args, **kwargs): 78 | self.user = kwargs.pop('user', None) 79 | super(BadgeForm, self).__init__(*args, **kwargs) 80 | 81 | def save(self, commit=True): 82 | instance = super(BadgeForm, self).save(commit=False) 83 | instance.title = self.cleaned_data['title'] 84 | if not self.instance.id: 85 | instance.slug = slugify(self.cleaned_data['title']) 86 | if commit: 87 | instance.save() 88 | return instance 89 | 90 | 91 | class TopicForm(forms.ModelForm): 92 | 93 | def __init__(self, *args, **kwargs): 94 | self.user = kwargs.pop('user', None) 95 | super(TopicForm, self).__init__(*args, **kwargs) 96 | self.fields["category"].widget.attrs = {"class": "form-control select2"} 97 | self.fields["title"].widget.attrs = {"class": "form-control"} 98 | self.fields["tags"].widget.attrs = {"class": "form-control tags"} 99 | 100 | tags = forms.CharField(required=False) 101 | 102 | class Meta: 103 | model = Topic 104 | fields = ("title", "category", "description", "tags") 105 | 106 | def clean_title(self): 107 | if Topic.objects.filter(slug=slugify(self.cleaned_data['title'])).exclude(id=self.instance.id): 108 | raise forms.ValidationError('Topic with this Name already exists.') 109 | 110 | return self.cleaned_data['title'] 111 | 112 | 113 | def save(self, commit=True): 114 | instance = super(TopicForm, self).save(commit=False) 115 | instance.title = self.cleaned_data['title'] 116 | instance.description = self.cleaned_data['description'] 117 | instance.category = self.cleaned_data['category'] 118 | if not self.instance.id: 119 | instance.slug = slugify(self.cleaned_data['title']) 120 | instance.created_by = self.user 121 | instance.status = 'Draft' 122 | if commit: 123 | instance.save() 124 | return instance 125 | 126 | 127 | class CommentForm(forms.ModelForm): 128 | 129 | class Meta: 130 | model = Comment 131 | fields = ('comment', 'topic') 132 | 133 | def clean_comment(self): 134 | if self.cleaned_data['comment']: 135 | return self.cleaned_data['comment'] 136 | raise forms.ValidationError('This field is required') 137 | 138 | def __init__(self, *args, **kwargs): 139 | self.user = kwargs.pop('user', None) 140 | super(CommentForm, self).__init__(*args, **kwargs) 141 | 142 | def save(self, commit=True): 143 | instance = super(CommentForm, self).save(commit=False) 144 | instance.comment = self.cleaned_data['comment'] 145 | instance.topic = self.cleaned_data['topic'] 146 | if not self.instance.id: 147 | instance.commented_by = self.user 148 | if 'parent' in self.cleaned_data.keys() and self.cleaned_data['parent']: 149 | instance.parent = self.cleaned_data['parent'] 150 | if commit: 151 | instance.save() 152 | return instance 153 | 154 | 155 | class UserProfileForm(forms.ModelForm): 156 | 157 | class Meta: 158 | model = UserProfile 159 | fields = ['badges'] 160 | 161 | 162 | class ChangePasswordForm(forms.Form): 163 | oldpassword = forms.CharField(max_length=50) 164 | newpassword = forms.CharField(max_length=50) 165 | retypepassword = forms.CharField(max_length=50) 166 | 167 | 168 | class UserChangePasswordForm(forms.Form): 169 | newpassword = forms.CharField(max_length=50) 170 | retypepassword = forms.CharField(max_length=50) 171 | 172 | 173 | class ForgotPasswordForm(forms.Form): 174 | email = forms.CharField(max_length=200) 175 | 176 | def clean_username(self): 177 | user = UserProfile.objects.filter(user__email=self.data.get("email")) 178 | if user: 179 | return self.data.get("email") 180 | else: 181 | raise forms.ValidationError( 182 | "User with this email ID doesn't exists.") 183 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-05-20 10:46 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | initial = True 13 | 14 | dependencies = [ 15 | ('contenttypes', '0002_remove_content_type_name'), 16 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 17 | ] 18 | 19 | operations = [ 20 | migrations.CreateModel( 21 | name='Badge', 22 | fields=[ 23 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 24 | ('title', models.CharField(max_length=50, unique=True)), 25 | ('slug', models.CharField(max_length=50, unique=True)), 26 | ], 27 | ), 28 | migrations.CreateModel( 29 | name='Comment', 30 | fields=[ 31 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 32 | ('comment', models.TextField(blank=True, null=True)), 33 | ('created_on', models.DateTimeField(auto_now_add=True)), 34 | ('updated_on', models.DateTimeField(auto_now_add=True)), 35 | ('commented_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='commented_by', to=settings.AUTH_USER_MODEL)), 36 | ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='comment_parent', to='django_simple_forum.Comment')), 37 | ], 38 | ), 39 | migrations.CreateModel( 40 | name='ForumCategory', 41 | fields=[ 42 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 43 | ('title', models.CharField(max_length=1000)), 44 | ('is_active', models.BooleanField(default=False)), 45 | ('color', models.CharField(default='#999999', max_length=20)), 46 | ('is_votable', models.BooleanField(default=False)), 47 | ('created_on', models.DateTimeField(auto_now_add=True)), 48 | ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 49 | ], 50 | ), 51 | migrations.CreateModel( 52 | name='Tags', 53 | fields=[ 54 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 55 | ('title', models.CharField(max_length=50, unique=True)), 56 | ('slug', models.CharField(max_length=50, unique=True)), 57 | ], 58 | ), 59 | migrations.CreateModel( 60 | name='Timeline', 61 | fields=[ 62 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 63 | ('object_id', models.PositiveIntegerField()), 64 | ('namespace', models.CharField(db_index=True, default='default', max_length=250)), 65 | ('event_type', models.CharField(db_index=True, max_length=250)), 66 | ('data', models.TextField(blank=True, null=True)), 67 | ('created_on', models.DateTimeField(auto_now_add=True)), 68 | ('is_read', models.BooleanField(default=False)), 69 | ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='content_type_timelines', to='contenttypes.ContentType')), 70 | ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 71 | ], 72 | options={ 73 | 'ordering': ['-created_on'], 74 | }, 75 | ), 76 | migrations.CreateModel( 77 | name='Topic', 78 | fields=[ 79 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 80 | ('title', models.CharField(max_length=2000)), 81 | ('description', models.TextField()), 82 | ('status', models.CharField(choices=[('Draft', 'Draft'), ('Published', 'Published'), ('Disabled', 'Disabled')], max_length=10)), 83 | ('created_on', models.DateTimeField(auto_now=True)), 84 | ('updated_on', models.DateTimeField(auto_now=True)), 85 | ('no_of_views', models.IntegerField(default='0')), 86 | ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_simple_forum.ForumCategory')), 87 | ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 88 | ], 89 | ), 90 | migrations.CreateModel( 91 | name='UserProfile', 92 | fields=[ 93 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 94 | ('used_votes', models.IntegerField(default='0')), 95 | ('user_roles', models.CharField(choices=[('Admin', 'Admin'), ('Publisher', 'Publisher')], max_length=10)), 96 | ('badges', models.ManyToManyField(to='django_simple_forum.Badge')), 97 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 98 | ], 99 | ), 100 | migrations.CreateModel( 101 | name='UserTopics', 102 | fields=[ 103 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 104 | ('is_followed', models.BooleanField(default=False)), 105 | ('followed_on', models.DateField(blank=True, null=True)), 106 | ('no_of_votes', models.IntegerField(default='0')), 107 | ('is_like', models.BooleanField(default=False)), 108 | ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_simple_forum.Topic')), 109 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 110 | ], 111 | ), 112 | migrations.AddField( 113 | model_name='comment', 114 | name='topic', 115 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_comments', to='django_simple_forum.Topic'), 116 | ), 117 | migrations.AlterIndexTogether( 118 | name='timeline', 119 | index_together=set([('content_type', 'object_id', 'namespace')]), 120 | ), 121 | ] 122 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0002_auto_20160628_1211.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-06-28 12:11 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('django_simple_forum', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='forumcategory', 17 | name='slug', 18 | field=models.SlugField(default='test', max_length=1000), 19 | preserve_default=False, 20 | ), 21 | migrations.AddField( 22 | model_name='topic', 23 | name='slug', 24 | field=models.SlugField(default='test', max_length=1000), 25 | preserve_default=False, 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0003_topic_tags.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-05 14:11 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('django_simple_forum', '0002_auto_20160628_1211'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='topic', 17 | name='tags', 18 | field=models.ManyToManyField(to='django_simple_forum.Tags'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0004_topic_no_of_likes.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-06 05:53 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('django_simple_forum', '0003_topic_tags'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='topic', 17 | name='no_of_likes', 18 | field=models.IntegerField(default='0'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0005_attachment.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-06 09:12 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | import django_simple_forum.models 9 | 10 | 11 | class Migration(migrations.Migration): 12 | 13 | dependencies = [ 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 15 | ('django_simple_forum', '0004_topic_no_of_likes'), 16 | ] 17 | 18 | operations = [ 19 | migrations.CreateModel( 20 | name='Attachment', 21 | fields=[ 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 23 | ('created_on', models.DateTimeField(auto_now_add=True)), 24 | ('attached_file', models.FileField(blank=True, max_length=500, null=True, upload_to=django_simple_forum.models.img_url)), 25 | ('comment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_simple_forum.Comment')), 26 | ('uploaded_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments_user', to=settings.AUTH_USER_MODEL)), 27 | ], 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0006_forumcategory_description.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-07 06:27 3 | from __future__ import unicode_literals 4 | 5 | import datetime 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('django_simple_forum', '0005_attachment'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='forumcategory', 18 | name='description', 19 | field=models.TextField(default=datetime.datetime(2016, 7, 7, 6, 27, 51, 32010)), 20 | preserve_default=False, 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0007_topic_no_of_votes.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-07 08:32 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('django_simple_forum', '0006_forumcategory_description'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='topic', 17 | name='no_of_votes', 18 | field=models.IntegerField(default='0'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0008_auto_20160707_1311.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-07 13:11 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('django_simple_forum', '0007_topic_no_of_votes'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='topic', 17 | name='no_of_down_votes', 18 | field=models.IntegerField(default='0'), 19 | ), 20 | migrations.AddField( 21 | model_name='usertopics', 22 | name='no_of_down_votes', 23 | field=models.IntegerField(default='0'), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0009_userprofile_profile_pic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-07-21 10:25 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django_simple_forum.models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('django_simple_forum', '0008_auto_20160707_1311'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='userprofile', 18 | name='profile_pic', 19 | field=models.FileField(blank=True, max_length=500, null=True, upload_to=django_simple_forum.models.img_url), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0010_forumcategory_parent.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-08-18 13:17 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('django_simple_forum', '0009_userprofile_profile_pic'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='forumcategory', 18 | name='parent', 19 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_simple_forum.ForumCategory'), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0011_facebook_github_google_twitter.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-08-19 10:24 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('django_simple_forum', '0010_forumcategory_parent'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Facebook', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('facebook_id', models.CharField(max_length=100)), 23 | ('facebook_url', models.CharField(default='', max_length=200)), 24 | ('first_name', models.CharField(default='', max_length=200)), 25 | ('last_name', models.CharField(default='', max_length=200)), 26 | ('verified', models.CharField(default='', max_length=200)), 27 | ('name', models.CharField(default='', max_length=200)), 28 | ('language', models.CharField(default='', max_length=200)), 29 | ('hometown', models.CharField(default='', max_length=200)), 30 | ('email', models.CharField(db_index=True, default='', max_length=200)), 31 | ('gender', models.CharField(default='', max_length=200)), 32 | ('dob', models.DateField(blank=True, null=True)), 33 | ('location', models.CharField(default='', max_length=200)), 34 | ('timezone', models.CharField(default='', max_length=200)), 35 | ('accesstoken', models.CharField(default='', max_length=2000)), 36 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_facebook', to=settings.AUTH_USER_MODEL)), 37 | ], 38 | ), 39 | migrations.CreateModel( 40 | name='GitHub', 41 | fields=[ 42 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 43 | ('git_url', models.URLField()), 44 | ('git_id', models.CharField(max_length=50)), 45 | ('disk_usage', models.CharField(max_length=200)), 46 | ('private_gists', models.IntegerField(default=0)), 47 | ('public_gists', models.IntegerField(default=0)), 48 | ('public_repos', models.IntegerField(default=0)), 49 | ('hireable', models.BooleanField(default=False)), 50 | ('total_private_repos', models.IntegerField(default=0)), 51 | ('owned_private_repos', models.IntegerField(default=0)), 52 | ('following', models.IntegerField(default=0)), 53 | ('followers', models.IntegerField(default=0)), 54 | ('company', models.CharField(max_length=200)), 55 | ('name', models.CharField(max_length=200)), 56 | ('user_from', models.DateTimeField()), 57 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_github', to=settings.AUTH_USER_MODEL)), 58 | ], 59 | ), 60 | migrations.CreateModel( 61 | name='Google', 62 | fields=[ 63 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 64 | ('google_id', models.CharField(default='', max_length=200)), 65 | ('google_url', models.CharField(default='', max_length=1000)), 66 | ('verified_email', models.CharField(default='', max_length=200)), 67 | ('family_name', models.CharField(default='', max_length=200)), 68 | ('name', models.CharField(default='', max_length=200)), 69 | ('picture', models.CharField(default='', max_length=200)), 70 | ('gender', models.CharField(default='', max_length=10)), 71 | ('dob', models.CharField(default='', max_length=50)), 72 | ('given_name', models.CharField(default='', max_length=200)), 73 | ('email', models.CharField(db_index=True, default='', max_length=200)), 74 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_google', to=settings.AUTH_USER_MODEL)), 75 | ], 76 | ), 77 | migrations.CreateModel( 78 | name='Twitter', 79 | fields=[ 80 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 81 | ('twitter_id', models.CharField(default='', max_length=100)), 82 | ('screen_name', models.CharField(default='', max_length=100)), 83 | ('oauth_token', models.CharField(default='', max_length=200)), 84 | ('oauth_secret', models.CharField(default='', max_length=200)), 85 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_twitter', to=settings.AUTH_USER_MODEL)), 86 | ], 87 | ), 88 | ] 89 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0012_comment_mentioned.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-08-29 12:13 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 13 | ('django_simple_forum', '0011_facebook_github_google_twitter'), 14 | ] 15 | 16 | operations = [ 17 | migrations.AddField( 18 | model_name='comment', 19 | name='mentioned', 20 | field=models.ManyToManyField(related_name='mentioned_users', to=settings.AUTH_USER_MODEL), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0013_userprofile_send_mailnotifications.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.6 on 2016-08-30 07:24 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('django_simple_forum', '0012_comment_mentioned'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='userprofile', 17 | name='send_mailnotifications', 18 | field=models.BooleanField(default=False), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/0014_auto_20170208_0550.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.9.7 on 2017-02-08 05:50 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('django_simple_forum', '0013_userprofile_send_mailnotifications'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Vote', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('type', models.CharField(choices=[('U', 'Up'), ('D', 'Down')], max_length=1)), 23 | ('created_on', models.DateTimeField(auto_now_add=True)), 24 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 25 | ], 26 | ), 27 | migrations.RemoveField( 28 | model_name='topic', 29 | name='no_of_down_votes', 30 | ), 31 | migrations.RemoveField( 32 | model_name='topic', 33 | name='no_of_votes', 34 | ), 35 | migrations.AddField( 36 | model_name='comment', 37 | name='votes', 38 | field=models.ManyToManyField(to='django_simple_forum.Vote'), 39 | ), 40 | migrations.AddField( 41 | model_name='topic', 42 | name='votes', 43 | field=models.ManyToManyField(to='django_simple_forum.Vote'), 44 | ), 45 | ] 46 | -------------------------------------------------------------------------------- /django_simple_forum/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicroPyramid/django-simple-forum/13ad478a7680df8e2aa466485f0abbaf7fa059db/django_simple_forum/migrations/__init__.py -------------------------------------------------------------------------------- /django_simple_forum/mixins.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import redirect, get_object_or_404 2 | from django.core.urlresolvers import reverse 3 | from django.contrib.auth import logout 4 | from django_simple_forum.models import Topic 5 | 6 | 7 | class AdminMixin(object): 8 | 9 | def dispatch(self, request, *args, **kwargs): 10 | user = self.request.user 11 | if not user.is_superuser: 12 | return redirect(reverse('django_simple_forum:topic_list')) 13 | return super(AdminMixin, self).dispatch(request, *args, **kwargs) 14 | 15 | 16 | class CanUpdateTopicMixin(object): 17 | 18 | def dispatch(self, request, *args, **kwargs): 19 | user = self.request.user 20 | if user.is_anonymous(): 21 | return redirect(reverse("django_simple_forum:topic_list")) 22 | pk = kwargs.get("slug") 23 | self.object = get_object_or_404(Topic, slug=pk) 24 | if request.user != self.object.created_by and not request.user.is_staff: 25 | return redirect(reverse("django_simple_forum:topic_list")) 26 | return super(CanUpdateTopicMixin, self).dispatch(request, *args, **kwargs) 27 | 28 | 29 | class LoginRequiredMixin(object): 30 | 31 | def dispatch(self, request, *args, **kwargs): 32 | user = self.request.user 33 | if user.is_authenticated(): 34 | if user.is_active: 35 | return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs) 36 | else: 37 | logout(self.request) 38 | return redirect(reverse('django_simple_forum:topic_list')) 39 | -------------------------------------------------------------------------------- /django_simple_forum/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.conf import settings 3 | from django.contrib.contenttypes.models import ContentType 4 | from django.contrib.contenttypes.fields import GenericForeignKey 5 | import hashlib 6 | from datetime import datetime 7 | 8 | STATUS = ( 9 | ('Draft', 'Draft'), 10 | ('Published', 'Published'), 11 | ('Disabled', 'Disabled'), 12 | ) 13 | 14 | USER_ROLES = ( 15 | ('Admin', 'Admin'), 16 | ('Publisher', 'Publisher'), 17 | ) 18 | 19 | User = settings.AUTH_USER_MODEL 20 | 21 | 22 | # tags created for topic 23 | class Tags(models.Model): 24 | title = models.CharField(max_length=50, unique=True) 25 | slug = models.CharField(max_length=50, unique=True) 26 | 27 | def get_topics(self): 28 | topics = Topic.objects.filter(tags__in=[self], status='Published') 29 | return topics 30 | 31 | 32 | # tags created for topic 33 | class Badge(models.Model): 34 | title = models.CharField(max_length=50, unique=True) 35 | slug = models.CharField(max_length=50, unique=True) 36 | 37 | def get_users(self): 38 | user_profile = UserProfile.objects.filter(badges__in=[self]) 39 | return user_profile 40 | 41 | 42 | def img_url(self, filename): 43 | hash_ = hashlib.md5() 44 | hash_.update( 45 | str(filename).encode('utf-8') + str(datetime.now()).encode('utf-8')) 46 | file_hash = hash_.hexdigest() 47 | return "%s%s/%s" % (self.file_prepend, file_hash, filename) 48 | 49 | 50 | # user profile to store no of votes available to user, badges for a topic, user roles, 51 | class UserProfile(models.Model): 52 | file_prepend = "forum_user/profilepics/" 53 | 54 | user = models.ForeignKey(User) 55 | used_votes = models.IntegerField(default='0') 56 | user_roles = models.CharField(choices=USER_ROLES, max_length=10) 57 | badges = models.ManyToManyField(Badge) 58 | profile_pic = models.FileField( 59 | max_length=500, null=True, blank=True, upload_to=img_url) 60 | send_mailnotifications = models.BooleanField(default=False) 61 | 62 | # need to add social details for a user if we implement socail login 63 | 64 | def get_no_of_up_votes(self): 65 | user_topics = UserTopics.objects.filter(user=self.user) 66 | votes = 0 67 | for topic in user_topics: 68 | votes += topic.no_of_votes 69 | return votes 70 | 71 | def get_no_of_down_votes(self): 72 | user_topics = UserTopics.objects.filter(user=self.user) 73 | votes = 0 74 | for topic in user_topics: 75 | votes += topic.no_of_down_votes 76 | return votes 77 | 78 | def get_topics(self): 79 | topics = Topic.objects.filter(created_by=self.user) 80 | return topics 81 | 82 | def get_followed_topics(self): 83 | topics = UserTopics.objects.filter(user=self.user, is_followed=True) 84 | topics = Topic.objects.filter(id__in=topics.values_list('topic', flat=True)) 85 | return topics 86 | 87 | def get_liked_topics(self): 88 | topics = UserTopics.objects.filter(user=self.user, is_like=True) 89 | topics = Topic.objects.filter(id__in=topics.values_list('topic', flat=True)) 90 | return topics 91 | 92 | def get_timeline(self): 93 | timeline = Timeline.objects.filter(user=self.user).order_by('-created_on') 94 | return timeline 95 | 96 | def get_user_topic_tags(self): 97 | tags = Tags.objects.filter(id__in=self.get_topics().values_list('tags', flat=True)) 98 | return tags 99 | 100 | def get_user_topic_categories(self): 101 | categories = ForumCategory.objects.filter(id__in=self.get_topics().values_list('category', flat=True)) 102 | return categories 103 | # return [] 104 | 105 | def get_user_suggested_topics(self): 106 | categories = ForumCategory.objects.filter(id__in=self.get_topics().values_list('category', flat=True)) 107 | topics = Topic.objects.filter(category__id__in=categories.values_list('id', flat=True)) 108 | return topics 109 | # return [] 110 | 111 | 112 | class ForumCategory(models.Model): 113 | created_by = models.ForeignKey(User) 114 | title = models.CharField(max_length=1000) 115 | is_active = models.BooleanField(default=False) 116 | color = models.CharField(max_length=20, default="#999999") 117 | is_votable = models.BooleanField(default=False) 118 | created_on = models.DateTimeField(auto_now_add=True) 119 | slug = models.SlugField(max_length=1000) 120 | description = models.TextField() 121 | parent = models.ForeignKey('self', blank=True, null=True) 122 | 123 | def get_topics(self): 124 | topics = Topic.objects.filter(category=self, status='Published') 125 | return topics 126 | 127 | def __str__(self): 128 | return self.title 129 | 130 | 131 | class Vote(models.Model): 132 | TYPES = ( 133 | ("U", "Up"), 134 | ("D", "Down"), 135 | ) 136 | user = models.ForeignKey(User) 137 | type = models.CharField(choices=TYPES, max_length=1) 138 | created_on = models.DateTimeField(auto_now_add=True) 139 | 140 | def __str__(self): 141 | return self.user 142 | 143 | class Topic(models.Model): 144 | title = models.CharField(max_length=2000) 145 | description = models.TextField() 146 | created_by = models.ForeignKey(User) 147 | status = models.CharField(choices=STATUS, max_length=10) 148 | category = models.ForeignKey(ForumCategory) 149 | created_on = models.DateTimeField(auto_now=True) 150 | updated_on = models.DateTimeField(auto_now=True) 151 | no_of_views = models.IntegerField(default='0') 152 | slug = models.SlugField(max_length=1000) 153 | tags = models.ManyToManyField(Tags) 154 | no_of_likes = models.IntegerField(default='0') 155 | votes = models.ManyToManyField(Vote) 156 | 157 | def get_comments(self): 158 | comments = Comment.objects.filter(topic=self, parent=None) 159 | return comments 160 | 161 | def get_all_comments(self): 162 | comments = Comment.objects.filter(topic=self) 163 | return comments 164 | 165 | def get_last_comment(self): 166 | comments = Comment.objects.filter(topic=self).order_by('-updated_on').first() 167 | return comments 168 | 169 | def get_topic_users(self): 170 | comment_user_ids = Comment.objects.filter(topic=self).values_list('commented_by', flat=True) 171 | liked_users_ids = UserTopics.objects.filter(topic=self, is_like=True).values_list('user', flat=True) 172 | followed_users = UserTopics.objects.filter(topic=self, is_followed=True).values_list('user', flat=True) 173 | all_users = list(comment_user_ids) + list(liked_users_ids) + list(followed_users) + [self.created_by.id] 174 | users = UserProfile.objects.filter(user_id__in=set(all_users)) 175 | return users 176 | 177 | # def get_total_of_votes(self): 178 | # no_of_votes = self.no_of_votes + self.no_of_down_votes 179 | # return no_of_votes 180 | 181 | def up_votes_count(self): 182 | return self.votes.filter(type="U").count() 183 | 184 | def down_votes_count(self): 185 | return self.votes.filter(type="D").count() 186 | 187 | def __str__(self): 188 | return self.title 189 | 190 | # user followed topics 191 | class UserTopics(models.Model): 192 | user = models.ForeignKey(User) 193 | topic = models.ForeignKey(Topic) 194 | is_followed = models.BooleanField(default=False) 195 | followed_on = models.DateField(null=True, blank=True) 196 | no_of_votes = models.IntegerField(default='0') 197 | no_of_down_votes = models.IntegerField(default='0') 198 | is_like = models.BooleanField(default=False) 199 | 200 | 201 | class Comment(models.Model): 202 | comment = models.TextField(null=True, blank=True) 203 | commented_by = models.ForeignKey(User, related_name="commented_by") 204 | topic = models.ForeignKey(Topic, related_name="topic_comments") 205 | created_on = models.DateTimeField(auto_now_add=True) 206 | updated_on = models.DateTimeField(auto_now_add=True) 207 | parent = models.ForeignKey("self", blank=True, null=True, related_name="comment_parent") 208 | mentioned = models.ManyToManyField(User, related_name="mentioned_users") 209 | votes = models.ManyToManyField(Vote) 210 | 211 | def get_comments(self): 212 | comments = self.comment_parent.all() 213 | return comments 214 | 215 | def up_votes_count(self): 216 | return self.votes.filter(type="U").count() 217 | 218 | def down_votes_count(self): 219 | return self.votes.filter(type="D").count() 220 | 221 | 222 | # user activity 223 | class Timeline(models.Model): 224 | content_type = models.ForeignKey(ContentType, related_name="content_type_timelines") 225 | object_id = models.PositiveIntegerField() 226 | content_object = GenericForeignKey("content_type", "object_id") 227 | namespace = models.CharField(max_length=250, default="default", db_index=True) 228 | event_type = models.CharField(max_length=250, db_index=True) 229 | user = models.ForeignKey(User, null=True) 230 | data = models.TextField(null=True, blank=True) 231 | created_on = models.DateTimeField(auto_now_add=True) 232 | is_read = models.BooleanField(default=False) 233 | 234 | class Meta: 235 | index_together = [("content_type", "object_id", "namespace"), ] 236 | ordering = ['-created_on'] 237 | 238 | 239 | class Attachment(models.Model): 240 | file_prepend = "forum_topic/attachments/" 241 | uploaded_by = models.ForeignKey(User, related_name='attachments_user') 242 | created_on = models.DateTimeField(auto_now_add=True) 243 | attached_file = models.FileField( 244 | max_length=500, null=True, blank=True, upload_to=img_url) 245 | comment = models.ForeignKey(Comment) 246 | 247 | 248 | class Facebook(models.Model): 249 | user = models.ForeignKey(User, related_name='user_facebook') 250 | facebook_id = models.CharField(max_length=100) 251 | facebook_url = models.CharField(max_length=200, default='') 252 | first_name = models.CharField(max_length=200, default='') 253 | last_name = models.CharField(max_length=200, default='') 254 | verified = models.CharField(max_length=200, default='') 255 | name = models.CharField(max_length=200, default='') 256 | language = models.CharField(max_length=200, default='') 257 | hometown = models.CharField(max_length=200, default='') 258 | email = models.CharField(max_length=200, default='', db_index=True) 259 | gender = models.CharField(max_length=200, default='') 260 | dob = models.DateField(null=True, blank=True) 261 | location = models.CharField(max_length=200, default='') 262 | timezone = models.CharField(max_length=200, default='') 263 | accesstoken = models.CharField(max_length=2000, default='') 264 | 265 | 266 | class Google(models.Model): 267 | user = models.ForeignKey(User, related_name='user_google') 268 | google_id = models.CharField(max_length=200, default='') 269 | google_url = models.CharField(max_length=1000, default='') 270 | verified_email = models.CharField(max_length=200, default='') 271 | family_name = models.CharField(max_length=200, default='') 272 | name = models.CharField(max_length=200, default='') 273 | picture = models.CharField(max_length=200, default='') 274 | gender = models.CharField(max_length=10, default='') 275 | dob = models.CharField(max_length=50, default='') 276 | given_name = models.CharField(max_length=200, default='') 277 | email = models.CharField(max_length=200, default='', db_index=True) 278 | 279 | 280 | class GitHub(models.Model): 281 | user = models.ForeignKey(User, related_name='user_github') 282 | git_url = models.URLField() 283 | git_id = models.CharField(max_length=50) 284 | disk_usage = models.CharField(max_length=200) 285 | private_gists = models.IntegerField(default=0) 286 | public_gists = models.IntegerField(default=0) 287 | public_repos = models.IntegerField(default=0) 288 | hireable = models.BooleanField(default=False) 289 | total_private_repos = models.IntegerField(default=0) 290 | owned_private_repos = models.IntegerField(default=0) 291 | following = models.IntegerField(default=0) 292 | followers = models.IntegerField(default=0) 293 | company = models.CharField(max_length=200) 294 | name = models.CharField(max_length=200) 295 | user_from = models.DateTimeField() 296 | 297 | 298 | class Twitter(models.Model): 299 | user = models.ForeignKey(User, related_name='user_twitter') 300 | twitter_id = models.CharField(max_length=100, default='') 301 | screen_name = models.CharField(max_length=100, default='') 302 | oauth_token = models.CharField(max_length=200, default='') 303 | oauth_secret = models.CharField(max_length=200, default='') 304 | -------------------------------------------------------------------------------- /django_simple_forum/sending_mail.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | import boto.ses 3 | import sendgrid 4 | import requests 5 | from django.core.mail import EmailMultiAlternatives 6 | from django_ses_gateway.sending_mail import sending_mail 7 | 8 | 9 | def Memail(mto, mfrom, msubject, mbody, email_template_name, context): 10 | if settings.MAIL_SENDER == 'AMAZON': 11 | sending_mail(msubject, email_template_name, context, mfrom, mto) 12 | elif settings.MAIL_SENDER == 'MAILGUN': 13 | requests.post( 14 | settings.MGUN_API_URL, 15 | auth=('api', settings.MGUN_API_KEY), 16 | data={ 17 | 'from': mfrom, 18 | 'to': mto, 19 | 'subject': msubject, 20 | 'html': mbody 21 | }) 22 | elif settings.MAIL_SENDER == 'SENDGRID': 23 | sg = sendgrid.SendGridClient(settings.SG_USER, settings.SG_PWD) 24 | sending_msg = sendgrid.Mail() 25 | sending_msg.set_subject(msubject) 26 | sending_msg.set_html(mbody) 27 | sending_msg.set_text(msubject) 28 | sending_msg.set_from(mfrom) 29 | sending_msg.add_to(mto) 30 | reposne = sg.send(sending_msg) 31 | print (reposne) 32 | else: 33 | text_content = msubject 34 | msg = EmailMultiAlternatives(msubject, mbody, mfrom, mto) 35 | msg.attach_alternative(mbody, "text/html") 36 | msg.send() 37 | -------------------------------------------------------------------------------- /django_simple_forum/static/css/bootstrap-suggest.css: -------------------------------------------------------------------------------- 1 | .suggest{top:7px;z-index:30;text-align:left}.suggest>.dropdown-menu{margin-top:15px;position:absolute;padding:0}.suggest>.dropdown-menu>li{border-bottom:1px solid #eee}.suggest>.dropdown-menu>li>a{padding:5px 10px;cursor:default}.suggest>.dropdown-menu>li>a:hover *,.suggest>.dropdown-menu>li.active>a *{color:inherit!important}.suggest>.dropdown-menu>li:last-child{border-bottom:0} -------------------------------------------------------------------------------- /django_simple_forum/static/css/dashboard.css: -------------------------------------------------------------------------------- 1 | body { 2 | height: 100%; 3 | position: relative; 4 | font-family: 'Poppins', sans-serif; 5 | color: #bbdefb; 6 | font-size: 13px; 7 | padding-top: 50px; 8 | line-height: 20px; 9 | min-width: 998px; 10 | background: #f9f9f9; 11 | } 12 | .mt { 13 | padding: 0px; 14 | margin: 0px; 15 | } 16 | .mar-right { 17 | margin-right: 0; 18 | } 19 | .mar-left { 20 | margin-left: 0; 21 | } 22 | .mar-r-l { 23 | margin-left: 0; 24 | margin-right: 0; 25 | } 26 | .pad_lr_0 { 27 | padding-left: 0; 28 | padding-right: 0; 29 | } 30 | .form-control { 31 | width: inherit; 32 | background: transparent; 33 | padding-left: 10px; 34 | box-shadow: none; 35 | height: 40px; 36 | font-size: 13px; 37 | } 38 | .logo { 39 | height: 50px; 40 | margin-top: 0px; 41 | padding: 15px 0px 0px 10px; 42 | color: white; 43 | font-weight: 400; 44 | loat: left; 45 | background: #fff; 46 | box-shadow: 0 0 13px rgba(0, 0, 0, 0.13); 47 | margin-bottom: 0px; 48 | width: 100%; 49 | color: #FE3554; 50 | text-transform: uppercase; 51 | font-weight: 500; 52 | font-size: 15px; 53 | letter-spacing: 1px; 54 | position: fixed; 55 | top: 0; 56 | z-index: 99; 57 | } 58 | .menu { 59 | padding-left: 0px; 60 | width: 200px; 61 | background: #2b3840; 62 | position: fixed; 63 | height: 100%; 64 | top: 0; 65 | padding-top: 50px; 66 | } 67 | .menu .nav li .dropdown-menu { 68 | left: 200px; 69 | padding: 0px 0px 0px; 70 | margin: 0px 0 0; 71 | background: #fff; 72 | top: 0; 73 | } 74 | .menu .nav li a { 75 | font-size: 12px; 76 | text-decoration: none; 77 | color: #9ea1a2; 78 | text-transform: uppercase; 79 | font-weight: 500; 80 | letter-spacing: 1px; 81 | border-bottom: 1px solid #39464e; 82 | } 83 | .menu .nav li a:hover { 84 | color: #fff; 85 | background: #FE3554; 86 | border-radius: 0; 87 | } 88 | .menu .nav li a i { 89 | padding-right: 4px; 90 | font-size: 15px; 91 | float: right; 92 | } 93 | .menu .nav li.active a { 94 | background: #FE3554; 95 | border-radius: 0; 96 | color: #fff; 97 | } 98 | .menu .nav li.active a:hover { 99 | color: #FE3554; 100 | border-radius: 0; 101 | background: white; 102 | } 103 | .menu .nav li.dropdown.open a { 104 | background: #fff; 105 | color: #FE3554; 106 | border-radius: 0; 107 | } 108 | .menu .nav li.dropdown.open .dropdown-menu li a { 109 | background: #2b3840; 110 | color: #9ea1a2; 111 | padding: 10px; 112 | border-radius: 0; 113 | border-bottom: 0; 114 | border-bottom: 1px solid #39464e; 115 | } 116 | .menu .nav li.dropdown.open .dropdown-menu li a:hover { 117 | background-color: #FE3554; 118 | color: #fff; 119 | } 120 | .user_details { 121 | padding: 0px; 122 | margin: 0px; 123 | } 124 | .content { 125 | margin-left: 210px; 126 | color: #777; 127 | } 128 | .content .list { 129 | margin-top: 18px; 130 | padding: 0px 21px 0px 15px; 131 | } 132 | .content .list .list-header { 133 | margin-bottom: 10px; 134 | } 135 | .content .list .list-header label { 136 | text-transform: uppercase; 137 | font-weight: 500; 138 | font-size: 16px; 139 | letter-spacing: 1px; 140 | width: 100%; 141 | color: #2b3840; 142 | } 143 | .content .list .list-header label span a { 144 | display: inline-block; 145 | background: #FE3554; 146 | font-size: 12px; 147 | letter-spacing: 0.6px; 148 | color: #fff; 149 | padding: 4px 10px; 150 | } 151 | .content .list .list-header label span a i { 152 | display: inline-block; 153 | margin-right: 6px; 154 | } 155 | .content .list .list-header .new { 156 | float: right; 157 | padding: 6px; 158 | background: salmon; 159 | margin-bottom: 6px; 160 | padding-right: 18px; 161 | padding-left: 18px; 162 | margin-right: 24px; 163 | font-size: 14px; 164 | } 165 | .content .list .list-header .new a { 166 | color: white; 167 | } 168 | .content .list .list-header .new a i { 169 | padding-right: 5px; 170 | } 171 | .content .list table th { 172 | background: #eee; 173 | border: 1px solid #ccc; 174 | font-weight: bold; 175 | color: darkcyan; 176 | } 177 | .content .list table tbody td a i { 178 | padding: 6px; 179 | padding-top: 7px; 180 | border-radius: 3px; 181 | background: #ddd; 182 | color: #fff; 183 | font-size: 12px; 184 | border: 1px solid #333; 185 | margin-left: 5px; 186 | } 187 | .content .list table tbody td a i.edit { 188 | background: #65C178; 189 | border: none; 190 | } 191 | .content .list table tbody td a i.edit:hover { 192 | background: #3e9b52; 193 | } 194 | .content .list table tbody td a i.delete { 195 | background: #D53139; 196 | border: none; 197 | } 198 | .content .list table tbody td a i.delete:hover { 199 | background: #9a1f25; 200 | } 201 | .content .list table tbody td a i.view { 202 | background: #FFBF00; 203 | border: none; 204 | } 205 | .content .list table tbody td a i.view:hover { 206 | background: #b38600; 207 | } 208 | .content .new { 209 | width: 70%; 210 | margin: 0px auto; 211 | margin-top: 80px; 212 | background: #fff; 213 | box-shadow: 4px 3px 13px #e8e3e3; 214 | } 215 | .content .new .new-header { 216 | margin-bottom: 10px; 217 | } 218 | .content .new .new-header label { 219 | text-transform: uppercase; 220 | font-weight: 600; 221 | font-size: 13px; 222 | letter-spacing: 1px; 223 | width: 100%; 224 | color: #ffffff; 225 | background: #a2a2a2; 226 | padding: 6px 10px; 227 | } 228 | .content .new .new-user { 229 | padding: 20px; 230 | } 231 | .content .new .new-user .form-group { 232 | width: 100%; 233 | margin: 0px; 234 | margin-bottom: 15px; 235 | } 236 | .content .new .new-user .control-label { 237 | text-align: left; 238 | color: #2b3840; 239 | font-size: 12px; 240 | font-weight: 500; 241 | text-transform: uppercase; 242 | } 243 | .content .new .new-user .form-control { 244 | width: 100%; 245 | } 246 | .content .new .new-user .save_buttons button { 247 | display: inline-block; 248 | font-size: 12px; 249 | letter-spacing: 0.6px; 250 | color: #fff; 251 | padding: 6px 12px; 252 | text-transform: uppercase; 253 | font-weight: 500; 254 | letter-spacing: 1px; 255 | border-radius: 0; 256 | border: none; 257 | } 258 | .content .new .new-user .save_buttons button.submit { 259 | background: #FE3554; 260 | } 261 | .content .new .new-user .save_buttons button.cancel { 262 | background: #2b3840; 263 | } 264 | .nav-stacked > li + li { 265 | margin-top: 0; 266 | margin-left: 0; 267 | } 268 | /* user_table starts here */ 269 | .user_table .table-responsive { 270 | -moz-box-shadow: 0 0 5px #e8e3e3; 271 | -webkit-box-shadow: 0 0 5px#e8e3e3; 272 | box-shadow: 4px 3px 13px #e8e3e3; 273 | } 274 | .user_table .table-responsive .table { 275 | margin-bottom: 0; 276 | } 277 | .user_table .table-responsive .table thead tr th { 278 | background-color: #fff; 279 | font-size: 12px; 280 | color: #2b3840; 281 | font-weight: 500; 282 | } 283 | .user_table .table-responsive .table tbody tr td { 284 | background-color: #fff; 285 | font-size: 12px; 286 | } 287 | /* user_table ends here */ 288 | .error{ 289 | color: red; 290 | } 291 | .tab_content { 292 | border: 1px dotted #e1e1e1; 293 | margin: 13px; 294 | display: none; 295 | margin-top: 0px; 296 | width: 98%; 297 | margin: 0px auto; 298 | margin-top: 50px; 299 | padding: 15px; 300 | background: #fdfdfd; 301 | border: 1px dotted #ddd; 302 | margin-bottom: 10px; 303 | margin-top: 30px!important; 304 | } 305 | .tab_button_row { 306 | padding: 13px; 307 | } 308 | .tab_button_row .button { 309 | cursor: pointer; 310 | padding: 6px 18px; 311 | background: #e1e1e1; 312 | border: none; 313 | color: #000; 314 | margin-right: 5px; 315 | } 316 | .tab_button_row .button i { 317 | padding-right: 5px; 318 | } 319 | .specific_detail{ 320 | border: 1px dotted #ddd; 321 | padding: 15px; 322 | margin-bottom: 8px; 323 | } -------------------------------------------------------------------------------- /django_simple_forum/static/css/jquery.tagsinput.css: -------------------------------------------------------------------------------- 1 | div.tagsinput { 2 | overflow-y: auto; 3 | background: #fff; 4 | border-radius: 0px; 5 | padding: 7px 10px; 6 | border: none; 7 | min-height: 42px !important; 8 | font-size: 12px; 9 | box-shadow: none; 10 | border:1px solid #D9D9D9 !important; 11 | } 12 | div.tagsinput span.tag { 13 | display: block; 14 | float: left; 15 | padding: 5px; 16 | text-decoration: none; 17 | background: #7D8590; 18 | color: #fff; 19 | margin-right: 5px; 20 | margin-bottom: 5px; 21 | font-size: 13px; 22 | font-weight:normal; 23 | } 24 | div.tagsinput span.tag a { 25 | font-weight: bold; 26 | color: #fff; 27 | text-decoration: none; 28 | font-size: 11px; 29 | } 30 | 31 | div.tagsinput input { 32 | width: 80px; 33 | margin: 0px; 34 | font-family: 'Lato', sans-serif; 35 | font-size: 13px; 36 | border: 1px solid transparent; 37 | padding: 5px; 38 | background: transparent; 39 | color: #505458 !important; 40 | outline: 0px; 41 | margin-right: 5px; 42 | } 43 | div.tagsinput div { 44 | display: block; 45 | float: left; 46 | } 47 | .tags_clear { 48 | clear: both; 49 | width: 100%; 50 | height: 0px; 51 | } 52 | .not_valid { 53 | background: #FBD8DB !important; 54 | color: #90111A !important; 55 | } -------------------------------------------------------------------------------- /django_simple_forum/static/css/login.css: -------------------------------------------------------------------------------- 1 | body { 2 | height: 100%; 3 | position: relative; 4 | font-family: 'Poppins', sans-serif; 5 | color: #bbdefb; 6 | font-size: 13px; 7 | line-height: 20px; 8 | min-width: 998px; 9 | border-top: 3px solid #919191; 10 | background: #FE3554; 11 | } 12 | .mar-right { 13 | margin-right: 0; 14 | } 15 | .mar-left { 16 | margin-left: 0; 17 | } 18 | .mar-r-l { 19 | margin-left: 0; 20 | margin-right: 0; 21 | } 22 | .pad_lr_0 { 23 | padding-left: 0; 24 | padding-right: 0; 25 | } 26 | /*login*/ 27 | .login { 28 | margin-top: 100px; 29 | text-align: center; 30 | } 31 | .login .text { 32 | float: left; 33 | min-width: 100%; 34 | margin-bottom: 0px; 35 | font-size: 23px; 36 | color: white; 37 | } 38 | .login .text .login_page_heading { 39 | color: #ffffff; 40 | text-transform: uppercase; 41 | font-weight: 500; 42 | font-size: 22px; 43 | line-height: 50px; 44 | letter-spacing: 1px; 45 | } 46 | .login #sign_in { 47 | padding-top: 25px; 48 | width: 70%; 49 | padding: 0px 0; 50 | background: #fff; 51 | margin: 0px auto; 52 | border-radius: 3px; 53 | border: none; 54 | box-shadow: 7px 7px 1px #dc3750; 55 | } 56 | .login #sign_in .content-group { 57 | padding: 30px 0px; 58 | padding-bottom: 0; 59 | color: #2b3840; 60 | font-size: 15px; 61 | font-weight: 500; 62 | margin-bottom: 40px; 63 | } 64 | .login #sign_in .content-group small { 65 | display: block; 66 | margin-top: 10px; 67 | font-size: 12px; 68 | } 69 | .login #sign_in .form-group { 70 | margin-bottom: 9px; 71 | margin-top: 12px; 72 | width: 90%; 73 | margin: 0 auto; 74 | } 75 | .login #sign_in .form-group .input-group { 76 | position: relative; 77 | display: table; 78 | margin-bottom: 15px; 79 | width: 100%; 80 | border-collapse: separate; 81 | } 82 | .login #sign_in .form-group .input-group .input-group-addon { 83 | position: absolute; 84 | height: 100%; 85 | width: 36px; 86 | border-radius: 0; 87 | border-top-left-radius: 3px; 88 | border-top-right-radius: 3px; 89 | background: none; 90 | padding-top: 11px; 91 | } 92 | .login #sign_in .form-group .input-group .input-group-addon i { 93 | color: #FE3554; 94 | } 95 | .login #sign_in .form-group .input-group .form-control { 96 | width: inherit; 97 | background: transparent; 98 | padding-left: 40px; 99 | box-shadow: none; 100 | height: 40px; 101 | font-size: 13px; 102 | } 103 | .login #sign_in .remember { 104 | padding-left: 20px; 105 | } 106 | .login #sign_in .remember label { 107 | display: block; 108 | margin-top: 0px; 109 | font-size: 12px; 110 | font-weight: 400; 111 | color: #666; 112 | } 113 | .login #sign_in .forgot { 114 | padding-right: 20px; 115 | } 116 | .login #sign_in .forgot a { 117 | color: #FE3554; 118 | } 119 | .login #sign_in .button_row_login button { 120 | width: 100%; 121 | font-size: 15px; 122 | height: 41px; 123 | margin-bottom: 25px; 124 | background: #2b3840; 125 | color: white; 126 | border: none; 127 | margin: 0; 128 | font-weight: 500; 129 | margin-top: 25px; 130 | text-transform: uppercase; 131 | letter-spacing: 1px; 132 | border-bottom-left-radius: 3px; 133 | border-bottom-right-radius: 3px; 134 | outline: none; 135 | } 136 | .login #sign_in .button_row_login button i { 137 | padding-right: 6px; 138 | } 139 | .login #sign_in .button_row_login button:hover { 140 | color: #E87C7C 141 | background: white; 142 | } 143 | /*login*/ 144 | input[type=checkbox], 145 | input[type=radio] { 146 | margin: 0; 147 | line-height: normal; 148 | vertical-align: middle; 149 | } 150 | -------------------------------------------------------------------------------- /django_simple_forum/static/css/ref.css: -------------------------------------------------------------------------------- 1 | .pad_lr_15 { 2 | padding-left: 15px; 3 | padding-right: 15px; } 4 | 5 | .pad_lr_0 { 6 | padding-left: 0px; 7 | padding-right: 0px; } 8 | 9 | /*# sourceMappingURL=ref.css.map */ 10 | -------------------------------------------------------------------------------- /django_simple_forum/static/js/jquery.tagsinput.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | jQuery Tags Input Plugin 1.3.3 4 | 5 | Copyright (c) 2011 XOXCO, Inc 6 | 7 | Documentation for this plugin lives here: 8 | http://xoxco.com/clickable/jquery-tags-input 9 | 10 | Licensed under the MIT license: 11 | http://www.opensource.org/licenses/mit-license.php 12 | 13 | ben@xoxco.com 14 | 15 | */ 16 | 17 | (function($) { 18 | 19 | var delimiter = new Array(); 20 | var tags_callbacks = new Array(); 21 | $.fn.doAutosize = function(o){ 22 | var minWidth = $(this).data('minwidth'), 23 | maxWidth = $(this).data('maxwidth'), 24 | val = '', 25 | input = $(this), 26 | testSubject = $('#'+$(this).data('tester_id')); 27 | 28 | if (val === (val = input.val())) {return;} 29 | 30 | // Enter new content into testSubject 31 | var escaped = val.replace(/&/g, '&').replace(/\s/g,' ').replace(//g, '>'); 32 | testSubject.html(escaped); 33 | // Calculate new width + whether to change 34 | var testerWidth = testSubject.width(), 35 | newWidth = (testerWidth + o.comfortZone) >= minWidth ? testerWidth + o.comfortZone : minWidth, 36 | currentWidth = input.width(), 37 | isValidWidthChange = (newWidth < currentWidth && newWidth >= minWidth) 38 | || (newWidth > minWidth && newWidth < maxWidth); 39 | 40 | // Animate width 41 | if (isValidWidthChange) { 42 | input.width(newWidth); 43 | } 44 | 45 | 46 | }; 47 | $.fn.resetAutosize = function(options){ 48 | // alert(JSON.stringify(options)); 49 | var minWidth = $(this).data('minwidth') || options.minInputWidth || $(this).width(), 50 | maxWidth = $(this).data('maxwidth') || options.maxInputWidth || ($(this).closest('.tagsinput').width() - options.inputPadding), 51 | val = '', 52 | input = $(this), 53 | testSubject = $('').css({ 54 | position: 'absolute', 55 | top: -9999, 56 | left: -9999, 57 | width: 'auto', 58 | fontSize: input.css('fontSize'), 59 | fontFamily: input.css('fontFamily'), 60 | fontWeight: input.css('fontWeight'), 61 | letterSpacing: input.css('letterSpacing'), 62 | whiteSpace: 'nowrap' 63 | }), 64 | testerId = $(this).attr('id')+'_autosize_tester'; 65 | if(! $('#'+testerId).length > 0){ 66 | testSubject.attr('id', testerId); 67 | testSubject.appendTo('body'); 68 | } 69 | 70 | input.data('minwidth', minWidth); 71 | input.data('maxwidth', maxWidth); 72 | input.data('tester_id', testerId); 73 | input.css('width', minWidth); 74 | }; 75 | 76 | $.fn.addTag = function(value,options) { 77 | options = jQuery.extend({focus:false,callback:true},options); 78 | this.each(function() { 79 | var id = $(this).attr('id'); 80 | 81 | var tagslist = $(this).val().split(delimiter[id]); 82 | if (tagslist[0] == '') { 83 | tagslist = new Array(); 84 | } 85 | 86 | value = jQuery.trim(value); 87 | 88 | if (options.unique) { 89 | var skipTag = $(this).tagExist(value); 90 | if(skipTag == true) { 91 | //Marks fake input as not_valid to let styling it 92 | $('#'+id+'_tag').addClass('not_valid'); 93 | } 94 | } else { 95 | var skipTag = false; 96 | } 97 | 98 | if (value !='' && skipTag != true) { 99 | $('').addClass('tag').append( 100 | $('').text(value).append('  '), 101 | $('', { 102 | href : '#', 103 | title : 'Removing tag', 104 | text : 'x' 105 | }).click(function () { 106 | return $('#' + id).removeTag(escape(value)); 107 | }) 108 | ).insertBefore('#' + id + '_addTag'); 109 | 110 | tagslist.push(value); 111 | 112 | $('#'+id+'_tag').val(''); 113 | if (options.focus) { 114 | $('#'+id+'_tag').focus(); 115 | } else { 116 | $('#'+id+'_tag').blur(); 117 | } 118 | 119 | $.fn.tagsInput.updateTagsField(this,tagslist); 120 | 121 | if (options.callback && tags_callbacks[id] && tags_callbacks[id]['onAddTag']) { 122 | var f = tags_callbacks[id]['onAddTag']; 123 | f.call(this, value); 124 | } 125 | if(tags_callbacks[id] && tags_callbacks[id]['onChange']) 126 | { 127 | var i = tagslist.length; 128 | var f = tags_callbacks[id]['onChange']; 129 | f.call(this, $(this), tagslist[i-1]); 130 | } 131 | } 132 | 133 | }); 134 | 135 | return false; 136 | }; 137 | 138 | $.fn.removeTag = function(value) { 139 | value = unescape(value); 140 | this.each(function() { 141 | var id = $(this).attr('id'); 142 | 143 | var old = $(this).val().split(delimiter[id]); 144 | 145 | $('#'+id+'_tagsinput .tag').remove(); 146 | str = ''; 147 | for (i=0; i< old.length; i++) { 148 | if (old[i]!=value) { 149 | str = str + delimiter[id] +old[i]; 150 | } 151 | } 152 | 153 | $.fn.tagsInput.importTags(this,str); 154 | 155 | if (tags_callbacks[id] && tags_callbacks[id]['onRemoveTag']) { 156 | var f = tags_callbacks[id]['onRemoveTag']; 157 | f.call(this, value); 158 | } 159 | }); 160 | 161 | return false; 162 | }; 163 | 164 | $.fn.tagExist = function(val) { 165 | var id = $(this).attr('id'); 166 | var tagslist = $(this).val().split(delimiter[id]); 167 | return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not 168 | }; 169 | 170 | // clear all existing tags and import new ones from a string 171 | $.fn.importTags = function(str) { 172 | id = $(this).attr('id'); 173 | $('#'+id+'_tagsinput .tag').remove(); 174 | $.fn.tagsInput.importTags(this,str); 175 | } 176 | 177 | $.fn.tagsInput = function(options) { 178 | var settings = jQuery.extend({ 179 | interactive:true, 180 | defaultText:'add a tag', 181 | minChars:0, 182 | width:'300px', 183 | height:'100px', 184 | autocomplete: {selectFirst: false }, 185 | 'hide':true, 186 | 'delimiter':',', 187 | 'unique':true, 188 | removeWithBackspace:true, 189 | placeholderColor:'#666666', 190 | autosize: true, 191 | comfortZone: 20, 192 | inputPadding: 6*2 193 | },options); 194 | 195 | this.each(function() { 196 | if (settings.hide) { 197 | $(this).hide(); 198 | } 199 | var id = $(this).attr('id'); 200 | if (!id || delimiter[$(this).attr('id')]) { 201 | id = $(this).attr('id', 'tags' + new Date().getTime()).attr('id'); 202 | } 203 | 204 | var data = jQuery.extend({ 205 | pid:id, 206 | real_input: '#'+id, 207 | holder: '#'+id+'_tagsinput', 208 | input_wrapper: '#'+id+'_addTag', 209 | fake_input: '#'+id+'_tag' 210 | },settings); 211 | 212 | delimiter[id] = data.delimiter; 213 | 214 | if (settings.onAddTag || settings.onRemoveTag || settings.onChange) { 215 | tags_callbacks[id] = new Array(); 216 | tags_callbacks[id]['onAddTag'] = settings.onAddTag; 217 | tags_callbacks[id]['onRemoveTag'] = settings.onRemoveTag; 218 | tags_callbacks[id]['onChange'] = settings.onChange; 219 | } 220 | 221 | var markup = '
'; 222 | 223 | if (settings.interactive) { 224 | markup = markup + ''; 225 | } 226 | 227 | markup = markup + '
'; 228 | 229 | $(markup).insertAfter(this); 230 | 231 | $(data.holder).css('width',settings.width); 232 | $(data.holder).css('min-height',settings.height); 233 | $(data.holder).css('height','100%'); 234 | 235 | if ($(data.real_input).val()!='') { 236 | $.fn.tagsInput.importTags($(data.real_input),$(data.real_input).val()); 237 | } 238 | if (settings.interactive) { 239 | $(data.fake_input).val($(data.fake_input).attr('data-default')); 240 | $(data.fake_input).css('color',settings.placeholderColor); 241 | $(data.fake_input).resetAutosize(settings); 242 | 243 | $(data.holder).bind('click',data,function(event) { 244 | $(event.data.fake_input).focus(); 245 | }); 246 | 247 | $(data.fake_input).bind('focus',data,function(event) { 248 | if ($(event.data.fake_input).val()==$(event.data.fake_input).attr('data-default')) { 249 | $(event.data.fake_input).val(''); 250 | } 251 | $(event.data.fake_input).css('color','#000000'); 252 | }); 253 | 254 | if (settings.autocomplete_url != undefined) { 255 | autocomplete_options = {source: settings.autocomplete_url}; 256 | for (attrname in settings.autocomplete) { 257 | autocomplete_options[attrname] = settings.autocomplete[attrname]; 258 | } 259 | 260 | if (jQuery.Autocompleter !== undefined) { 261 | $(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete); 262 | $(data.fake_input).bind('result',data,function(event,data,formatted) { 263 | if (data) { 264 | $('#'+id).addTag(data[0] + "",{focus:true,unique:(settings.unique)}); 265 | } 266 | }); 267 | } else if (jQuery.ui.autocomplete !== undefined) { 268 | $(data.fake_input).autocomplete(autocomplete_options); 269 | $(data.fake_input).bind('autocompleteselect',data,function(event,ui) { 270 | $(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)}); 271 | return false; 272 | }); 273 | } 274 | 275 | 276 | } else { 277 | // if a user tabs out of the field, create a new tag 278 | // this is only available if autocomplete is not used. 279 | $(data.fake_input).bind('blur',data,function(event) { 280 | var d = $(this).attr('data-default'); 281 | if ($(event.data.fake_input).val()!='' && $(event.data.fake_input).val()!=d) { 282 | if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) ) 283 | $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)}); 284 | } else { 285 | $(event.data.fake_input).val($(event.data.fake_input).attr('data-default')); 286 | $(event.data.fake_input).css('color',settings.placeholderColor); 287 | } 288 | return false; 289 | }); 290 | 291 | } 292 | // if user types a comma, create a new tag 293 | $(data.fake_input).bind('keypress',data,function(event) { 294 | if (event.which==event.data.delimiter.charCodeAt(0) || event.which==13 ) { 295 | event.preventDefault(); 296 | if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) ) 297 | $(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:true,unique:(settings.unique)}); 298 | $(event.data.fake_input).resetAutosize(settings); 299 | return false; 300 | } else if (event.data.autosize) { 301 | $(event.data.fake_input).doAutosize(settings); 302 | 303 | } 304 | }); 305 | //Delete last tag on backspace 306 | data.removeWithBackspace && $(data.fake_input).bind('keydown', function(event) 307 | { 308 | if(event.keyCode == 8 && $(this).val() == '') 309 | { 310 | event.preventDefault(); 311 | var last_tag = $(this).closest('.tagsinput').find('.tag:last').text(); 312 | var id = $(this).attr('id').replace(/_tag$/, ''); 313 | last_tag = last_tag.replace(/[\s]+x$/, ''); 314 | $('#' + id).removeTag(escape(last_tag)); 315 | $(this).trigger('focus'); 316 | } 317 | }); 318 | $(data.fake_input).blur(); 319 | 320 | //Removes the not_valid class when user changes the value of the fake input 321 | if(data.unique) { 322 | $(data.fake_input).keydown(function(event){ 323 | if(event.keyCode == 8 || String.fromCharCode(event.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/)) { 324 | $(this).removeClass('not_valid'); 325 | } 326 | }); 327 | } 328 | } // if settings.interactive 329 | }); 330 | 331 | return this; 332 | 333 | }; 334 | 335 | $.fn.tagsInput.updateTagsField = function(obj,tagslist) { 336 | var id = $(obj).attr('id'); 337 | $(obj).val(tagslist.join(delimiter[id])); 338 | }; 339 | 340 | $.fn.tagsInput.importTags = function(obj,val) { 341 | $(obj).val(''); 342 | var id = $(obj).attr('id'); 343 | var tags = val.split(delimiter[id]); 344 | for (i=0; i 4 |
5 |
6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 |
18 | 19 | 20 |
21 |
22 |
23 |
24 |
25 | 26 | {% endblock %} 27 | {% block extra_js %} 28 | 50 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/badges.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% load paginate %} 3 | {% block stage %} 4 |
5 |
6 | 9 |
10 | {% paginate 10 badges_list %} 11 | {% show_pageitems %} 12 |
13 | Per Page 14 | 20 |
21 |
22 | {% csrf_token %} 23 | 24 | 25 | 26 |
27 |
28 | {% if badges_list %} 29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {% for badge in badges_list %} 42 | 43 | 44 | 45 | 46 | 47 | {% endfor %} 48 | 49 |
IdTitleActions
{{ badge.id }}{{ badge.title }}
50 | {% show_pages %} 51 |
52 |
53 | 55 | {% else %} 56 | No Badge Available in database 57 | {% endif %} 58 | 59 |
60 |
61 | {% endblock %} 62 | {% block extra_js %} 63 | 80 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/categories.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% load paginate %} 3 | {% block stage %} 4 |
5 |
6 |
7 | 8 |
9 |
10 | {% paginate 10 categories_list %} 11 | {% show_pageitems %} 12 |
13 | Per Page 14 | 20 |
21 |
22 | {% csrf_token %} 23 | 24 | 25 | 26 |
27 |
28 | {% if categories_list %} 29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {% for category in categories_list %} 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {% for sub_category in category.forumcategory_set.all %} 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | {% endfor %} 66 | 67 | {% endfor %} 68 | 69 |
IdTitleColorCreated ByIs VotableIs ActiveActions
{{ forloop.counter }}{%if category.parent%}       {%endif%}{{ category.title }}{{ category.created_by }}{% if category.is_votable %}True{% else %}False{% endif %}{% if category.is_active %}True{% else %}False{% endif %}
{%if sub_category.parent%}       {%endif%}{{ sub_category.title }}{{ sub_category.created_by }}{% if sub_category.is_votable %}True{% else %}False{% endif %}{% if sub_category.is_active %}True{% else %}False{% endif %}
70 | {% show_pages %} 71 |
72 |
73 | 75 | {% else %} 76 | No Categories Available in database 77 | {% endif %} 78 | 79 |
80 |
81 | {% endblock %} 82 | {% block extra_js %} 83 | 100 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/category_add.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 |
4 |
5 |
6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 | 18 |
19 | 25 |
26 |
27 |
28 | 29 |
30 | 31 |
32 |
33 |
34 | 35 |
36 | 37 | 38 |
39 |
40 |
41 |
42 |
43 | 44 | 45 |
46 |
47 |
48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 |
56 |
57 |
58 | {% endblock %} 59 | {% block extra_js %} 60 | 95 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/change_password.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 |
4 |
5 |
6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 | 18 |
19 | 20 |
21 |
22 |
23 | 24 |
25 | 26 |
27 |
28 |
29 |
30 | 31 | 32 |
33 |
34 |
35 |
36 |
37 |
38 | {% endblock %} 39 | {% block extra_js %} 40 | 59 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/dashboard.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/dashboard_base.html: -------------------------------------------------------------------------------- 1 | 2 | {% load compress static %} 3 | 4 | 5 | Django Simple Forum 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {% compress css %} 15 | 16 | {% endcompress %} 17 | 18 | 19 | 20 | 21 |
22 |
23 |
24 | 27 |
28 | 53 | {% block stage %} 54 | {% endblock %} 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | {% compress js %} 64 | 65 | 85 | 86 | {% block extra_js %} 87 | {% endblock %} 88 | {% endcompress %} 89 |
90 |
91 | 92 | -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/dashboard_login.html: -------------------------------------------------------------------------------- 1 | 2 | {% load compress static %} 3 | 4 | 5 | Django Simple Forum 6 | 7 | 8 | 9 | 10 | 11 | 12 | {% compress css %} 13 | 14 | {% endcompress %} 15 | 16 | 17 | 18 | 19 |
20 | 53 |
54 | 55 | 56 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/edit_user.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 |
4 |
5 |
6 | 7 |
8 |
9 |
10 |
11 | 12 |
13 | 19 |
20 |
21 |
22 |
23 | 24 | 25 |
26 |
27 |
28 |
29 |
30 |
31 | {% endblock %} 32 | {% block extra_js %} 33 | 52 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/topics.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% load paginate %} 3 | {% block stage %} 4 |
5 |
6 |
7 | 8 |
9 |
10 |
11 |
12 | {% paginate 10 topic_list %} 13 | {% show_pageitems %} 14 |
15 | {% csrf_token %} 16 | 17 | 18 | 19 |
20 |
21 | {% if topic_list %} 22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | {% for topic in topic_list %} 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 53 | {% endfor %} 54 | 55 |
IdTitleCreated ByNo Of LikesNo Of UsersNo Of VotesNo Of CommentsActions
{{ topic.id }}{{ topic.title }}{{ topic.created_by }}{{ topic.no_of_likes }}{{ topic.get_topic_users|length }}{{ topic.no_of_votes }}{{ topic.topic_comments.all|length }} 49 | {% ifequal topic.status 'Draft' %}{% endifequal %}{% ifequal topic.status 'Published' %}{% endifequal %}{% ifequal topic.status 'Disabled' %}{% endifequal %} 50 | 51 |
56 | {% show_pages %} 57 |
58 |
59 | 61 | {% else %} 62 | No Topics Available in database 63 | {% endif %} 64 |
65 |
66 | {% endblock %} 67 | {% block extra_js %} 68 | 99 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/users.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% load paginate %} 3 | {% block stage %} 4 |
5 |
6 |
7 | 8 |
9 |
10 | {% paginate 10 users_list %} 11 | {% show_pageitems %} 12 |
13 | {% csrf_token %} 14 | 15 | 16 | 17 |
18 |
19 | {% if users_list %} 20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | {% for user in users_list %} 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | {% endfor %} 43 | 44 |
IdEmailUser NameNo Of Used Votes(Up/Down)Actions
{{ forloop.counter }}{{ user.user.email }}{{ user.user.username }}{{ user.used_votes }}({{user.get_no_of_up_votes}}/{{user.get_no_of_down_votes}}){% if user.user.is_active %}{% else %}{% endif %}
45 | {% show_pages %} 46 |
47 |
48 | 50 | {% else %} 51 | No Users Available in database 52 | {% endif %} 53 | 54 |
55 |
56 | {% endblock %} 57 | {% block extra_js %} 58 | 89 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/view_badge.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 | 8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 |

Badge Details

17 |
18 |
19 |
20 |
21 | 22 | 23 | {{ badge.title }} 24 | 25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {% if badge.get_users %} 33 |

Users({{badge.get_users|length}})

34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {% for user in badge.get_users %} 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {% endfor %} 54 | 55 |
IdEmailUser NameNo Of Used Votes(Up/Down)Actions
{{ forloop.counter }}{{ user.user.email }}{{ user.user.username }}{{ user.used_votes }}({{user.get_no_of_up_votes}}/{{user.get_no_of_down_votes}}){% if user.user.is_active %}{% else %}{% endif %}
56 | {% else %} 57 |

No Users Available for record

58 | {% endif %} 59 |
60 | 61 |
62 |
63 |
64 | {% endblock %} 65 | {% block extra_js %} 66 | 69 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/view_category.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 | 8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 |

Category Details

17 |
18 |
19 |
20 |
21 | 22 | 23 | {{ category.title }} 24 | 25 |
26 |
27 |
28 | 29 | 30 | {{ category.is_votable }} 31 | 32 |
33 |
34 |
35 |
36 |
37 | 38 | 39 | {{ category.color }} 40 | 41 |
42 |
43 |
44 | 45 | 46 | {{ category.is_active }} 47 | 48 |
49 |
50 |
51 |
52 |
53 | 54 | 55 | {{ category.created_by }} 56 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | {% if category.topic_set.all %} 65 |

Topics({{category.topic_set.all|length}})

66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | {% for topic in category.topic_set.all %} 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | {% endfor %} 94 | 95 |
#TitleCategoryStatusNo Of LikesNo Of UsersNo Of VotesNo Of CommentsActions
{{ topic.id }}{{ topic.title }}{{ topic.category.title }}{{ topic.status }}{{ topic.no_of_likes }}{{ topic.get_topic_users|length }}{{ topic.no_of_votes }}{{ topic.topic_comments.all|length }}
96 | {% else %} 97 |

No Topics Available for record

98 | {% endif %} 99 |
100 | 101 |
102 |
103 |
104 | {% endblock %} 105 | {% block extra_js %} 106 | 109 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/view_topic.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 | 8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 |

Topic Details

17 |
18 |
19 |
20 |
21 | 22 | 23 | {{ topic.title }} 24 | 25 |
26 |
27 |
28 | 29 | 30 | {% for tag in topic.tags.all %}{{ tag.title }}{% if forloop.last %}{% else %}, {% endif %}{% endfor %} 31 | 32 |
33 |
34 |
35 | 36 | 37 | {{ topic.created_by.username }} 38 | 39 |
40 |
41 |
42 |
43 |
44 | 45 | 46 | {{ topic.category.title }} 47 | 48 |
49 |
50 |
51 | 52 | 53 | {{ topic.status }} 54 | 55 |
56 |
57 |
58 |
59 | 60 | 61 | {{ topic.description|safe }} 62 | 63 |
64 |
65 |
66 |
67 |
68 |
69 | {% if topic.topic_comments.all %} 70 |

Comments({{topic.topic_comments.all|length}})

71 |
72 |
73 |

Comment Details

74 |

New Comment

75 |
76 | {% for comment in topic.topic_comments.all %} 77 |
78 |
79 |
80 | 81 | 82 | {{ comment.comment|safe }} 83 | 84 |
85 |
86 |
87 | 88 | 89 | {{ comment.commented_by.username }} 90 | 91 |
92 |
93 |
94 | 95 | 96 | {{ comment.updated_on }} 97 | 98 |
99 |
100 | 101 |
102 |
103 |
104 | {% endfor %} 105 |
106 | {% else %} 107 |

No Comments Available for record

108 | {% endif %} 109 |
110 | 111 |
112 |
113 |
114 | {% endblock %} 115 | {% block extra_js %} 116 | 119 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/dashboard/view_user.html: -------------------------------------------------------------------------------- 1 | {% extends 'dashboard/dashboard_base.html' %} 2 | {% block stage %} 3 | 11 | 12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 |

User Details

20 |
21 |
22 |
23 |
24 | 25 | 26 | {{ user.username }} 27 | 28 |
29 |
30 |
31 | 32 | 33 | {{ user.email }} 34 | 35 |
36 |
37 | {% if user_profile.badges.all %} 38 |
39 | 40 | 41 | {% for badge in user_profile.badges.all %}{{ badge.title }}{% if forloop.last %}{% else %}, {% endif %}{% endfor %} 42 | 43 |
44 |
45 | {% endif %} 46 |
47 |
48 |
49 | 50 | 51 | {% if user.is_active %} True{% else %}False{% endif %} 52 | 53 |
54 |
55 |
56 | 57 | 58 | {{ user_profile.user_roles }} 59 | 60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | User Topics 68 | Topics Liked 69 | Topics Followed 70 |
71 |
72 | {% if user_created_topics %} 73 |

User Topics

74 | {% for topic in user_created_topics %} 75 |
76 |
77 |
78 | 79 | 80 | {{ topic.title }} 81 | 82 |
83 |
84 |
85 | 86 | 87 | {{ topic.created_on }} 88 | 89 |
90 |
91 |
92 | 93 | 94 | {{ topic.status }} 95 | 96 |
97 |
98 |
99 | 100 | 101 | {{ topic.no_of_votes }} 102 | 103 |
104 |
105 |
106 | 107 | 108 | {{ topic.no_of_down_votes }} 109 | 110 |
111 |
112 |
113 |
114 |
115 | {% endfor %} 116 | {% else %} 117 | No Topics Available for a topic 118 | {% endif %} 119 |
120 |
121 | {% if user_liked_topics %} 122 |

Liked Topics

123 | {% for topic in user_liked_topics %} 124 |
125 |
126 |
127 | 128 | 129 | {{ topic.topic.title }} 130 | 131 |
132 |
133 |
134 | 135 | 136 | {{ topic.topic.created_on }} 137 | 138 |
139 |
140 |
141 | 142 | 143 | {{ topic.topic.status }} 144 | 145 |
146 |
147 |
148 | 149 | 150 | {{ topic.no_of_votes }} 151 | 152 |
153 |
154 |
155 | 156 | 157 | {{ topic.no_of_down_votes }} 158 | 159 |
160 |
161 |
162 |
163 |
164 | {% endfor %} 165 | {% else %} 166 | User didnt like any topic 167 | {% endif %} 168 |
169 |
170 | {% if user_followed_topics %} 171 |

Followed Topics

172 | {% for topic in user_followed_topics %} 173 |
174 |
175 |
176 | 177 | 178 | {{ topic.topic.title }} 179 | 180 |
181 |
182 |
183 | 184 | 185 | {{ topic.topic.created_on }} 186 | 187 |
188 |
189 |
190 | 191 | 192 | {{ topic.followed_on }} 193 | 194 |
195 |
196 |
197 | 198 | 199 | {{ topic.topic.status }} 200 | 201 |
202 |
203 |
204 | 205 | 206 | {{ topic.no_of_votes }} 207 | 208 |
209 |
210 |
211 | 212 | 213 | {{ topic.no_of_down_votes }} 214 | 215 |
216 |
217 |
218 |
219 |
220 | {% endfor %} 221 | {% else %} 222 | User didnot Follow Any Topic 223 | {% endif %} 224 |
225 | 226 |
227 |
228 |
229 | {% endblock %} 230 | {% block extra_js %} 231 | 238 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/emails/comment_add.html: -------------------------------------------------------------------------------- 1 | Dear User,
2 | New comment({{ comment.comment }}) has been created for the topic({{ comment.topic.title }}) at {{ comment.created_on }}
3 | You are recieving this notification because, you have enabled email settings option in the profile. 4 |
5 | You can view all the topic here forum 6 | 7 | -------------------------------------------------------------------------------- /django_simple_forum/templates/emails/comment_mentioned.html: -------------------------------------------------------------------------------- 1 | Dear User,
2 | New comment({{ comment.title }}) has been created for the topic, and you have mentioned in the topic({{ comment.topic.title }}). 3 | You are recieving this notification because, you have enable email settings option in the profile. 4 |
5 | You can view all the topic here forum 6 | 7 | -------------------------------------------------------------------------------- /django_simple_forum/templates/emails/new_topic.html: -------------------------------------------------------------------------------- 1 | Dear User,
2 | New topic({{ topic.title }}) has been created in forum and its status be Draft. 3 | You are recieving this notification because, you have enable email settings option in the profile. 4 |
5 | You can view all the topic here forum 6 | 7 | -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/badges.html: -------------------------------------------------------------------------------- 1 | {% extends 'forum/base.html' %} 2 | {% block stage %} 3 |
4 |
5 |
6 | {% include 'forum/left_menu.html' %} 7 |
8 |
9 |
10 | 11 |
12 |

All Badges

13 |
14 |
15 | {% for badge in badges_list %} 16 |
17 |
18 | 19 |
{{ badge.description }}
20 | {{badge.get_users|length}} 21 |
22 |
23 | {% endfor %} 24 |
25 |
26 |
27 | 28 |
29 |
30 |
31 |
32 |
33 |
34 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/categories.html: -------------------------------------------------------------------------------- 1 | {% extends 'forum/base.html' %} 2 | {% block stage %} 3 |
4 |
5 |
6 | {% include 'forum/left_menu.html' %} 7 |
8 |
9 |
10 | 11 |
12 |

All Categories

13 |
14 |
15 | {% if categories %} 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | {% for category in categories %} 26 | 27 | 28 | 29 | 30 | 31 | {% endfor %} 32 | 33 |
CategoryDescriptionTopics
{{category.title}}{{category.description|safe}}{{ category.get_topics|length }}
34 | {% else %} 35 | No Categories Available Here 36 | {% endif %} 37 |
38 |
39 |
40 | 41 |
42 |
43 |
44 |
45 |
46 |
47 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/left_menu.html: -------------------------------------------------------------------------------- 1 | {% load forum_tags %} 2 |
3 |
4 |
5 |
6 |

All Categories

7 |
8 |
9 |
    10 | {% get_categories as categories %} 11 | {% for category in categories %} 12 |
  • {{ category.title }}
  • 13 | {% endfor %} 14 |
  • All
  • 15 |
16 |
17 |
18 |
19 |
20 |

All Tags

21 |
22 |
23 |
    24 | {% get_tags as tags %} 25 | {% for tag in tags %} 26 |
  • {{ tag.title }} 27 | {% endfor %} 28 |
  • 29 |
  • All Tags 30 |
31 |
32 |
33 | {% if badges %} 34 |
35 |
36 |

ALl Badges

37 |
38 |
39 | 46 |
47 |
48 | {% endif %} 49 |
50 |
51 | 52 | -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/new_topic.html: -------------------------------------------------------------------------------- 1 | {% extends 'forum/base.html' %} 2 | {% block stage %} 3 | 8 |
9 |
10 |
11 | {% include 'forum/left_menu.html' %} 12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 | 20 | {{ form.title }} 21 |
22 |
23 | 24 | {{ form.category }} 25 |
26 |
27 | 28 | 34 |
35 |
36 | 37 | {{ form.description }} 38 |
39 |
40 | 41 | {{ form.tags }} 42 |
43 | 44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | {% endblock %} 53 | {% block extra_js %} 54 | 94 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/tags.html: -------------------------------------------------------------------------------- 1 | {% extends 'forum/base.html' %} 2 | {% block stage %} 3 |
4 |
5 |
6 | {% include 'forum/left_menu.html' %} 7 |
8 |
9 |
10 | 11 |
12 |

All Tags

13 |
14 | 15 | 16 |
17 | 18 | 19 |
20 |
    21 |
  • All
  • 22 |
  • A
  • 23 |
  • B
  • 24 |
  • C
  • 25 |
  • D
  • 26 |
  • E
  • 27 |
  • F
  • 28 |
  • G
  • 29 |
  • H
  • 30 |
  • I
  • 31 |
  • J
  • 32 |
  • K
  • 33 |
  • L
  • 34 |
  • M
  • 35 |
  • N
  • 36 |
  • O
  • 37 |
  • P
  • 38 |
  • Q
  • 39 |
  • R
  • 40 |
  • S
  • 41 |
  • T
  • 42 |
  • U
  • 43 |
  • V
  • 44 |
  • W
  • 45 |
  • X
  • 46 |
  • Y
  • 47 |
  • Z
  • 48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 | {% for tag in tags %} 56 | {{ tag.title }} {{ tag.get_topics|length }} 57 | {% endfor %} 58 |
59 |
60 |
61 | 62 |
63 | 64 |
65 |
66 |
67 |
68 |
69 |
70 | {% endblock %} 71 | {% block extra_js %} 72 | 79 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/topic_delete.html: -------------------------------------------------------------------------------- 1 | {% extends 'forum/base.html' %} 2 | 3 | {% block stage %} 4 |
5 | {% csrf_token %} 6 |

7 | Are you sure you want to delete Topic "{{ object }}" in category {{ topic.category }} ? 8 |

9 | 10 |
11 | {% endblock %} -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/topic_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'forum/base.html' %} 2 | {% load thumbnail paginate static %} 3 | 4 | {% block stage %} 5 |
6 |
7 |
8 | {% include 'forum/left_menu.html' %} 9 | {% paginate 20 topic_list %} 10 |
11 |
12 |
13 |
14 | 15 |

All Topics {% if request.user.is_authenticated %}New Topic{% endif %}

16 | {% for topic in topic_list %} 17 |
18 |
19 | {{ topic.title }} 20 |
21 |
22 | {{ topic.category.title }} Updated on {{ topic.updated_on }} 23 | Replies {{ topic.get_all_comments.count }} 24 | 25 |
26 |
27 |
    28 | {% for user in topic.get_topic_users %} 29 |
  • 30 | {% endfor %} 31 |
32 | {% if topic.created_by == request.user %} 33 | Update 34 | delete 35 | {% endif %} 36 |
37 |
38 |
39 | {% endfor %} 40 | {% show_pages %} 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | {% endblock %} 49 | -------------------------------------------------------------------------------- /django_simple_forum/templates/forum/topics_list.html: -------------------------------------------------------------------------------- 1 | {% load endless %} 2 | {% paginate topic_list %} 3 | 4 | {% for topic in topic_list %} 5 |
6 | 9 | 15 |
16 |
    17 |
  • 18 |
  • 19 |
  • 20 |
  • 21 |
  • 22 |
  • 23 |
24 |
25 |
26 |
27 | {% endfor %} 28 | 29 | 31 | -------------------------------------------------------------------------------- /django_simple_forum/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | {% load compress static %} 3 | 4 | 5 | Django Simple Forum 6 | 7 | 8 | 9 | 10 | 11 | 12 | {% compress css %} 13 | 14 | {% endcompress %} 15 | 16 | 17 | 18 | 19 |
20 |
21 | 47 |
48 |
49 | 50 | 51 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /django_simple_forum/templatetags/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicroPyramid/django-simple-forum/13ad478a7680df8e2aa466485f0abbaf7fa059db/django_simple_forum/templatetags/__init__.py -------------------------------------------------------------------------------- /django_simple_forum/templatetags/forum_tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | from django_simple_forum.models import ForumCategory, Tags, Badge, UserTopics, UserProfile 3 | from django.db.models import Count 4 | try: 5 | from django.contrib.auth import get_user_model 6 | User = get_user_model() 7 | except ImportError: 8 | from django.contrib.auth.models import User 9 | 10 | register = template.Library() 11 | 12 | 13 | @register.assignment_tag() 14 | def get_categories(): 15 | all_categories = ForumCategory.objects.filter(is_active=True).annotate(num_topics=Count('topic')).order_by('-num_topics')[:10] 16 | return all_categories 17 | 18 | 19 | @register.assignment_tag() 20 | def get_tags(): 21 | all_categories = Tags.objects.annotate(num_topics=Count('topic')).order_by('-num_topics')[:10] 22 | return all_categories 23 | 24 | 25 | @register.assignment_tag() 26 | def get_users(): 27 | all_users = User.objects.annotate(num_topics=Count('topic')).order_by('-num_topics')[:10] 28 | return all_users 29 | 30 | 31 | @register.assignment_tag() 32 | def get_badges(): 33 | all_badges = Badge.objects.filter()[:10] 34 | return all_badges 35 | 36 | 37 | @register.filter 38 | def is_topic_like(topic_id, user_id): 39 | user_topic = UserTopics.objects.filter(topic_id=topic_id, user_id=user_id).first() 40 | if user_topic: 41 | if user_topic.is_like: 42 | return True 43 | return False 44 | 45 | 46 | @register.filter 47 | def user_profile_pic(user_id): 48 | user = UserProfile.objects.filter(user_id=user_id).first() 49 | if user: 50 | return user.profile_pic 51 | return '' 52 | 53 | 54 | @register.filter 55 | def is_topic_followed(topic_id, user_id): 56 | user_topic = UserTopics.objects.filter(topic_id=topic_id, user_id=user_id).first() 57 | if user_topic: 58 | if user_topic.is_followed: 59 | return True 60 | return False 61 | 62 | 63 | @register.filter 64 | def sub_comments(sub_comment): 65 | l = [] 66 | reply = sub_comment.comment_parent.all() 67 | if reply: 68 | l.append(sub_comment) 69 | for sc in reply: 70 | l.extend(sub_comments(sc)) 71 | return l 72 | return [sub_comment] 73 | -------------------------------------------------------------------------------- /django_simple_forum/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from . import views 3 | 4 | urlpatterns = [ 5 | url(r'^$', views.TopicList.as_view(), name="topic_list"), 6 | url(r'^register/$', views.IndexView.as_view(), name="signup"), 7 | url(r'^forum/login/$', views.ForumLoginView.as_view(), name="user_login"), 8 | url(r'^fb_login/$', views.facebook_login, name="facebook_login"), 9 | url(r'^gp_login/$', views.google_login, name="google_login"), 10 | 11 | url(r'^topic/add/$', views.TopicAdd.as_view(), name="new_topic"), 12 | url(r'^topic/(?P[-\w]+)/update/$', views.TopicUpdateView.as_view(), name="topic_update"), 13 | url(r'^topic/view/(?P[-\w]+)/$', views.TopicView.as_view(), name="view_topic"), 14 | url(r'^topic/like/(?P[-\w]+)/$', views.TopicLike.as_view(), name="like_topic"), 15 | url(r'^topic/follow/(?P[-\w]+)/$', views.TopicFollow.as_view(), name="follow_topic"), 16 | url(r'^topic/votes/(?P[-\w]+)/up/$', views.TopicVoteUpView.as_view(), name="topic_vote_up"), 17 | url(r'^topic/votes/(?P[-\w]+)/down/$', views.TopicVoteDownView.as_view(), name="topic_vote_down"), 18 | 19 | url(r'^mentioned-users/(?P[-\w]+)/$', views.get_mentioned_user, name="get_mentioned_user"), 20 | url(r'^user/profile/(?P[a-zA-Z0-9_.-@]+)/$', views.ProfileView.as_view(), name="view_profile"), 21 | url(r'^change-password/$', views.UserChangePassword.as_view(), name="user_change_password"), 22 | url(r'^forgot-password/$', views.ForgotPasswordView.as_view(), name="forgot_password"), 23 | url(r'^comment/delete/(?P[-\w]+)/$', 24 | views.CommentDelete.as_view(), name="comment_delete"), 25 | url(r'^comment/edit/(?P[-\w]+)/$', views.CommentEdit.as_view(), name="comment_edit"), 26 | 27 | url(r'^categories/$', views.ForumCategoryList.as_view(), name="forum_categories"), 28 | url(r'^tags/$', views.ForumTagsList.as_view(), name="forum_tags"), 29 | url(r'^badges/$', views.ForumBadgeList.as_view(), name="forum_badges"), 30 | url(r'^profile/$', views.UserProfileView.as_view(), name="user_profile"), 31 | url(r'^upload/profile-pic/$', views.UserProfilePicView.as_view(), name="user_profile_pic"), 32 | url(r'^send-mail/settings/$', views.UserSettingsView.as_view(), name="user_settings"), 33 | 34 | url(r'^category/(?P[-\w]+)/$', views.ForumCategoryView.as_view(), name="forum_category_detail"), 35 | url(r'^tags/(?P[-\w]+)/$', views.ForumTagsView.as_view(), name="forum_tags_detail"), 36 | 37 | url(r'^user/(?P[a-zA-Z0-9_-]+.*?)/$', views.UserDetailView.as_view(), name="user_details"), 38 | 39 | url(r'^comment/add/$', views.CommentAdd.as_view(), name="new_comment"), 40 | url(r'^comment/votes/(?P[-\w]+)/up/$', views.CommentVoteUpView.as_view(), name="comment_vote_up"), 41 | url(r'^comment/votes/(?P[-\w]+)/down/$', views.CommentVoteDownView.as_view(), name="comment_vote_down"), 42 | 43 | url(r'^dashboard/$', views.LoginView.as_view(), name="dashboard"), 44 | # url(r'^dashboard/$', DashboardView.as_view(), name="dashboard"), 45 | url(r'^logout/$', views.getout, name='out'), 46 | 47 | url(r'^dashboard/category/list/$', views.CategoryList.as_view(), name="categories"), 48 | url(r'^dashboard/category/add/$', views.CategoryAdd.as_view(), name="add_category"), 49 | url(r'^dashboard/category/delete/(?P[-\w]+)/$', 50 | views.CategoryDelete.as_view(), name="delete_category"), 51 | url(r'^dashboard/category/edit/(?P[-\w]+)/$', 52 | views.CategoryEdit.as_view(), name="edit_category"), 53 | url(r'^dashboard/category/view/(?P[-\w]+)/$', 54 | views.CategoryDetailView.as_view(), name="view_category"), 55 | 56 | url(r'^dashboard/badge/list/$', views.BadgeList.as_view(), name="badges"), 57 | url(r'^dashboard/badge/add/$', views.BadgeAdd.as_view(), name="add_badge"), 58 | url(r'^dashboard/badge/delete/(?P[-\w]+)/$', views.BadgeDelete.as_view(), name="delete_badge"), 59 | url(r'^dashboard/badge/edit/(?P[-\w]+)/$', views.BadgeEdit.as_view(), name="edit_badge"), 60 | url(r'^dashboard/badge/view/(?P[-\w]+)/$', views.BadgeDetailView.as_view(), name="view_badge"), 61 | 62 | url(r'^dashboard/users/list/$', views.UserList.as_view(), name="users"), 63 | url(r'^dashboard/users/delete/(?P[a-zA-Z0-9_-]+.*?)/$', 64 | views.DashboardUserDelete.as_view(), name="delete_user"), 65 | url(r'^dashboard/users/status/(?P[a-zA-Z0-9_-]+.*?)/$', 66 | views.UserStatus.as_view(), name="user_status"), 67 | url(r'^dashboard/users/view/(?P[a-zA-Z0-9_-]+.*?)/$', 68 | views.UserDetail.as_view(), name="user_detail"), 69 | url(r'^dashboard/users/edit/(?P[a-zA-Z0-9_-]+.*?)/$', 70 | views.DashboardUserEdit.as_view(), name="edit_user"), 71 | 72 | url(r'^dashboard/topics/list/$', views.DashboardTopicList.as_view(), name="topics"), 73 | url(r'^dashboard/topics/delete/(?P[-\w]+)/$', views.TopicDeleteView.as_view(), name="delete_topic"), 74 | url(r'^dashboard/topic/view/(?P[-\w]+)/$', views.TopicDetail.as_view(), name="topic_detail"), 75 | url(r'^dashboard/topic/status/(?P[-\w]+)/$', views.TopicStatus.as_view(), name="topic_status"), 76 | 77 | url(r'^dashboard/change-password/$', views.ChangePassword.as_view(), name="change_password"), 78 | 79 | ] -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MicroSite.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MicroSite.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/MicroSite" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MicroSite" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicroPyramid/django-simple-forum/13ad478a7680df8e2aa466485f0abbaf7fa059db/docs/__init__.py -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # django-blog-it documentation build configuration file, created by 4 | # sphinx-quickstart on Mon Dec 29 20:41:44 2014. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ------------------------------------------------ 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be 27 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 28 | # ones. 29 | extensions = [ 30 | 'sphinx.ext.autodoc', 31 | ] 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ['ntemplates'] 35 | 36 | # The suffix of source filenames. 37 | source_suffix = '.rst' 38 | 39 | # The encoding of source files. 40 | #source_encoding = 'utf-8-sig' 41 | 42 | # The master toctree document. 43 | master_doc = 'index' 44 | 45 | # General information about the project. 46 | project = u'django-simple-forum' 47 | copyright = u'2016, MicroPyramid' 48 | 49 | # The version info for the project you're documenting, acts as replacement for 50 | # |version| and |release|, also used in various other places throughout the 51 | # built documents. 52 | # 53 | # The short X.Y version. 54 | version = '0.0.5' 55 | # The full version, including alpha/beta/rc tags. 56 | release = '0.0.5' 57 | 58 | # The language for content autogenerated by Sphinx. Refer to documentation 59 | # for a list of supported languages. 60 | #language = None 61 | 62 | # There are two options for replacing |today|: either, you set today to some 63 | # non-false value, then it is used: 64 | #today = '' 65 | # Else, today_fmt is used as the format for a strftime call. 66 | #today_fmt = '%B %d, %Y' 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | exclude_patterns = [] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all 73 | # documents. 74 | #default_role = None 75 | 76 | # If true, '()' will be appended to :func: etc. cross-reference text. 77 | #add_function_parentheses = True 78 | 79 | # If true, the current module name will be prepended to all description 80 | # unit titles (such as .. function::). 81 | #add_module_names = True 82 | 83 | # If true, sectionauthor and moduleauthor directives will be shown in the 84 | # output. They are ignored by default. 85 | #show_authors = False 86 | 87 | # The name of the Pygments (syntax highlighting) style to use. 88 | pygments_style = 'sphinx' 89 | 90 | # A list of ignored prefixes for module index sorting. 91 | #modindex_common_prefix = [] 92 | 93 | # If true, keep warnings as "system message" paragraphs in the built documents. 94 | #keep_warnings = False 95 | 96 | 97 | # -- Options for HTML output ---------------------------------------------- 98 | 99 | # The theme to use for HTML and HTML Help pages. See the documentation for 100 | # a list of builtin themes. 101 | html_theme = 'default' 102 | 103 | # Theme options are theme-specific and customize the look and feel of a theme 104 | # further. For a list of options available for each theme, see the 105 | # documentation. 106 | #html_theme_options = {} 107 | 108 | # Add any paths that contain custom themes here, relative to this directory. 109 | #html_theme_path = [] 110 | 111 | # The name for this set of Sphinx documents. If None, it defaults to 112 | # " v documentation". 113 | #html_title = None 114 | 115 | # A shorter title for the navigation bar. Default is the same as html_title. 116 | #html_short_title = None 117 | 118 | # The name of an image file (relative to this directory) to place at the top 119 | # of the sidebar. 120 | #html_logo = None 121 | 122 | # The name of an image file (within the static path) to use as favicon of the 123 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 124 | # pixels large. 125 | #html_favicon = None 126 | 127 | # Add any paths that contain custom static files (such as style sheets) here, 128 | # relative to this directory. They are copied after the builtin static files, 129 | # so a file named "default.css" will overwrite the builtin "default.css". 130 | html_static_path = ['nstatic'] 131 | 132 | # Add any extra paths that contain custom files (such as robots.txt or 133 | # .htaccess) here, relative to this directory. These files are copied 134 | # directly to the root of the documentation. 135 | #html_extra_path = [] 136 | 137 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 138 | # using the given strftime format. 139 | #html_last_updated_fmt = '%b %d, %Y' 140 | 141 | # If true, SmartyPants will be used to convert quotes and dashes to 142 | # typographically correct entities. 143 | #html_use_smartypants = True 144 | 145 | # Custom sidebar templates, maps document names to template names. 146 | #html_sidebars = {} 147 | 148 | # Additional templates that should be rendered to pages, maps page names to 149 | # template names. 150 | #html_additional_pages = {} 151 | 152 | # If false, no module index is generated. 153 | #html_domain_indices = True 154 | 155 | # If false, no index is generated. 156 | #html_use_index = True 157 | 158 | # If true, the index is split into individual pages for each letter. 159 | #html_split_index = False 160 | 161 | # If true, links to the reST sources are added to the pages. 162 | #html_show_sourcelink = True 163 | 164 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 165 | #html_show_sphinx = True 166 | 167 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 168 | #html_show_copyright = True 169 | 170 | # If true, an OpenSearch description file will be output, and all pages will 171 | # contain a tag referring to it. The value of this option must be the 172 | # base URL from which the finished HTML is served. 173 | #html_use_opensearch = '' 174 | 175 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 176 | #html_file_suffix = None 177 | 178 | # Output file base name for HTML help builder. 179 | htmlhelp_basename = 'django-simple-forum-doc' 180 | 181 | 182 | # -- Options for LaTeX output --------------------------------------------- 183 | 184 | latex_elements = { 185 | # The paper size ('letterpaper' or 'a4paper'). 186 | #'papersize': 'letterpaper', 187 | 188 | # The font size ('10pt', '11pt' or '12pt'). 189 | #'pointsize': '10pt', 190 | 191 | # Additional stuff for the LaTeX preamble. 192 | #'preamble': '', 193 | } 194 | 195 | # Grouping the document tree into LaTeX files. List of tuples 196 | # (source start file, target name, title, 197 | # author, documentclass [howto, manual, or own class]). 198 | latex_documents = [ 199 | ('index', 'django-simple-forum.tex', u'django-simple-forum Documentation', 200 | u'django-simple-forum', 'manual'), 201 | ] 202 | 203 | # The name of an image file (relative to this directory) to place at the top of 204 | # the title page. 205 | #latex_logo = None 206 | 207 | # For "manual" documents, if this is true, then toplevel headings are parts, 208 | # not chapters. 209 | #latex_use_parts = False 210 | 211 | # If true, show page references after internal links. 212 | #latex_show_pagerefs = False 213 | 214 | # If true, show URL addresses after external links. 215 | #latex_show_urls = False 216 | 217 | # Documents to append as an appendix to all manuals. 218 | #latex_appendices = [] 219 | 220 | # If false, no module index is generated. 221 | #latex_domain_indices = True 222 | 223 | 224 | # -- Options for manual page output --------------------------------------- 225 | 226 | # One entry per manual page. List of tuples 227 | # (source start file, name, description, authors, manual section). 228 | man_pages = [ 229 | ('index', 'django-simple-forum', u'django-simple-forum Documentation', 230 | [u'django-simple-forum'], 1) 231 | ] 232 | 233 | # If true, show URL addresses after external links. 234 | #man_show_urls = False 235 | 236 | 237 | # -- Options for Texinfo output ------------------------------------------- 238 | 239 | # Grouping the document tree into Texinfo files. List of tuples 240 | # (source start file, target name, title, author, 241 | # dir menu entry, description, category) 242 | texinfo_documents = [ 243 | ('index', 'django-simple-forum', u'django-simple-forum Documentation', 244 | u'django-simple-forum', 'django-simple-forum', 'One line description of project.', 245 | 'Miscellaneous'), 246 | ] 247 | 248 | # Documents to append as an appendix to all manuals. 249 | #texinfo_appendices = [] 250 | 251 | # If false, no module index is generated. 252 | #texinfo_domain_indices = True 253 | 254 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 255 | #texinfo_show_urls = 'footnote' 256 | 257 | # If true, do not generate a @detailmenu in the "Top" node's menu. 258 | #texinfo_no_detailmenu = False 259 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | django-simple-forum's documentation: 2 | ===================================== 3 | 4 | Introduction: 5 | ============= 6 | 7 | django-simple-forum is a discussion board where people with similar interests can create and discuss various topics. You can also mention any particpant those are involved in the repsective topic in the comment. You can also receive email notifications when there is an update in the topic, when you follow the topic. 8 | 9 | 10 | Source Code is available in Micropyramid Repository(https://github.com/MicroPyramid/django-simple-forum.git). 11 | 12 | Modules used: 13 | 14 | * Python >= 2.6 (or Python 3.4) 15 | * Django = 1.9.6 16 | * JQuery >= 1.7 17 | * Django-compressor == 2.0 18 | * Microurl >=3.6.1 19 | * Boto == 2.40.0 20 | * Sendgrid == 2.2.1 21 | * django-ses-gateway 22 | 23 | 24 | Installation Procedure 25 | ====================== 26 | 27 | 1. Install django-simple-forum using the following command:: 28 | 29 | pip install django-simple-forum 30 | 31 | (or) 32 | 33 | git clone git://github.com/micropyramid/django-simple-forum.git 34 | 35 | cd django-simple-forum 36 | 37 | python setup.py install 38 | 39 | 2. Add app name in settings.py:: 40 | 41 | INSTALLED_APPS = [ 42 | '..................', 43 | 'compressor', 44 | 'django_simple_forum', 45 | '..................' 46 | ] 47 | 48 | 3. After installing/cloning, add the following details in settings file to send emails notifications:: 49 | 50 | # AWS details 51 | 52 | AWS_ACCESS_KEY_ID = "Your AWS Access Key" 53 | 54 | AWS_SECRET_ACCESS_KEY = "Your AWS Secret Key" 55 | 56 | or 57 | 58 | SG_USER = "Your Sendgrid Username" 59 | SG_PWD = "Your Sendgrid Password" 60 | 61 | 4. Use virtualenv to install requirements:: 62 | 63 | pip install -r requirements.txt 64 | 65 | 66 | Frontend Features: 67 | =================== 68 | 69 | * Social logins(facebook, gplus logins) for one click registration in forum. 70 | * Create topics for a category. 71 | * User can follow the topic, receive email notifications if you have enabled email notification settings in the profile. 72 | * User can vote to a topic, like a topic for displaying their interest. 73 | * When you commenting to a topic, you can refer any other member involved in the comment. 74 | * You can also send email notifications from the aws, sendgrid, mailgun email application by providing the application credentials. 75 | 76 | Dashboard Features: 77 | =================== 78 | 79 | * You can see all categories, topics, tags, badges lists in the admin dashboard, cand do the crud operations. 80 | * You can activate/deactiavte the topic to publish/hide it in forum. 81 | * We can give badges to the user, if user is an active user and to encourage the user activities. 82 | 83 | 84 | We are always looking to help you customize the whole or part of the code as you like. 85 | 86 | 87 | We welcome your feedback and support, raise github ticket if you want to report a bug. Need new features? `Contact us here`_ 88 | 89 | .. _contact us here: https://micropyramid.com/contact-us/ 90 | 91 | or 92 | 93 | mailto:: "hello@micropyramid.com" -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | appdirs==1.4.3 2 | boto==2.46.1 3 | coverage==4.4 4 | coveralls==1.1 5 | Django==1.11.21 6 | django-appconf==1.0.2 7 | django-compressor==2.1.1 8 | django-ses-gateway==0.1.1 9 | django-simple-pagination==1.1.4 10 | docopt==0.6.2 11 | lxml==3.7.3 12 | microurl==0.1.1 13 | packaging==16.8 14 | pyparsing==2.2.0 15 | python-http-client==2.2.1 16 | pytz==2017.2 17 | rcssmin==1.0.6 18 | requests==2.20.0 19 | rjsmin==1.0.12 20 | sendgrid==4.0.0 21 | six==1.10.0 22 | sorl-thumbnail==12.3 23 | -r sandbox/requirements.txt 24 | -------------------------------------------------------------------------------- /sandbox/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_django_simple_forum.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /sandbox/requirements.txt: -------------------------------------------------------------------------------- 1 | gunicorn==19.6.0 2 | whitenoise==3.1 3 | dj-database-url==0.4.1 4 | psycopg2==2.7 5 | -------------------------------------------------------------------------------- /sandbox/test_django_simple_forum/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MicroPyramid/django-simple-forum/13ad478a7680df8e2aa466485f0abbaf7fa059db/sandbox/test_django_simple_forum/__init__.py -------------------------------------------------------------------------------- /sandbox/test_django_simple_forum/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for test_django_simple_forum project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.8.9. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.8/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.8/ref/settings/ 11 | """ 12 | 13 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 14 | import os 15 | 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) 18 | 19 | 20 | # Quick-start development settings - unsuitable for production 21 | # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ 22 | 23 | # SECURITY WARNING: keep the secret key used in production secret! 24 | SECRET_KEY = '2d&#b_er%(0^c7z9^87_)*y_j3)2fh6e95v7+=*+-k7a9%emv_' 25 | 26 | # SECURITY WARNING: don't run with debug turned on in production! 27 | DEBUG = True 28 | 29 | ALLOWED_HOSTS = ['*'] 30 | 31 | 32 | # Application definition 33 | 34 | INSTALLED_APPS = ( 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | 'compressor', 42 | 'django_simple_forum', 43 | 'sorl.thumbnail', 44 | 'simple_pagination' 45 | ) 46 | 47 | MIDDLEWARE_CLASSES = ( 48 | 'django.contrib.sessions.middleware.SessionMiddleware', 49 | 'django.middleware.common.CommonMiddleware', 50 | 'django.middleware.csrf.CsrfViewMiddleware', 51 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 52 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 53 | 'django.contrib.messages.middleware.MessageMiddleware', 54 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 55 | 'django.middleware.security.SecurityMiddleware', 56 | ) 57 | 58 | ROOT_URLCONF = 'test_django_simple_forum.urls' 59 | 60 | TEMPLATES = [ 61 | { 62 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 63 | 'DIRS': ['templates'], 64 | 'APP_DIRS': True, 65 | 'OPTIONS': { 66 | 'context_processors': [ 67 | 'django.template.context_processors.debug', 68 | 'django.template.context_processors.request', 69 | 'django.contrib.auth.context_processors.auth', 70 | 'django.contrib.messages.context_processors.messages', 71 | ], 72 | }, 73 | }, 74 | ] 75 | 76 | WSGI_APPLICATION = 'test_django_simple_forum.wsgi.application' 77 | 78 | 79 | # Database 80 | # https://docs.djangoproject.com/en/1.8/ref/settings/#databases 81 | 82 | import dj_database_url 83 | 84 | DATABASES = { 85 | 'default': dj_database_url.config( 86 | default='sqlite:////{0}'.format(os.path.join(BASE_DIR, 'db.sqlite3')) 87 | ) 88 | } 89 | 90 | 91 | # Internationalization 92 | # https://docs.djangoproject.com/en/1.8/topics/i18n/ 93 | 94 | LANGUAGE_CODE = 'en-us' 95 | 96 | TIME_ZONE = 'UTC' 97 | 98 | USE_I18N = True 99 | 100 | USE_L10N = True 101 | 102 | USE_TZ = True 103 | 104 | 105 | # Static files (CSS, JavaScript, Images) 106 | # https://docs.djangoproject.com/en/1.8/howto/static-files/ 107 | 108 | 109 | STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') 110 | STATIC_URL = '/static/' 111 | 112 | GP_CLIENT_ID = "" 113 | GP_CLIENT_SECRET = "" 114 | 115 | FB_APP_ID = "" 116 | FB_SECRET = "" 117 | 118 | 119 | STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' 120 | -------------------------------------------------------------------------------- /sandbox/test_django_simple_forum/urls.py: -------------------------------------------------------------------------------- 1 | """test_django_simple_forum URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.8/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 14 | """ 15 | from django.conf.urls import include, url 16 | from django.contrib import admin 17 | 18 | urlpatterns = [ 19 | url(r'^admin/', include(admin.site.urls)), 20 | url(r'^', include('django_simple_forum.urls', namespace='django_simple_forum')) 21 | ] 22 | -------------------------------------------------------------------------------- /sandbox/test_django_simple_forum/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for test_django_simple_forum 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.8/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | from whitenoise.django import DjangoWhiteNoise 14 | 15 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_django_simple_forum.settings") 16 | 17 | application = get_wsgi_application() 18 | application = DjangoWhiteNoise(application) 19 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | from setuptools import setup, find_packages 3 | 4 | with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: 5 | README = readme.read() 6 | 7 | # allow setup.py to be run from any path 8 | os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) 9 | PROJECT_NAME = 'django-simple-forum' 10 | 11 | data_files = [] 12 | for dirpath, dirnames, filenames in os.walk(PROJECT_NAME): 13 | for i, dirname in enumerate(dirnames): 14 | if dirname.startswith('.'): 15 | del dirnames[i] 16 | if '__init__.py' in filenames: 17 | continue 18 | elif filenames: 19 | for f in filenames: 20 | data_files.append(os.path.join( 21 | dirpath[len(PROJECT_NAME) + 1:], f)) 22 | 23 | setup( 24 | name='django-simple-forum', 25 | version='0.0.5', 26 | packages=find_packages(exclude=['tests', 'tests.*']), 27 | include_package_data=True, 28 | description='A Full featured forum, easy to integrate and use.', 29 | long_description=README, 30 | url='https://github.com/MicroPyramid/django-simple-forum', 31 | author='Micropyramid', 32 | author_email='hello@micropyramid.com', 33 | classifiers=[ 34 | 'Environment :: Web Environment', 35 | 'Framework :: Django', 36 | 'Intended Audience :: Developers', 37 | 'Operating System :: OS Independent', 38 | 'License :: OSI Approved :: MIT License', 39 | 'Programming Language :: Python', 40 | 'Programming Language :: Python :: 2.7', 41 | 'Programming Language :: Python :: 3', 42 | 'Programming Language :: Python :: 3.2', 43 | 'Programming Language :: Python :: 3.3', 44 | 'Topic :: Internet :: WWW/HTTP', 45 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 46 | ], 47 | install_requires=[ 48 | "Django>=1.11.21", 49 | 'django-simple-pagination', 50 | 'django-storages', 51 | 'microurl', 52 | 'boto', 53 | 'sendgrid', 54 | 'sorl-thumbnail==12.4a1', 55 | 'django-ses-gateway' 56 | ], 57 | ) 58 | -------------------------------------------------------------------------------- /test_runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | import django 5 | from django.conf import settings 6 | from django.test.utils import get_runner 7 | from django.conf.urls import include, url 8 | 9 | 10 | if __name__ == "__main__": 11 | BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 12 | settings.configure( 13 | DATABASES={ 14 | 'default': { 15 | 'ENGINE': 'django.db.backends.sqlite3', 16 | } 17 | }, 18 | INSTALLED_APPS=( 19 | 'django.contrib.auth', 20 | 'django.contrib.contenttypes', 21 | 'django.contrib.sessions', 22 | 'django.contrib.staticfiles', 23 | 'sorl.thumbnail', 24 | 'simple_pagination', 25 | 'compressor', 26 | 'django_simple_forum', 27 | ), 28 | MIDDLEWARE_CLASSES=( 29 | 'django.contrib.sessions.middleware.SessionMiddleware', 30 | 'django.middleware.common.CommonMiddleware', 31 | 'django.middleware.csrf.CsrfViewMiddleware', 32 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 33 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 34 | ), 35 | ROOT_URLCONF='test_runner', 36 | STATIC_URL='/static/', 37 | STATIC_ROOT=BASE_DIR + '/static', 38 | STATICFILES_FINDERS=[ 39 | 'django.contrib.staticfiles.finders.FileSystemFinder', 40 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 41 | 'compressor.finders.CompressorFinder', 42 | ], 43 | TEMPLATES=[ 44 | { 45 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 46 | 'DIRS': [os.path.join(BASE_DIR, 'django_simple_forum/templates')], 47 | 'APP_DIRS': True, 48 | 'OPTIONS': { 49 | 'context_processors': [ 50 | 'django.template.context_processors.debug', 51 | 'django.template.context_processors.request', 52 | 'django.contrib.auth.context_processors.auth', 53 | 'django.contrib.messages.context_processors.messages', 54 | ], 55 | }, 56 | }, 57 | ], 58 | ALLOWED_HOSTS=[ 59 | 'django-forum.com', 60 | ], 61 | HOST_URL='http://django-forum.com', 62 | MAIL_SENDER=None 63 | ) 64 | 65 | django.setup() 66 | TestRunner = get_runner(settings) 67 | test_runner = TestRunner() 68 | failures = test_runner.run_tests(["django_simple_forum"]) 69 | sys.exit(bool(failures)) 70 | 71 | 72 | urlpatterns = [ 73 | url(r'^', include('django_simple_forum.urls', namespace='django_simple_forum')), 74 | ] 75 | --------------------------------------------------------------------------------