Skip to content

Commit

Permalink
Changed membership base from group_roles to group.
Browse files Browse the repository at this point in the history
Fixed migrations issue.
Added management command to fix psql pk issue.
Added required creation on new community.
  • Loading branch information
yaniv14 committed Jun 17, 2015
1 parent 2dce0a4 commit 61651d5
Show file tree
Hide file tree
Showing 32 changed files with 530 additions and 97 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pytz

#search
Whoosh==2.7.0
django-haystack==2.3.1
django-haystack==2.4.0

# queue
redis
Expand Down
15 changes: 11 additions & 4 deletions src/communities/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ class CommunityConfidentialReasonInline(TabularInline):

class CommunityGroupRoleInline(TabularInline):
model = models.CommunityGroupRole
extra = 1
extra = 0


class CommunityGroupInline(TabularInline):
model = models.CommunityGroup
extra = 1
extra = 0


class CommitteeInline(TabularInline):
model = models.Committee
extra = 0


class CommunityMembershipInline(TabularInline):
model = Membership
fk_name = 'community'
extra = 0


class CommunityAdmin(ModelAdmin):
Expand All @@ -32,11 +38,12 @@ class CommunityAdmin(ModelAdmin):
'allow_links_in_emails', 'register_missing_board_members',
'email_invitees', 'inform_system_manager', 'no_meetings_community')

inlines = [CommunityConfidentialReasonInline, CommunityMembershipInline, CommunityGroupInline]
inlines = [CommitteeInline, CommunityConfidentialReasonInline, CommunityMembershipInline, CommunityGroupInline]


class CommitteeAdmin(ModelAdmin):

