Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
monty5811 committed Dec 9, 2016
1 parent 85c33fc commit 9e55afc
Show file tree
Hide file tree
Showing 21 changed files with 235 additions and 166 deletions.
22 changes: 14 additions & 8 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ class ElvantoGroupSerializer(serializers.ModelSerializer):

class Meta:
model = ElvantoGroup
fields = ('name',
'pk',
'sync',
'last_synced', )
fields = (
'name',
'pk',
'sync',
'last_synced',
)


class KeywordSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -134,8 +136,10 @@ class Meta:
class RecipientSimpleSerializer(serializers.ModelSerializer):
class Meta:
model = Recipient
fields = ('full_name',
'pk', )
fields = (
'full_name',
'pk',
)


class RecipientGroupSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -168,8 +172,10 @@ class UserSerializer(serializers.ModelSerializer):

class Meta:
model = User
fields = ('email',
'username', )
fields = (
'email',
'username',
)


class UserProfileSerializer(serializers.ModelSerializer):
Expand Down
20 changes: 12 additions & 8 deletions apostello/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
@admin.register(models.SmsOutbound)
class SmsOutboundAdmin(admin.ModelAdmin):
"""Admin class for apostello.models.SmsOutbound."""
list_display = ('content',
'recipient',
'time_sent',
'sent_by',
'sid', )
list_display = (
'content',
'recipient',
'time_sent',
'sent_by',
'sid',
)


@admin.register(models.SmsInbound)
Expand Down Expand Up @@ -58,9 +60,11 @@ class RecipientAdmin(admin.ModelAdmin):
@admin.register(models.RecipientGroup)
class RecipientGroupAdmin(admin.ModelAdmin):
"""Admin class for apostello.models.RecipientGroup."""
list_display = ('name',
'description',
'is_archived', )
list_display = (
'name',
'description',
'is_archived',
)


admin.site.unregister(User)
Expand Down
4 changes: 1 addition & 3 deletions apostello/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def handle_outgoing_sms(msg):
return check_next_page
except Exception:
logger.error(
'Could not import sms.', exc_info=True, extra={
'msg': msg
}
'Could not import sms.', exc_info=True, extra={'msg': msg}
)


