check before adding a new registered person to an event

This commit is contained in:
Davide Alberani 2015-04-06 17:59:31 +02:00
parent 41117bf967
commit c5574f0b4c
2 changed files with 8 additions and 6 deletions

View file

@ -41,7 +41,7 @@
<body>
<nav class="navbar navbar-default navbar-fixed-top" ng-controller="NavigationCtrl as n">
<div class="container">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li ng-class="{active: n.isActive('/events') || n.isActive('/event')}"><a ui-sref="events">{{'Events' | translate}}</a></li>
<li ng-class="{active: n.isActive('/persons') || n.isActive('/person') || n.isActive('/import/persons')}"><a ui-sref="persons">{{'Persons' | translate}}</a></li>

View file

@ -154,6 +154,8 @@ class EventsHandler(CollectionHandler):
return {'persons': event.get('persons') or {}}
def handle_post_persons(self, id_, person_id, data):
if not self.db.query('events',
{'_id': id_, 'persons.person_id': person_id}):
merged, doc = self.db.update('events',
{'_id': id_},
{'persons': data},