list_display = ['community', 'name', 'slug']
list_display_links = ['community', 'name', 'slug']
fields = ('community', 'name', 'slug', 'official_identifier', 'logo', 'is_public',
'straw_voting_enabled', 'issue_ranking_enabled',
'allow_links_in_emails', 'register_missing_board_members',
Expand Down
Binary file modified src/communities/locale/he/LC_MESSAGES/django.mo
Binary file not shown.
26 changes: 18 additions & 8 deletions src/communities/locale/he/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Open Community\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 00:02+0300\n"
"PO-Revision-Date: 2015-06-07 12:37+0200\n"
"POT-Creation-Date: 2015-06-17 21:55+0300\n"
"PO-Revision-Date: 2015-06-17 16:14+0200\n"
"Last-Translator: Yaniv Mirel <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: he\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.7.6\n"
"X-Generator: Poedit 1.8.1\n"

#: .\apps.py:7
msgid "Communities & Committees"
Expand Down Expand Up @@ -228,8 +228,8 @@ msgid "Group"
msgstr "קבוצה"

#: .\models.py:587 .\templates\communities\communitygroup_detail.html:4
#: .\templates\communities\communitygroup_form.html:4
#: .\templates\communities\communitygroup_list.html:4
#: .\templates\communities\communitygrouprole_list.html:4
msgid "Groups"
msgstr "קבוצות"

Expand All @@ -241,6 +241,7 @@ msgstr "קבוצת Role"
msgid "Group Roles"
msgstr "קבוצות Role"

#: .\models.py:637
#: .\south_migrations\0011_auto__add_field_community_register_missing_board_members__chg_field_co.py:17
#: .\templates\communities\participants_form.html:27
msgid "Board"
Expand Down Expand Up @@ -377,19 +378,25 @@ msgid "Next"
msgstr "הבא"

#: .\templates\communities\communitygroup_detail.html:9
#: .\templates\communities\communitygrouprole_detail.html:9
#: .\templates\communities\participants_form.html:10
#: .\templates\communities\upcoming.html:69
msgid "Edit"
msgstr "עריכה"

#: .\templates\communities\communitygroup_form.html:4
msgid "Create"
msgstr "צור"
#: .\templates\communities\communitygroup_form.html:5
#: .\templates\communities\communitygrouprole_form.html:5
msgid "Create new group"
msgstr "צור קבוצה"

#: .\templates\communities\communitygroup_list.html:21
msgid "Create Group"
msgstr "צור קבוצה"

#: .\templates\communities\communitygrouprole_list.html:34
msgid "Create Group Role"
msgstr "צור קבוצת Role"

#: .\templates\communities\edit_summary.html:5
msgid "Edit summary"
msgstr "ערוך סיכום"
Expand Down Expand Up @@ -950,10 +957,13 @@ msgstr "מספר עמוד צריך להיות 1 או יותר."
msgid "No such page!"
msgstr "דף לא קיים!"

#: .\views.py:430
#: .\views.py:431 .\views.py:473
msgid "Group already exists"
msgstr "קבוצה בשם זה כבר קיימת"

#~ msgid "Create"
#~ msgstr "צור"

#~ msgid "Board name"
#~ msgstr "שם הועד"

Expand Down
Binary file modified src/communities/locale/he/LC_MESSAGES/djangojs.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion src/communities/locale/he/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Open Community\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 00:02+0300\n"
"POT-Creation-Date: 2015-06-17 21:55+0300\n"
"PO-Revision-Date: 2014-02-11 12:50+0200\n"
"Last-Translator: Yaniv Mirel <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
12 changes: 12 additions & 0 deletions src/communities/management/commands/fix_psql_pk_issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding: utf-8
from django.core.management.base import BaseCommand
from django.db import connection, transaction


class Command(BaseCommand):
help = "Fix duplicate key value violates unique constraint error on committee table"

def handle(self, *args, **options):
cursor = connection.cursor()
cursor.execute("SELECT setval('communities_committee_id_seq', (SELECT MAX(id) FROM communities_committee)+1)")
print "Done"
16 changes: 16 additions & 0 deletions src/communities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,23 @@ def set_default_confidental_reasons(sender, instance, created,
dispatch_uid='set_default_confidental_reasons',
**kwargs):
if created:
# Create confidential reasons
for reason in settings.OPENCOMMUNITY_DEFAULT_CONFIDENTIAL_REASONS:
CommunityConfidentialReason.objects.create(community=instance, title=ugettext(reason))

# Create default groups
for group in settings.OPENCOMMUNITY_DEFAULT_GROUPS:
CommunityGroup.objects.create(community=instance, title=ugettext(group))

# Create default roles
for role in settings.OPENCOMMUNITY_DEFAULT_ROLES:
Role.objects.create(community=instance, title=role['title'], based_on=role['based_on'])

committee = Committee.objects.create(community=instance, name=ugettext('Board'), slug='main')
# Create default group roles
for group_role in settings.OPENCOMMUNITY_DEFAULT_GROUP_ROLES:
CommunityGroupRole.objects.create(
committee=committee,
role=instance.roles.get(title=group_role),
group=instance.groups.get(title=ugettext(group_role))
)
1 change: 1 addition & 0 deletions src/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def upgrade_to_django_18(restart=True):
run("cd src && python manage.py migrate taggit --fake-initial")
run("cd src && python manage.py migrate issues 0003 --fake")
run("cd src && python manage.py migrate --noinput")
run("cd src && python manage.py fix_psql_pk_issue")
run("cd src && python manage.py collectstatic --noinput")
run("git log -n 1 --format=\"%ai %h\" > static/version.txt")
run("git log -n 1 > static/version-full.txt")
Expand Down
Binary file modified src/issues/locale/he/LC_MESSAGES/django.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion src/issues/locale/he/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Open Community\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 00:02+0300\n"
"POT-Creation-Date: 2015-06-17 21:55+0300\n"
"PO-Revision-Date: 2015-05-14 13:18+0200\n"
"Last-Translator: Yaniv Mirel <[email protected]>\n"
"Language-Team: \n"
Expand Down
Binary file modified src/issues/locale/he/LC_MESSAGES/djangojs.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion src/issues/locale/he/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Open Community\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 00:02+0300\n"
"POT-Creation-Date: 2015-06-17 21:55+0300\n"
"PO-Revision-Date: 2015-03-05 16:27+0200\n"
"Last-Translator: Yaniv Mirel <[email protected]>\n"
"Language-Team: \n"
Expand Down
21 changes: 21 additions & 0 deletions src/issues/migrations/0007_auto_20150617_2036.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import django.core.files.storage
import issues.models


class Migration(migrations.Migration):

dependencies = [
('issues', '0006_remove_issue_community'),
]

operations = [
migrations.AlterField(
model_name='issueattachment',
name='file',
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(b'C:\\projects\\OpenCommunity\\uploads'), upload_to=issues.models.issue_attachment_path, max_length=200, verbose_name='File'),
),
]
Binary file modified src/meetings/locale/he/LC_MESSAGES/django.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion src/meetings/locale/he/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Open Community\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 00:02+0300\n"
"POT-Creation-Date: 2015-06-17 21:55+0300\n"
"PO-Revision-Date: 2015-05-14 13:18+0200\n"
"Last-Translator: Yaniv Mirel <[email protected]>\n"
"Language-Team: \n"
Expand Down
Binary file modified src/ocd/locale/he/LC_MESSAGES/django.mo
Binary file not shown.
38 changes: 25 additions & 13 deletions src/ocd/locale/he/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Open Community\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-08 00:02+0300\n"
"PO-Revision-Date: 2015-06-07 13:14+0200\n"
"POT-Creation-Date: 2015-06-17 21:55+0300\n"
"PO-Revision-Date: 2015-06-17 21:56+0200\n"
"Last-Translator: Yaniv Mirel <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: he\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.7.6\n"
"X-Generator: Poedit 1.8.1\n"

