Esempio n. 1
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     query = (Event.query
              .with_parent(self.category)
              .order_by(Event.start_dt.desc()))
     if request.form.get('all_selected') != '1':
         query = query.filter(Event.id.in_(map(int, request.form.getlist('event_id'))))
     self.events = query.all()
Esempio n. 2
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     target_category_id = request.form.get('target_category_id')
     if target_category_id is None:
         self.target_category = None
     else:
         self.target_category = Category.get_one(int(target_category_id), is_deleted=False)
         if not self.target_category.can_manage(session.user):
             raise Forbidden(_("You are not allowed to manage the selected destination."))
         if self.target_category.events:
             raise BadRequest(_("The destination already contains an event."))
Esempio n. 3
0
 def _checkProtection(self):
     RHManageCategoryBase._checkProtection(self)
     # This is already covered by CategModifBase, but if we ever add more
     # checks to can_manage_attachments we are on the safe side...
     if not can_manage_attachments(self.object, session.user):
         raise Forbidden
Esempio n. 4
0
 def _checkParams(self, params):
     RHManageCategoryBase._checkParams(self)
     self.object_type = 'category'
     self.object = self.base_object = self.category
Esempio n. 5
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     self.subcategories = (Category.query
                           .with_parent(self.category)
                           .filter(Category.id.in_(map(int, request.form.getlist('category_id'))))
                           .all())
Esempio n. 6
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     self.object_type = 'category'
     self.object = self.base_object = self.category
Esempio n. 7
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     self.role = CategoryRole.get_or_404(request.view_args['role_id'])
Esempio n. 8
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     self.subcategories = (Category.query.with_parent(self.category).filter(
         Category.id.in_(map(int,
                             request.form.getlist('category_id')))).all())
Esempio n. 9
0
 def _check_access(self):
     RHManageCategoryBase._check_access(self)
     # This is already covered by CategModifBase, but if we ever add more
     # checks to can_manage_attachments we are on the safe side...
     if not can_manage_attachments(self.object, session.user):
         raise Forbidden
Esempio n. 10
0
 def _process_args(self):
     RHManageCategoryBase._process_args(self)
     self.object_type = 'category'
     self.object = self.base_object = self.category