author | Lennard de Rijk <ljvderijk@gmail.com> |
Tue, 25 Aug 2009 15:28:50 +0200 | |
changeset 2797 | 236e5b192295 |
parent 2162 | 03ed2fa5ccc8 |
permissions | -rw-r--r-- |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.5 |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
2 |
# |
1308
35b75ffcbb37
Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1307
diff
changeset
|
3 |
# Copyright 2008 the Melange authors. |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
4 |
# |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
6 |
# you may not use this file except in compliance with the License. |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
7 |
# You may obtain a copy of the License at |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
8 |
# |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
10 |
# |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
11 |
# Unless required by applicable law or agreed to in writing, software |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
14 |
# See the License for the specific language governing permissions and |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
15 |
# limitations under the License. |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
16 |
|
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
17 |
"""This module contains the Group Model.""" |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
18 |
|
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
19 |
__authors__ = [ |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
20 |
'"Todd Larsen" <tlarsen@google.com>', |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
21 |
'"Lennard de Rijk" <ljvderijk@gmail.com>', |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
22 |
'"Pawel Solyga" <pawel.solyga@gmail.com>', |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
23 |
] |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
24 |
|
208
e076aee6e90f
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
25 |
|
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
26 |
from google.appengine.ext import db |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
27 |
|
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
28 |
from django.utils.translation import ugettext |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
29 |
|
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
30 |
from soc.models import countries |
316
9efdc7bc3565
Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
298
diff
changeset
|
31 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
533
diff
changeset
|
32 |
import soc.models.presence |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
33 |
import soc.models.user |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
34 |
|
316
9efdc7bc3565
Add missing blank lines between imports and sort all of the imports.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
298
diff
changeset
|
35 |
|
534
c31cfbf1a20f
Replace HomeSettings with Presence Model class. Replace SiteSettings with
Todd Larsen <tlarsen@google.com>
parents:
533
diff
changeset
|
36 |
class Group(soc.models.presence.Presence): |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
37 |
"""Common data fields for all groups. |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
38 |
""" |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
39 |
|
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
40 |
#: Required field storing name of the group. |
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
41 |
name = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
42 |
verbose_name=ugettext('Name')) |
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
43 |
name.help_text = ugettext('Complete, formal name of the group.') |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
44 |
|
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
45 |
#: Required field storing short name of the group. |
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
46 |
#: It can be used for displaying group as sidebar menu item. |
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
47 |
short_name = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
48 |
verbose_name=ugettext('Short name')) |
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
49 |
short_name.help_text = ugettext('Short name used for sidebar menu') |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
50 |
|
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
51 |
#: Required many:1 relationship indicating the founding User of the |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
52 |
#: Group (this relationship is needed to keep track of lifetime group |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
53 |
#: creation limits, used to prevent spamming, etc.). |
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
54 |
founder = db.ReferenceProperty(reference_class=soc.models.user.User, |
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
55 |
required=True, collection_name="groups", |
2053
a614b9d4821e
Replace "Founded by" with "Registered by" in soc.models.group module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
1961
diff
changeset
|
56 |
verbose_name=ugettext('Registered by')) |
344
d135c8c09967
Change verbose_name of founder property in Group model from "Created by" to "Founded by". Add GROUP_TYPE_SHORT and GROUP_TYPE_PLURAL for all models that inherit from Group and use that values in templates and contexts. Assume that group_type, group_type_short and group_type_plural are defined in context and remove not needed ifs in templates. Rename "Linkname" to "Link name" in list/group_heading.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
333
diff
changeset
|
57 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
58 |
#: Required field storing a home page URL of the group. |
259
74eb6b01c82c
Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
208
diff
changeset
|
59 |
home_page = db.LinkProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
60 |
verbose_name=ugettext('Home Page URL')) |
1562
0e1a93e0c54d
Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1308
diff
changeset
|
61 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
62 |
#: Required email address used as the "public" contact mechanism for |
481
94834a1e6c01
Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents:
410
diff
changeset
|
63 |
#: the Group (as opposed to the founder.account email address which is |
94834a1e6c01
Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents:
410
diff
changeset
|
64 |
#: kept secret, revealed only to Developers). |
259
74eb6b01c82c
Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
208
diff
changeset
|
65 |
email = db.EmailProperty(required=True, |
1877
93dfd2d40c0b
Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1562
diff
changeset
|
66 |
verbose_name=ugettext('Email')) |
93dfd2d40c0b
Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1562
diff
changeset
|
67 |
email.help_text = ugettext( |
93dfd2d40c0b
Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1562
diff
changeset
|
68 |
"Enter an email address to be used by would-be members seeking " |
93dfd2d40c0b
Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1562
diff
changeset
|
69 |
"additional information. This can be an individual's email address or a " |
93dfd2d40c0b
Updated help text for email properties in Group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1562
diff
changeset
|
70 |
"mailing list address; use whichever will work best for you.") |
1562
0e1a93e0c54d
Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1308
diff
changeset
|
71 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
72 |
#: Required field storing description of the group. |
259
74eb6b01c82c
Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
208
diff
changeset
|
73 |
description = db.TextProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
74 |
verbose_name=ugettext('Description')) |
1562
0e1a93e0c54d
Made mailing lists and IRC channel required for group/org applications.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1308
diff
changeset
|
75 |
|
772
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
76 |
#: Optional public mailing list. |
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
77 |
pub_mailing_list = db.StringProperty(required=False, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
78 |
verbose_name=ugettext('Public Mailing List')) |
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
79 |
pub_mailing_list.help_text = ugettext( |
772
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
80 |
'Mailing list email address, URL to sign-up page, etc.') |
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
81 |
|
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
82 |
#: Optional public IRC channel. |
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
83 |
irc_channel = db.StringProperty(required=False, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
84 |
verbose_name=ugettext('Public IRC Channel (and Network)')) |
772
a91f7856754e
Add IRC channel and mailing list properties to the Group and Organization
Todd Larsen <tlarsen@google.com>
parents:
685
diff
changeset
|
85 |
|
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
86 |
#==================================================================== |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
87 |
# (private) contact information |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
88 |
#==================================================================== |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
89 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
90 |
#: Required field containing a group street address. |
2162 | 91 |
#: Group street address can only be ASCII, not UTF-8 text, |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
92 |
#: because, if supplied, it might be used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
93 |
contact_street = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
94 |
verbose_name=ugettext('Street address')) |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
95 |
contact_street.help_text = ugettext( |
2162 | 96 |
'street number and name, ' |
97 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
|
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
98 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
99 |
#: Required field containing group address city. |
2162 | 100 |
#: City can only be ASCII, not UTF-8 text, because, if |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
101 |
#: supplied, it might be used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
102 |
contact_city = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
103 |
verbose_name=ugettext('City')) |
2162 | 104 |
contact_city.help_text = ugettext( |
105 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
|
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
106 |
|
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
107 |
#: Required field containing group address state or province. |
2162 | 108 |
#: Group state/province can only be ASCII, not UTF-8 |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
109 |
#: text, because, if supplied, it might be used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
110 |
contact_state = db.StringProperty( |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
111 |
verbose_name=ugettext('State/Province')) |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
112 |
contact_state.help_text = ugettext( |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
113 |
'optional if country/territory does not have states or provinces, ' |
2162 | 114 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
115 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
116 |
#: Required field containing address country or territory of the group. |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
117 |
contact_country = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
118 |
verbose_name=ugettext('Country/Territory'), |
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
119 |
choices=countries.COUNTRIES_AND_TERRITORIES) |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
120 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
121 |
#: Required field containing address postal code of the group (ZIP code in |
2162 | 122 |
#: the United States).Postal code can only be ASCII, not UTF-8 |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
123 |
#: text, because, if supplied, it might be used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
124 |
contact_postalcode = db.StringProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
125 |
verbose_name=ugettext('ZIP/Postal Code')) |
2162 | 126 |
contact_postalcode.help_text = ugettext( |
127 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
|
181
fdd29818a954
Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
174
diff
changeset
|
128 |
|
333
d3e85f6144cc
Update comments in models/group.py (changed Optional to Required). Add verbose_name to founder property in Group model.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
322
diff
changeset
|
129 |
#: Required contact phone number that will be, amongst other uses, |
174
f065ee52d759
A rough draft of the Group Model, to be merged with Pawel's current effort in
Todd Larsen <tlarsen@google.com>
parents:
diff
changeset
|
130 |
#: supplied to shippers along with the shipping address; kept private. |
259
74eb6b01c82c
Add basic Sponsors List, Create New Sponsor, Sponsor Public Profile views. Change all properties in Group model as required for now. Remaining TODO: write validation functions for Sponsor edit and create form fields that need additional validation (like address, phone number format).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
208
diff
changeset
|
131 |
phone = db.PhoneNumberProperty(required=True, |
970
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
132 |
verbose_name=ugettext('Phone Number')) |
8b5611d5b053
Use ugettext instead of ugettext_lazy
Sverre Rabbelier <srabbelier@gmail.com>
parents:
834
diff
changeset
|
133 |
phone.help_text = ugettext( |
208
e076aee6e90f
Take advantage of the Model inheritance provided by polymodel.PolyModel to
Todd Larsen <tlarsen@google.com>
parents:
181
diff
changeset
|
134 |
'include complete international calling number with country code') |
1961
85a57ba6f6fa
Added example text to the phone number fields
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1877
diff
changeset
|
135 |
phone.example_text = ugettext( |
85a57ba6f6fa
Added example text to the phone number fields
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1877
diff
changeset
|
136 |
"e.g. 1650253000 for Google's Corp HQ number in the United States") |
789
e55cad180973
Moved the member_template field to app and removed 'optional'
Sverre Rabbelier <srabbelier@gmail.com>
parents:
772
diff
changeset
|
137 |
|
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
138 |
#==================================================================== |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
139 |
# (private) shipping information |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
140 |
#==================================================================== |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
141 |
|
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
142 |
#: Optional field containing a group street address. |
2162 | 143 |
#: Group street address can only be ASCII, not UTF-8 text, |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
144 |
#: because, if supplied, it is used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
145 |
shipping_street = db.StringProperty(required=False, |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
146 |
verbose_name=ugettext('Shipping Street address')) |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
147 |
shipping_street.help_text = ugettext( |
2162 | 148 |
'street number and name, ' |
149 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
|
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
150 |
|
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
151 |
#: Optional field containing group address city. |
2162 | 152 |
#: City can only be ASCII, not UTF-8 text, because, if |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
153 |
#: supplied, it is used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
154 |
shipping_city = db.StringProperty(required=False, |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
155 |
verbose_name=ugettext('Shipping City')) |
2162 | 156 |
shipping_city.help_text = ugettext( |
157 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
|
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
158 |
|
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
159 |
#: Optional field containing group address state or province. |
2162 | 160 |
#: Group state/province can only be ASCII, not UTF-8 |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
161 |
#: text, because, if supplied, it is used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
162 |
shipping_state = db.StringProperty( |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
163 |
verbose_name=ugettext('Shipping State/Province')) |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
164 |
shipping_state.help_text = ugettext( |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
165 |
'optional if country/territory does not have states or provinces, ' |
2162 | 166 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
167 |
|
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
168 |
#: Optional field containing address postal code of the group (ZIP code in |
2162 | 169 |
#: the United States). Postal code can only be ASCII, not UTF-8 |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
170 |
#: text, because, if supplied, it is used as a shipping address. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
171 |
shipping_postalcode = db.StringProperty(required=False, |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
172 |
verbose_name=ugettext('Shipping ZIP/Postal Code')) |
2162 | 173 |
shipping_postalcode.help_text = ugettext( |
174 |
'<a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> characters only') |
|
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
175 |
|
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
176 |
#: Optional field containing address country or territory of the group. |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
177 |
shipping_country = db.StringProperty(required=False, |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
178 |
verbose_name=ugettext('Shipping Country/Territory'), |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
179 |
choices=countries.COUNTRIES_AND_TERRITORIES) |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
180 |
|
1085
0afbdd0905ef
Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1060
diff
changeset
|
181 |
#: Required property showing the current status of the group |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
182 |
#: new: the group has not been active yet |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
183 |
#: active: the group is active |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
184 |
#: inactive: used to mark a group as read-only |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
185 |
#: invalid: the group has been marked as removed |
1085
0afbdd0905ef
Renamed state to status where appropriate.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
1060
diff
changeset
|
186 |
status = db.StringProperty(required=True, default='new', |
1060
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
187 |
choices=['new', 'active', 'inactive', 'invalid']) |
eb6231138307
Added state and shipping address fields to group model.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
970
diff
changeset
|
188 |