Expand Down
8 changes: 4 additions & 4 deletions apostello/reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def start_bg_tasks(self):
* Schedules a task to check the outgoing log one minute from now
"""
async(
'apostello.tasks.log_msg_in', self.msg_params, timezone.now(),
self.contact.pk
'apostello.tasks.log_msg_in', self.msg_params,
timezone.now(), self.contact.pk
)
async(
'apostello.tasks.sms_to_slack', self.sms_body, str(self.contact),
str(self.keyword)
'apostello.tasks.sms_to_slack', self.sms_body,
str(self.contact), str(self.keyword)
)
async(
'apostello.tasks.blacklist_notify', self.contact.pk, self.sms_body,
Expand Down
2 changes: 2 additions & 0 deletions apostello/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def ask_for_name(person_from_pk, sms_body, ask_for_name):
' asked for their name.'.format(sms_body, str(contact)),
)


# SMS logging and consistency checks


Expand Down Expand Up @@ -138,6 +139,7 @@ def update_msgs_name(person_pk):
sms.sender_name = name
sms.save()


# notifications, email, slack etc


Expand Down
33 changes: 22 additions & 11 deletions apostello/templatetags/apostello_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def fab_button(href, text, icon_name):
'''.format(
href=href,
text=text,
icon_name=icon_name, )
icon_name=icon_name,
)
return mark_safe(result)


Expand All @@ -32,7 +33,8 @@ def fab_new_contact():
@register.simple_tag
def fab_contacts_archive():
return fab_button(
reverse('recipients_archive'), 'Archived Contacts', 'table')
reverse('recipients_archive'), 'Archived Contacts', 'table'
)


# Groups
Expand All @@ -46,7 +48,8 @@ def fab_new_group():
@register.simple_tag
def fab_groups_archive():
return fab_button(
reverse('recipient_groups_archive'), 'Archived Groups', 'table')
reverse('recipient_groups_archive'), 'Archived Groups', 'table'
)


@register.simple_tag
Expand All @@ -65,7 +68,8 @@ def fab_incoming_wall():
@register.simple_tag
def fab_incoming_wall_curator():
return fab_button(
reverse('incoming_wall_curator'), 'Live Curator', 'table')
reverse('incoming_wall_curator'), 'Live Curator', 'table'
)


# Keywords
Expand All @@ -84,16 +88,19 @@ def fab_keywords():
@register.simple_tag
def fab_keywords_archive():
return fab_button(
reverse('keywords_archive'), 'Archived Keywords', 'table')
reverse('keywords_archive'), 'Archived Keywords', 'table'
)


@register.simple_tag
def fab_keyword_csv(keyword):
return fab_button(
reverse(
'keyword_csv', args=[keyword.pk]),
'keyword_csv', args=[keyword.pk]
),
'Export {k} responses'.format(k=keyword.keyword),
'download')
'download'
)


@register.simple_tag
Expand All @@ -105,15 +112,19 @@ def fab_keyword_edit(keyword):
def fab_keyword_responses(keyword):
return fab_button(
reverse(
'keyword_responses', args=[keyword.pk]),
'keyword_responses', args=[keyword.pk]
),
'Replies ({n})'.format(n=keyword.num_matches),
'inbox')
'inbox'
)


@register.simple_tag
def fab_keyword_responses_archive(keyword):
return fab_button(
reverse(
'keyword_responses_archive', args=[keyword.pk]),
'keyword_responses_archive', args=[keyword.pk]
),
'Archived Replies ({n})'.format(n=keyword.num_archived_matches),
'inbox')
'inbox'
)
6 changes: 4 additions & 2 deletions apostello/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,11 @@
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
# auth-setup
url(r'^api-setup/$',
url(
r'^api-setup/$',
v.APISetupView.as_view(),
name='api-setup', ),
name='api-setup',
),
# edit user profiles
url(
r'^users/profiles/(?P<pk>\d+)/$',
Expand Down
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
# The full version, including alpha/beta/rc tags.
release = '0.1'
language = None
exclude_patterns = ['_build',
'venv', ]
exclude_patterns = [
'_build',
'venv',
]
# default_role = None
# add_function_parentheses = True
# add_module_names = True
Expand Down
90 changes: 60 additions & 30 deletions docs/demo_screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,66 @@

DEMO_URL = "https://apostello-demo.herokuapp.com"
PAGES = [
('/accounts/signup',
'Signup', ),
('/accounts/login',
'Login', ),
('/accounts/logout',
'Logout', ),
('/send/adhoc/',
'SendtoIndividuals', ),
('/send/group/',
'SendtoGroup', ),
('/recipient/all/',
'Recipients', ),
('/recipient/edit/1/',
'RecipientEdit', ),
('/keyword/all/',
'Keywords', ),
('/keyword/edit/1/',
'KeywordEdit', ),
('/keyword/responses/1/',
'KeywordResponses', ),
('/incoming/',
'IncomingLog', ),
('/incoming/wall/',
'IncomingWall', ),
('/outgoing/',
'OutgoingLog', ),
('/elvanto/import',
'ElvantoSync', ),
('/',
'Home', ),
(
'/accounts/signup',
'Signup',
),
(
'/accounts/login',
'Login',
),
(
'/accounts/logout',
'Logout',
),
(
'/send/adhoc/',
'SendtoIndividuals',
),
(
'/send/group/',
'SendtoGroup',
),
(
'/recipient/all/',
'Recipients',
),
(
'/recipient/edit/1/',
'RecipientEdit',
),
(
'/keyword/all/',
'Keywords',
),
(
'/keyword/edit/1/',
'KeywordEdit',
),
(
'/keyword/responses/1/',
'KeywordResponses',
),
(
'/incoming/',
'IncomingLog',
),
(
'/incoming/wall/',
'IncomingWall',
),
(
'/outgoing/',
'OutgoingLog',
),
(
'/elvanto/import',
'ElvantoSync',
),
(
'/',
'Home',
),
]


Expand Down
10 changes: 6 additions & 4 deletions elvanto/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
@admin.register(models.ElvantoGroup)
class ElvantoGroupAdmin(admin.ModelAdmin):
"""Admin class for apostello.models.ElvantoGroup."""
list_display = ('name',
'sync',
'e_id',
'last_synced', )
list_display = (
'name',
'sync',
'e_id',
'last_synced',
)
5 changes: 2 additions & 3 deletions settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissions'
],
'DEFAULT_PERMISSION_CLASSES':
['rest_framework.permissions.DjangoModelPermissions'],
'DEFAULT_PAGINATION_CLASS':
'rest_framework.pagination.PageNumberPagination',
'DEFAULT_AUTHENTICATION_CLASSES': (
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
license='MIT',
zip_safe=False,
include_package_data=True,
classifiers=[
"Private :: Do Not Upload"
],
classifiers=["Private :: Do Not Upload"],
keywords=('Python, twilio, sms, church, django, '),
)

0 comments on commit 9e55afc

Please sign in to comment.