Skip to content
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
a8b6b91
Explanatory/searchable variable names
brylie Aug 5, 2017
6b5460d
Use meaningful variable names; cleanup
brylie Aug 5, 2017
b665262
Use meaningful variable name
brylie Aug 5, 2017
763980c
Meaningful variable names; cleanup
brylie Aug 5, 2017
6583c37
Cleanup
brylie Aug 5, 2017
f637aff
Cleanup
brylie Aug 5, 2017
4206771
Consistent whitespace
brylie Aug 5, 2017
b3c834c
Rename variable to queryset
brylie Aug 5, 2017
4802dd0
Consistent whitespace
brylie Aug 5, 2017
339eb9f
Meaningful variables; consistent class structure
brylie Aug 5, 2017
552c29e
Cleanup
brylie Aug 5, 2017
166dd67
Cleanup
brylie Aug 5, 2017
82e4741
Cleanup
brylie Aug 5, 2017
3bccf33
Cleanup
brylie Aug 5, 2017
ad2e98c
Meangingful variable names; whitespace
brylie Aug 5, 2017
bdc87af
Merge branch 'dev' into feature/clean-code-improvements
brylie Oct 9, 2017
29849cb
Merge branch 'dev' into feature/clean-code-improvements
brylie Oct 9, 2017
82f618a
add draft flag to frontend
JOO33 Dec 11, 2017
5a004c2
fix import ordering
JOO33 Dec 18, 2017
29a0253
remove erroneous draft commit
JOO33 Dec 18, 2017
4bdc5ba
final cleanup
JOO33 Jan 11, 2018
696b5c8
remove leftover unused imports from issue 34
JOO33 Jan 11, 2018
12c30d7
remove unrelated change and revert to orginal file state
JOO33 Jan 22, 2018
a6ee06c
CiviWiki Privacy Policy
mdwest Feb 1, 2018
bafbb87
Merge pull request #115 from CiviWiki/mdwest-patch-1
JL24 Feb 1, 2018
befd3cc
Adding the test framework
Unit111 Feb 12, 2018
828bf5a
Applying comments
petarPetrovBG Feb 13, 2018
7ad3eed
Fixed Github link, minor text fixes
Sv3nman Feb 19, 2018
6b91c15
remove old urls
JOO33 Jan 11, 2018
5361be3
fix undefined variables
JOO33 Jan 11, 2018
25b0b48
fix unmentioned undefined variables
JOO33 Jan 11, 2018
d99a842
meaningful variable name
JOO33 Jan 22, 2018
a2be707
Merge pull request #110 from CiviWiki/issue41_reorganize_imports
brylie Feb 19, 2018
5bb7d0e
Merge branch 'dev' into feature/clean-code-improvements
brylie Feb 19, 2018
54cae30
Merge pull request #26 from CiviWiki/feature/clean-code-improvements
brylie Feb 19, 2018
b08075d
bugfix
darcymeyer Feb 28, 2018
6776c06
added ID for my profile button
ryan-barrett Mar 2, 2018
3318dc5
Add ID to 'my feed' button in global_nav.html #133
WCollins3 Mar 4, 2018
4c16a1b
Add links to social channels
brylie Mar 5, 2018
29a7815
Merge pull request #155 from CiviWiki/brylie-patch-1
JL24 Mar 5, 2018
6579b80
Add link to Internet Archive meeting videos
brylie Mar 5, 2018
b58171e
Add ID to 'Add Problem" button in new_civi.html #138
WCollins3 Mar 7, 2018
2879102
Add ID to "Add Cause" button in new_civi.html #139
WCollins3 Mar 10, 2018
813502a
working django rest framework with thread, account, and category
JOO33 Mar 19, 2018
a6500c8
serializer for the models
JOO33 Mar 19, 2018
44af5a6
remove irrelevant file
JOO33 Mar 19, 2018
ddc4e8b
ID tags for logout and edit profile
mattyg915 Feb 25, 2018
91887f0
more HTML ID tags added
mattyg915 Mar 10, 2018
ec40cd7
base DRF based API
JOO33 Apr 16, 2018
e6ac0fb
Merge branch 'dev' of github.com:CiviWiki/OpenCiviWiki into django_re…
JOO33 Apr 16, 2018
fa50032
remove comment
JOO33 Apr 16, 2018
2a4998e
Csv export pr update (#169)
delta-plus Apr 16, 2018
5998f6f
move null check for profile image
JOO33 Apr 18, 2018
fbe6776
add error log filter decorators
JOO33 Apr 18, 2018
4ae92b7
switch to decorator syntax for property
JOO33 Apr 18, 2018
c3dc1dd
Add new favicon files
JOO33 Apr 21, 2018
373e2ca
add url links and simplify files
JOO33 Apr 21, 2018
5dc681d
Add CodeClimage badge; fix waffle
brylie Apr 23, 2018
9b0fd8d
Fix maintainability badge
brylie Apr 23, 2018
015b88e
Fix waffle badge
brylie Apr 23, 2018
b5884a4
Merge pull request #181 from CiviWiki/brylie-patch-2
JL24 Apr 23, 2018
20a3be4
fix misnamed variable in save
JOO33 Apr 25, 2018
1c450f1
incorporate country into data
JOO33 Apr 29, 2018
b0d808e
backend changes
JOO33 Apr 29, 2018
ff390cf
Merge branch 'dev' of github.com:CiviWiki/OpenCiviWiki into fix/issue…
JOO33 Apr 29, 2018
a6672e2
fix unicode issue
JOO33 Apr 29, 2018
ebf6150
add migration
JOO33 Apr 29, 2018
08a23b9
change placeholder text for autocomplete
JOO33 Apr 29, 2018
16d5db3
Merge pull request #189 from CiviWiki/fix/issue_124_locate
JL24 Apr 30, 2018
3dcd5bb
Merge branch 'dev' of github.com:CiviWiki/OpenCiviWiki into django_re…
JOO33 Apr 30, 2018
faee7bf
add issue section
JOO33 Apr 25, 2018
88f9c57
move issues to top of contributing
JOO33 Apr 30, 2018
2f652ef
add dev related links and reorganize
JOO33 Apr 23, 2018
e8cb003
change titles to be more descriptive
JOO33 Apr 23, 2018
9c114e8
fix live chat link
JOO33 Apr 23, 2018
ce58e39
nest child elements and remove extra space
JOO33 Apr 30, 2018
ccc02cd
Merge branch 'dev' of github.com:CiviWiki/OpenCiviWiki into django_re…
JOO33 May 1, 2018
b8077bb
add country field to rest api serializer
JOO33 May 1, 2018
ad21f78
Fixes #192
GokuMizuno May 19, 2018
13d4ca7
Fixes #161
GokuMizuno May 21, 2018
ea11deb
Merge pull request #195 from CiviWiki/GokuMizuno
JL24 May 21, 2018
cbbc3bc
fix image issue
JOO33 May 22, 2018
b9ff8b8
remove irrelevant files
JOO33 May 22, 2018
09eb928
correct errors
JOO33 May 28, 2018
771243f
rename variables
JOO33 May 28, 2018
df050d9
Merge pull request #196 from CiviWiki/fix/issue117_about_us
JL24 Jun 1, 2018
e3a67c2
add spaces around slash
JOO33 Jun 1, 2018
86941ba
descriptive variable names
JOO33 Jun 4, 2018
f604c82
Merge pull request #199 from CiviWiki/fix/issue_198_x_undefined
JL24 Jun 9, 2018
e1f06be
resolve merge conflict
JOO33 Jun 11, 2018
a706453
Merge pull request #164 from CiviWiki/django_rest_framework
JL24 Jun 11, 2018
becfa68
add link to heroku deployment instructions
JOO33 Jun 11, 2018
7c847d8
Merge pull request #201 from CiviWiki/fix/issue98_heroku_deployment_i…
JL24 Jun 13, 2018
57f805d
apply new numbers
JOO33 Jun 26, 2018
a37c618
reorder list
JOO33 Jun 26, 2018
858c5f1
fix equals
JOO33 Jun 26, 2018
5e303e9
Merge pull request #204 from CiviWiki/fix/issue203_reapply_dependency…
JL24 Jun 27, 2018
1026636
api changes
JOO33 Jul 22, 2018
691601d
Merge pull request #206 from CiviWiki/backbone_restructure_backend_ch…
JL24 Jul 28, 2018
f5f70c3
re-render thread on save edits
tomjohnhall Aug 3, 2018
7cbc8d9
re-render thread in editThread
tomjohnhall Aug 3, 2018
5c231f3
Separate thread-nav from body for update after edit.
tomjohnhall Aug 3, 2018
77cefa7
Merge branch 'dev' into thread-edit-refresh
tomjohnhall Aug 3, 2018
1e784e5
adds method to separate thread-body render from thread-nav for edits.
tomjohnhall Aug 3, 2018
69c3167
update drf to 3.8
JOO33 Aug 3, 2018
1f0c7e5
cleanup and add docstring
tomjohnhall Aug 8, 2018
a62d8a5
Merge pull request #216 from saxonhouse/thread-edit-refresh
JL24 Aug 21, 2018
8377afd
add ids for civi types to civi template
JOO33 Aug 21, 2018
f5feb83
Merge pull request #218 from CiviWiki/fix/pr202_needed_changes
JOO33 Aug 21, 2018
c228a89
Add id
gcs97 Oct 6, 2018
f8ad846
Update selector
gcs97 Oct 6, 2018
36675b3
Remove pushed VSCode settings file
gcs97 Oct 6, 2018
302f1e3
updates version number for cryptography package
dlarner3194 Oct 2, 2018
699998d
Added id to choose category button. Updated selector automated test
shaunak-gupta Oct 30, 2018
abba6f0
Update user-setup.js
Dec 6, 2018
9363c25
Remove extra line
Dec 6, 2018
c2d6587
Remove extra line
Dec 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.DS_Store
media/
staticfiles
.idea
Binary file added docs/Organization/CiviWiki Privacy Policy.odt
Binary file not shown.
9 changes: 8 additions & 1 deletion project/api/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,15 @@ def resize_profile_image(self):
tmp_image_file = StringIO.StringIO()
profile_image.save(tmp_image_file, 'JPEG', quality=90)
tmp_image_file.seek(0)
self.profile_image = InMemoryUploadedFile(tmp_image_file, 'ImageField', self.profile_image.name, 'image/jpeg', tmp_image_file.len, None)

self.profile_image = InMemoryUploadedFile(
tmp_image_file,
'ImageField',
self.profile_image.name,
'image/jpeg',
tmp_image_file.len,
None
)

# Make a Thumbnail Image for the new resized image
thumb_image = profile_image.copy()
Expand Down
1 change: 1 addition & 0 deletions project/api/models/activity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models

from .account import Account
from .civi import Civi
from .thread import Thread
Expand Down
11 changes: 5 additions & 6 deletions project/api/models/civi.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import random as r
import os, json, datetime, math, uuid

from calendar import month_name
from django.db import models
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.deconstruct import deconstructible

from django.core.files.storage import default_storage
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.conf import settings
from django.utils.deconstruct import deconstructible

from .account import Account
from .thread import Thread
from .bill import Bill
from .hashtag import Hashtag
from .thread import Thread

class CiviManager(models.Manager):
def summarize(self, civi):
Expand Down
2 changes: 1 addition & 1 deletion project/api/models/invitation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Handles beta/website access invitations
"""
from django.db import models
from django.contrib.auth.models import User
from django.db import models

class InvitationManager(models.Manager):
"""
Expand Down
1 change: 1 addition & 0 deletions project/api/models/notification.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models

from .account import Account
from .civi import Civi
from .thread import Thread
Expand Down
1 change: 1 addition & 0 deletions project/api/models/rationale.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models

from .bill import Bill
from .representative import Representative
from .vote import Vote
Expand Down
1 change: 1 addition & 0 deletions project/api/models/representative.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models

from utils.constants import US_STATES

class RepresentativeManager(models.Manager):
Expand Down
12 changes: 7 additions & 5 deletions project/api/models/thread.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os, uuid
from calendar import month_name

from django.core.files.storage import default_storage
from django.conf import settings
from django.db import models
from django.utils.deconstruct import deconstructible

from .account import Account
from .category import Category
from .fact import Fact
from .hashtag import Hashtag
from calendar import month_name
import os, uuid
from django.utils.deconstruct import deconstructible
from django.core.files.storage import default_storage
from django.conf import settings
from utils.constants import US_STATES

class ThreadManager(models.Manager):
Expand Down
1 change: 1 addition & 0 deletions project/api/models/vote.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models

from .bill import Bill
from .representative import Representative

Expand Down
20 changes: 10 additions & 10 deletions project/api/read.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from django.http import JsonResponse, HttpResponseBadRequest
from models import Account, Thread, Civi, Representative, Category, Activity
# Topic, Attachment, Category, Civi, Comment, Hashtag,
from django.contrib.auth.models import User
from django.http import JsonResponse, HttpResponseBadRequest
from django.forms.models import model_to_dict
from utils import json_response

from legislation import sunlightapi as sun
from models import Account, Thread, Civi, Representative, Activity
from utils import json_response

def get_user(request, user):
try:
Expand Down Expand Up @@ -89,14 +87,14 @@ def get_rep(request, rep_id):
# TODO: FINISH THIS
try:
# Federal Representatives only
u = Representative.objects.get(id=rep_id)
a = Account.objects.get(user=u)
result = Account.objects.summarize(a)
rep_user = Representative.objects.get(id=rep_id)
rep_account = Account.objects.get(user=rep_user)
result = Account.objects.summarize(rep_account)

result['representatives'] = []
if request.user.username != user:
if request.user.username != rep_user.username:
ra = Account.objects.get(user=request.user)
if user in ra.following.all():
if rep_user.username in ra.following.all():
result['follow_state'] = True
else:
result['follow_state'] = False
Expand Down Expand Up @@ -124,6 +122,8 @@ def get_thread(request, thread_id):
c = civis.order_by('-created')
c_scores = [ci.score(req_a.id) for ci in c]
c_data = [Civi.objects.serialize_s(ci) for ci in c]

problems = []
for idx, item in enumerate(c_data):
problems[idx]['score'] = c_scores[idx]

Expand Down
5 changes: 3 additions & 2 deletions project/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from __future__ import absolute_import

from django.conf import settings
from celery import shared_task
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.core.mail import get_connection, EmailMultiAlternatives
from django.template.loader import render_to_string

from celery import shared_task

@shared_task(name="send_email")
def send_email(subject="", recipient_list="", context=None):
Expand Down
4 changes: 3 additions & 1 deletion project/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.conf.urls import url
import read, write

from django.conf.urls import url


#TODO: RESTful API - http://www.django-rest-framework.org/
urlpatterns = [
url(r'^account_data/(?P<user>[-\w]+)/$', read.get_user, name='get user'),
Expand Down
10 changes: 3 additions & 7 deletions project/api/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@
from django.contrib.auth.decorators import user_passes_test
from django.contrib.sites.shortcuts import get_current_site


# civi packages
from api.forms import UpdateProfileImage
from api.models import Thread
from api.tasks import send_mass_email
from models import Account, Activity, Category, Civi, CiviImage, Invitation
from utils.custom_decorators import require_post_params
from utils.constants import US_STATES
from utils.custom_decorators import require_post_params


@login_required
@require_post_params(params=['title', 'summary', 'category_id'])
Expand Down Expand Up @@ -318,7 +315,6 @@ def editThread(request):
}
return JsonResponse({'data': return_data})


@login_required
def uploadphoto(request):
pass
Expand Down Expand Up @@ -417,7 +413,7 @@ def clearProfileImage(request):

return HttpResponse('Image Deleted')
except Exception:
return HttpResponseServerError(reason=str(default))
return HttpResponseServerError(reason=str("default"))
else:
return HttpResponseForbidden('allowed only via POST')

Expand Down Expand Up @@ -543,7 +539,7 @@ def requestFollow(request):
verb=u'is following you', # Verb
target=target_account, # Target Object
popup_string="{user} is now following you".format(user=account.full_name),
link="/{}/{}".format(profile, request.user.username)
link="/{}/{}".format("profile", request.user.username)
)

