elections.sql | 4 ++-- elections/admin.py | 16 ++++++++++------ elections/templates/admnewe.html | 1 + 3 files changed, 13 insertions(+), 8 deletions(-)
New commits: commit 8a94f26f526ab2ea823d408e13f9253fe15316f0 Author: Nigel Jones dev@nigelj.com Date: Tue Oct 7 17:59:12 2008 +1300
Better way to determine if to translate candidate names via FAS or not
diff --git a/elections.sql b/elections.sql index 9b29f60..0d4ec4e 100644 --- a/elections.sql +++ b/elections.sql @@ -29,7 +29,8 @@ seats_elected integer NOT NULL, allow_nominations boolean NOT NULL, -- If so, when do they have to be in by? nomination_end timestamp DEFAULT 0, - +-- Do we use FAS for candidate names? +usefas boolean NOT NULL, UNIQUE (alias), PRIMARY KEY (id) ) ENGINE=InnoDB; @@ -49,7 +50,6 @@ id integer NOT NULL auto_increment, election_id integer NOT NULL, -- Numerical value, specifying candidates' "status" status tinyint NOT NULL, -human boolean NOT NULL, name text NOT NULL, url text, blurb text, diff --git a/elections/admin.py b/elections/admin.py index 92cbe29..346b157 100644 --- a/elections/admin.py +++ b/elections/admin.py @@ -49,16 +49,20 @@ class Admin(controllers.Controller): @expose(template="elections.templates.admnewe") def newe(self, **kw): if "submit" in kw: + setembargo=1 + setnominations=1 + nominationend=0 + usefas=1 if "embargoed" not in kw: setembargo=0 - else: - setembargo=1 - if "allownominations" not in kw: setnominations=0 - else: - setnominations=1 - Elections(alias=kw['alias'], status=0, method=0, shortdesc=kw['shortdesc'], description=kw['info'], url=kw['url'], start_date=kw['startdate'], end_date=kw['enddate'], embargoed=setembargo, seats_elected=kw['seats'], allow_nominations=setnominations, nomination_end=kw['nominationend']) + if "nominationend" in kw: + nominationend=kw['nominationend'] + if "usefas" not in kw: + usefas=0 + + Elections(alias=kw['alias'], status=0, method=0, shortdesc=kw['shortdesc'], description=kw['info'], url=kw['url'], start_date=kw['startdate'], end_date=kw['enddate'], embargoed=setembargo, seats_elected=kw['seats'], allow_nominations=setnominations, nomination_end=nominationend) raise turbogears.redirect("/") else: return dict() diff --git a/elections/templates/admnewe.html b/elections/templates/admnewe.html index e1acf5d..063ecea 100644 --- a/elections/templates/admnewe.html +++ b/elections/templates/admnewe.html @@ -19,6 +19,7 @@ <tr><td>Embargoed?</td><td><input type="checkbox" name="embargoed" /> </td></tr> <tr><td>Allow Nominations?</td><td><input type="checkbox" name="allownominations" /> </td></tr> <tr><td>Until When?</td><td><input type="text" name="nominationend" /> </td></tr> + <tr><td>Use FAS?</td><td><input type="text" name="usefas" /> </td></tr> <tr><td></td><td><input type="submit" name="submit" value="Submit" /></td></tr> </table> </form>
elections-devel@lists.stg.fedorahosted.org