Exemple #1
0
    def get_context_data(self, **kwargs):
        context = super(self.__class__, self).get_context_data(**kwargs)
        context['detailPanelHidden'] = self.request.COOKIES.get('detailHidden')
        context['detailPanelHeight'] = int(
            self.request.COOKIES.get('detailHeight', 0))
        context['detailActions'] = [
            Comment.ENUM_ACTION_WAIVED, Comment.ENUM_ACTION_RETURN,
            Comment.ENUM_ACTION_RESCHEDULE
        ]
        context['waiveClass'] = Comment
        context['GITWEB_URL'] = settings.GITWEB_URL

        # Get all tags
        context["actualtag"] = self.filters.get("tag")
        context['tags'] = Tag.objects.all()

        # Get scheduled jobs
        filters, jobstag = {}, {}

        if self.filters.get('search'):
            filters.update({
                "job__template__whiteboard__icontains":
                self.filters.get('search'),
            })

        if self.filters.get("tag"):
            jobstag = JobTemplate.objects.filter(
                tags__slug=self.filters.get("tag"))
            filters.update({
                "job__template__in": jobstag,
            })

        # Get all data from database for jobs ###
        joblist = JobListObject(**filters)
        if self.request.GET.get("back"):
            joblist.set_history(self.request.GET.get("back"))
        context['plans'] = joblist.get_data()

        try:
            context['progress'] = CheckProgress.objects.order_by(
                "-datestart")[0]
        except IndexError:
            context['progress'] = None
        # Search box
        context['forms'] = self.forms.get('search', FilterForm())
        # Waive Form
        author = Author.FromUser(self.request.user)
        if author:
            waiveform = WaiverForm(initial={"username": author.name})
        else:
            waiveform = WaiverForm()
        context['waiveForm'] = self.forms.get('waiveForm', waiveform)

        # get all tags

        context["events"] = Event.objects.filter(is_enabled=True,
                                                 datestart__lt=timezone.now(),
                                                 dateend__gt=timezone.now())
        return context
Exemple #2
0
 def form_event(self, parametrs):
     """Handle submitted waiver form"""
     if 'uids' in parametrs:
         self.forms['waiveFrom'] = WaiverForm(parametrs)
         if self.forms['waiveFrom'].is_valid():
             self.forms['waiveFrom'].save()
             self.forms['waiveFrom'] = WaiverForm()
         else:
             logger.warning(self.forms['waiveFrom'].errors)
Exemple #3
0
    def render_to_response(self, context, **response_kwargs):
        """???"""
        context['forms'] = self.forms.get('search', FilterForm())
        author = Author.FromUser(self.request.user)
        if author:
            waiveform = WaiverForm(initial={"username": author.name})
        else:
            waiveform = WaiverForm()
        context['waiveForm'] = self.forms.get('waiveForm', waiveform)

        return super(self.__class__,
                     self).render_to_response(context, **response_kwargs)
Exemple #4
0
 def formEvent(self, parametrs):
     if "uids" in parametrs:
         self.forms['waiveFrom'] = WaiverForm(parametrs)
         if self.forms['waiveFrom'].is_valid():
             self.forms['waiveFrom'].save()
             self.forms['waiveFrom'].clean()
         else:
             logger.warning(self.forms['waiveFrom'].errors)