return JsonResponse({"result": data})
Expand Down Expand Up @@ -597,7 +593,7 @@ def editUserCategories(request):
account.save()

data = {
'user_categories' : list(account.categories.values_list('id', flat=True)) or all_categories
'user_categories' : list(account.categories.values_list('id', flat=True)) or "all_categories"
}
return JsonResponse({"result": data})
except Account.DoesNotExist as e:
Expand Down
22 changes: 10 additions & 12 deletions project/authentication/authentication.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
from django.contrib.auth.models import User
from api.models import Account, Invitation
from django.http import JsonResponse, HttpResponse, HttpResponseServerError, HttpResponseRedirect, HttpResponseBadRequest
from django.conf import settings
from django.contrib.auth import authenticate, logout, login
from utils.custom_decorators import require_post_params
from forms import AccountRegistrationForm, PasswordResetForm, RecoverUserForm
from api.tasks import send_email
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.sites.shortcuts import get_current_site
from django.http import JsonResponse, HttpResponse, HttpResponseServerError, HttpResponseRedirect, HttpResponseBadRequest
from django.shortcuts import get_object_or_404
from django.conf import settings

from django.template.response import TemplateResponse #TODO: move this out to views
from django.utils.crypto import salted_hmac
from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.utils.http import int_to_base36

