Skip to content

Commit

Permalink
#162. Massive changes in settings. We now have separate settings for …
Browse files Browse the repository at this point in the history
…development and production. Base settings were edited too to allow this. Lots of unnecessary settings were removed. Template settings were revised to match changes made to django 1.8.

Removed some functions from dictionary/models.py, I felt that we don't use those.
Removed stuff from feedback -> forms/models/views. From views removed LANGUAGE_NAME and COUNTRY_NAME, removed these from settings too, we don't need these.
Edited wsgi.py to use production.py settings.
Changed bootstrap_templates folder to 'templates' (avoiding confusion). Made necessary changes to template dirs in settings.
  • Loading branch information
henrinie committed Jun 2, 2016
1 parent 41e0d83 commit a0f6f3b
Show file tree
Hide file tree
Showing 30 changed files with 190 additions and 412 deletions.
19 changes: 0 additions & 19 deletions signbank/dictionary/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,25 +680,6 @@ def has_video(self):

return self.get_video() is not None

def published_definitions(self):
"""Return a query set of just the published definitions for this gloss
also filter out those fields not in DEFINITION_FIELDS"""

defs = self.definition_set.filter(published__exact=True)

return [d for d in defs if d.role in settings.DEFINITION_FIELDS]

def definitions(self):
"""Gather together the definitions for this gloss"""

defs = dict()
for d in self.definition_set.all().order_by('count'):
if not defs.has_key(d.role):
defs[d.role] = []

defs[d.role].append(d.text)
return defs

def options_to_json(self, options):
"""Convert an options list to a json dict"""

Expand Down
17 changes: 0 additions & 17 deletions signbank/feedback/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,6 @@ class GeneralFeedbackForm(forms.Form):
class SignFeedbackForm(forms.Form):
"""Form for input of sign feedback"""

# TODO: Change this variable name
isAuslan = forms.ChoiceField(
choices=isAuslanChoices, initial=0, widget=forms.RadioSelect)
# isAuslan = forms.IntegerField(initial=0, widget=forms.HiddenInput)
whereused = forms.ChoiceField(choices=whereusedChoices, initial="n/a")
# whereused = forms.CharField(initial='n/a', widget=forms.HiddenInput)
like = forms.ChoiceField(
choices=likedChoices, initial=0, widget=forms.RadioSelect)
# like = forms.IntegerField(initial=0, widget=forms.HiddenInput)
use = forms.ChoiceField(
choices=useChoices, initial=0, widget=forms.RadioSelect)
# use = forms.IntegerField(initial=0, widget=forms.HiddenInput)
suggested = forms.ChoiceField(
choices=suggestedChoices, initial=3, required=False, widget=forms.RadioSelect)
# suggested = forms.IntegerField(initial=0, widget=forms.HiddenInput)
correct = forms.ChoiceField(
choices=correctChoices, initial=0, widget=forms.RadioSelect)
# correct = forms.IntegerField(initial=0, widget=forms.HiddenInput)
kwnotbelong = forms.CharField(
# Translators: keywordnotbelong, label name
Expand Down
117 changes: 0 additions & 117 deletions signbank/feedback/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,100 +7,6 @@

# models to represent the feedback from users in the site

# Translators: isAuslanChoices
isAuslanChoices = ((1, _("yes")),
# Translators: isAuslanChoices
(2, _("Perhaps")),
# Translators: isAuslanChoices
(3, _("Don't know")),
# Translators: isAuslanChoices
(4, _("Don't think so")),
# Translators: isAuslanChoices
(5, _("No")),
# Translators: isAuslanChoices
(0, _("N/A"))
)

# TODO: Implement Finnish choices here, or remove the whole thing
if settings.LANGUAGE_NAME == "BSL":
whereusedChoices = (('Belfast', 'Belfast'),
('Birmingham', 'Birmingham'),
('Bristol', 'Bristol'),
('Cardiff', 'Cardiff'),
('Glasgow', 'Glasgow'),
('London', 'London'),
('Manchester', 'Manchester'),
('Newcastle', 'Newcastle'),
('Other', 'Other (note in comments)'),
("Don't Know", "Don't Know"),
('N/A', 'N/A'),
)
else:
whereusedChoices = (('auswide', 'Australia Wide'),
('dialectN', 'Dialect Sign (North)'),
('dialectS', 'Dialect Sign (South)'),
('nsw', "New South Wales"),
('vic', "Victoria"),
('qld', "Queensland"),
('wa', "Western Australia"),
('sa', "South Australia"),
('tas', "Tasmania"),
('nt', "Northern Territory"),
('act', "Australian Capital Territory"),
('dk', "Don't Know"),
('n/a', "N/A")
)
# Translators: likedChoices (feedback)
likedChoices = ((1, _("yes")),
# Translators: likedChoices
(2, _("A little")),
# Translators: likedChoices
(3, _("Don't care")),
# Translators: likedChoices
(4, _("Not much")),
# Translators: likedChoices
(5, _("No")),
# Translators: likedChoices
(0, _("N/A"))
)
# Translators: useChoices (feedback)
useChoices = ((1, _("yes")),
# Translators: useChoices
(2, _("Sometimes")),
# Translators: useChoices
(3, _("Not Often")),
# Translators: useChoices
(4, _("No")),
# Translators: useChoices
(0, _("N/A"))
)
# Translators: suggestedChoices (feedback)
suggestedChoices = ((1, _("yes")),
# Translators: suggestedChoices
(2, _("Sometimes")),
# Translators: suggestedChoices
(3, _("Don't Know")),
# Translators: suggestedChoices
(4, _("Perhaps")),
# Translators: suggestedChoices
(5, _("No")),
# Translators: suggestedChoices
(0, _("N/A"))
)
# Translators: correctChoices (feedback)
correctChoices = ((1, _("yes")),
# Translators: correctChoices
(2, _("Mostly Correct")),
# Translators: correctChoices
(3, _("Don't Know")),
# Translators: correctChoices
(4, _("Mostly Wrong")),
# Translators: correctChoices
(5, _("No")),
# Translators: correctChoices
(0, _("N/A"))
)

handformChoices = (
# Translators: Handform choice (feedback)
(1, _('One handed')),
Expand Down Expand Up @@ -257,13 +163,6 @@
)


def t(message):
"""Replace $country and $language in message with dat from settings"""

tpl = string.Template(message)
return tpl.substitute(country=settings.COUNTRY_NAME, language=settings.LANGUAGE_NAME)


STATUS_CHOICES = (('unread', 'unread'),
('read', 'read'),
('deleted', 'deleted'),
Expand Down Expand Up @@ -319,22 +218,6 @@ class SignFeedback(models.Model):
"Is there a keyword or keyword/s that DO NOT belong with this sign? Please provide the list of keywords below"),
blank=True)
# Translators: Question (sign feedback)
isAuslan = models.IntegerField(
_(t("Is this sign an $language Sign?")), choices=isAuslanChoices)
# Translators: Question (sign feedback)
whereused = models.CharField(
_("Where is this sign used?"), max_length=10, choices=whereusedChoices)
# Translators: Question (sign feedback)
like = models.IntegerField(_("Do you like this sign?"), choices=likedChoices)
# Translators: Question (sign feedback)
use = models.IntegerField(_("Do you use this sign?"), choices=useChoices)
# Translators: Question (sign feedback)
suggested = models.IntegerField(
_("If this sign is a suggested new sign, would you use it?"), default=3, choices=suggestedChoices)
# Translators: Question (sign feedback)
correct = models.IntegerField(
_("Is the information about the sign correct?"), choices=correctChoices)
# Translators: Question (sign feedback)
status = models.CharField(
max_length=10, choices=STATUS_CHOICES, default='unread')