#: .\base_models.py:13
msgid "HTML content"
Expand All @@ -32,27 +32,34 @@ msgid ""
msgstr ""

#: .\settings.py:300
msgid "Admin"
msgstr "אדמין"
msgid "admin"
msgstr "מנהל קהילה"

#: .\settings.py:301 .\templates\search\search.html:14
#: .\templates\search\search.html.py:18 .\templates\search\search.html:22
msgid "All"
msgstr "כל חברי הקהילה"
#: .\settings.py:301 .\settings.py:307
msgid "chairman"
msgstr "יושב ראש"

#: .\settings.py:302 .\settings.py:308
msgid "board"
msgstr "חבר ועד"

#: .\settings.py:303 .\settings.py:309
msgid "member"
msgstr "חבר קהילה"

#: .\settings.py:305
#: .\settings.py:319
msgid "Privacy"
msgstr "פרטיות"

#: .\settings.py:306
#: .\settings.py:320
msgid "Commercial"
msgstr "מסחרי"

#: .\settings.py:307
#: .\settings.py:321
msgid "Security"
msgstr "ביטחון"

#: .\settings.py:308
#: .\settings.py:322
msgid "Legal"
msgstr "משפטי"

Expand Down Expand Up @@ -304,6 +311,11 @@ msgstr "אפס סיסמא"
msgid "Search"
msgstr "חיפוש"

#: .\templates\search\search.html:14 .\templates\search\search.html.py:18
#: .\templates\search\search.html:22
msgid "All"
msgstr "כל חברי הקהילה"

#: .\templates\search\search.html:15 .\templates\search\search.html.py:19
#: .\templates\search\search.html:23
msgid "Issues"
Expand Down
18 changes: 16 additions & 2 deletions src/ocd/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,22 @@
}

OPENCOMMUNITY_DEFAULT_GROUPS = [
gettext('Admin'),
gettext('All')
gettext('admin'),
gettext('chairman'),
gettext('board'),
gettext('member')
]

OPENCOMMUNITY_DEFAULT_GROUP_ROLES = [
gettext('chairman'),
gettext('board'),
gettext('member')
]

OPENCOMMUNITY_DEFAULT_ROLES = [
{'title': 'chairman', 'based_on': 'manager'},
{'title': 'board', 'based_on': 'participant'},
{'title': 'member', 'based_on': 'observer'}
]

OPENCOMMUNITY_DEFAULT_CONFIDENTIAL_REASONS = [
Expand Down
Loading

0 comments on commit 61651d5

Please sign in to comment.