from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils.crypto import salted_hmac

from django.template.response import TemplateResponse #TODO: move this out to views
from api.tasks import send_email
from api.models import Account, Invitation
from forms import AccountRegistrationForm, PasswordResetForm, RecoverUserForm
from utils.custom_decorators import require_post_params

class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
""" Token Generator for Email Confirmation """
Expand Down
11 changes: 6 additions & 5 deletions project/authentication/forms.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import re

from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import (
UserCreationForm, SetPasswordForm, PasswordResetForm as AuthRecoverUserForm
)
from django.utils.translation import ugettext_lazy as _
from reserved_usernames import RESERVED_USERNAMES
from api.tasks import send_email as task_send_email
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from django.contrib.auth.tokens import default_token_generator
from django.utils.translation import ugettext_lazy as _

import re
from api.tasks import send_email as task_send_email
from reserved_usernames import RESERVED_USERNAMES

class AccountRegistrationForm(UserCreationForm):
email = forms.EmailField(required=True)
Expand Down
1 change: 1 addition & 0 deletions project/civiwiki/routing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from channels.routing import route
from channels import include

from api import consumers

thread_routing = [
Expand Down
2 changes: 0 additions & 2 deletions project/frontend_views/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import views as v

urlpatterns = [
url(r'^dbview$', v.dbview, name='dbview'),
url(r'^login$', v.login_view, name='login'),
url(r'^beta$', v.beta_view, name='beta'),
url(r'^about$', v.about_view, name='about'),
Expand All @@ -14,7 +13,6 @@
url(r'^setup$', v.user_setup, name='user setup'),
url(r'^profile$', v.user_profile, name='default_profile'),
url(r'^settings$', v.settings_view, name='settings'),
url(r'^add_civi$', v.add_civi, name='add civi'),
url(r'^invite$', v.invite, name='invite'),
url(r'^beta_register/(?P<email>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/(?P<token>\w{31})$', v.beta_register, name='beta_register'),
url(r'^$', v.base_view, name='base'),
Expand Down
30 changes: 6 additions & 24 deletions project/frontend_views/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import json

from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.contrib.auth.decorators import user_passes_test
from django.contrib.auth.models import User
from django.db.models import F
from django.http import HttpResponse, HttpResponseRedirect
from django.template.response import TemplateResponse

from api.models import Category, Account, Thread, Civi, Activity, Invitation
from api.forms import UpdateProfileImage

# from legislation import sunlightapi as sun
from django.contrib.auth.decorators import user_passes_test
from utils.custom_decorators import beta_blocker, login_required, full_account
from utils.constants import US_STATES
from utils.custom_decorators import beta_blocker, login_required, full_account


def base_view(request):
if not request.user.is_authenticated():
Expand Down Expand Up @@ -146,24 +146,6 @@ def issue_thread(request, thread_id=None):
def create_group(request):
return TemplateResponse(request, 'newgroup.html', {})

@login_required
@beta_blocker
@full_account
def dbview(request):
result = [{'id': c.id, 'name': c.name} for c in Category.objects.all()]

return TemplateResponse(request, 'dbview.html', {'result': json.dumps(result)})


@login_required
@beta_blocker
@full_account
def add_civi(request):
categories = [{'id': c.id, 'name': c.name} for c in Category.objects.all()]
topics = [{'id': c.id, 'topic': c.topic} for c in Topic.objects.all()]

return TemplateResponse(request, 'add_civi.html', {'categories': json.dumps(categories), 'topics': json.dumps(topics)})


@login_required
@user_passes_test(lambda u: u.is_staff)
Expand Down
23 changes: 23 additions & 0 deletions project/test_framework/app/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
from contextlib import contextmanager

import logging
from aloe import around, world
from selenium.webdriver.remote.remote_connection import LOGGER
from selenium import webdriver

'''
this method sets a global variable of type WebDriver. This is the browser.
@around.all is a global hook. It will be ran once before all scenarios
After the last scenario is completed (pass or fail) the WebDriver will be closed
'''
@around.all
@contextmanager
def with_chrome():
LOGGER.setLevel(logging.WARNING)
driver_path = os.path.dirname(os.path.realpath(__file__)).replace("app", "conf\chromedriver.exe")
world.browser = webdriver.Chrome(executable_path = driver_path)
world.browser.maximize_window()
yield
world.browser.quit()
delattr(world, 'browser')
Loading