Expand Down
7 changes: 0 additions & 7 deletions signbank/feedback/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
def index(request):
return render_to_response('feedback/index.html',
{
'language': settings.LANGUAGE_NAME,
'country': settings.COUNTRY_NAME,
# Translators: Title for feedback views index
'title': _("Leave Feedback")},
context_instance=RequestContext(request))
Expand Down Expand Up @@ -40,8 +38,6 @@ def generalfeedback(request):

return render_to_response("feedback/generalfeedback.html",
{
'language': settings.LANGUAGE_NAME,
'country': settings.COUNTRY_NAME,
# Translators: General Feedback title
'title': _("General Feedback"),
'form': form,
Expand Down Expand Up @@ -94,8 +90,6 @@ def missingsign(request):

return render_to_response('feedback/missingsign.html',
{
'language': settings.LANGUAGE_NAME,
'country': settings.COUNTRY_NAME,
# Translators Report Missing Sign title
'title': _("Report a Missing Sign"),
'posted': posted,
Expand Down Expand Up @@ -230,7 +224,6 @@ def recordsignfeedback(request, trans, n, total, trans_en, n_en, total_en):
'valid': valid,
'sourcepage': sourcepage,
'lastmatch': lastmatch,
'language': settings.LANGUAGE_NAME,
},
context_instance=RequestContext(request))

Expand Down
14 changes: 2 additions & 12 deletions signbank/registration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def save(self, profile_callback=None):
supplied.
"""
# TODO: line: "barf" gives error, what is it?

new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],
password=self.cleaned_data[
'password1'],
email=self.cleaned_data[
'email'],
profile_callback=profile_callback)
#barf

return new_user


Expand Down Expand Up @@ -220,16 +220,6 @@ def clean(self, value):
# Translators: yesnoChoices
(0, _('no')))

import string


def t(message): # TODO: Find out what this method it for, and delete it. Why would you need to substitute these?
"""Replace $country and $language in message with dat from settings"""

tpl = string.Template(message)
return tpl.substitute(country=settings.COUNTRY_NAME, language=settings.LANGUAGE_NAME)


class RegistrationFormSB(RegistrationFormUniqueEmail):

"""
Expand Down
9 changes: 0 additions & 9 deletions signbank/registration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,6 @@ def activation_key_expired(self):

from django.contrib.auth import models as authmodels

import string


def t(message):
"""Replace $country and $language in message with dat from settings"""

tpl = string.Template(message)
return tpl.substitute(country=settings.COUNTRY_NAME, language=settings.LANGUAGE_NAME)

class UserProfile(models.Model):

"""Extended profile for users of the site"""
Expand Down
Loading

0 comments on commit a0f6f3b

Please sign in to comment.