예제 #1
0
파일: poll_forms.py 프로젝트: franck260/vpt
    def __init__(self):

        # Grid initialization
        super(EditPollsGrid, self).__init__(
            Poll, Poll.all(joined_attrs=["choices"]))  #@UndefinedVariable

        # Creation of customized date fields to edit the poll dates
        self.append(
            create_date_field("formatted_start_dt",
                              "start_dt",
                              DT_FORMAT,
                              today_by_default=True))
        self.append(
            create_date_field("formatted_end_dt",
                              "end_dt",
                              DT_FORMAT,
                              today_by_default=False))
        self.append(
            Field(name="formatted_possible_dates",
                  value=lambda model: "[%s]" % ",".join([
                      formatting.format_date(dt, DT_FORMAT)
                      for dt in model.possible_dates
                  ])))

        # Grid configuration
        inc = [
            TITLE(self.title),
            FORMATTED_START_DT(self.formatted_start_dt),
            FORMATTED_END_DT(self.formatted_end_dt),
            FORMATTED_POSSIBLE_DATES_READONLY(self.formatted_possible_dates)
        ]
        self.configure(include=inc)
예제 #2
0
    def __init__(self):

        # Grid initialization
        super(EditSessionsGrid, self).__init__(Session, Session.all())

        # Creation of a customized date field to view the session's date
        self.append(create_date_field("formatted_atime", "atime", DT_FORMAT))

        # Creation of a customized field to view the session's data
        self.append(
            Field(name="formatted_data",
                  value=lambda model: "{%s}" % ",".join([
                      "%s:%s" % (k, v) for k, v in config.session_manager.
                      session_handler.store.decode(model.data).items()
                      if k != "session_id"
                  ])))

        # Grid configuration
        inc = [
            FORMATTED_ATIME_READONLY(self.formatted_atime),
            FORMATTED_DATA_READONLY(self.formatted_data),
            SESSION_ID_READONLY(self.session_id)
        ]

        self.configure(include=inc)
예제 #3
0
    def __init__(self):

        # Grid initialization
        super(EditSessionsGrid, self).__init__(Session, Session.all())

        # Creation of a customized date field to view the session's date
        self.append(create_date_field("formatted_atime", "atime", DT_FORMAT))

        # Creation of a customized field to view the session's data
        self.append(
            Field(
                name="formatted_data",
                value=lambda model: "{%s}"
                % ",".join(
                    [
                        "%s:%s" % (k, v)
                        for k, v in config.session_manager.session_handler.store.decode(model.data).items()
                        if k != "session_id"
                    ]
                ),
            )
        )

        # Grid configuration
        inc = [
            FORMATTED_ATIME_READONLY(self.formatted_atime),
            FORMATTED_DATA_READONLY(self.formatted_data),
            SESSION_ID_READONLY(self.session_id),
        ]

        self.configure(include=inc)
예제 #4
0
    def __init__(self):

        # Grid initialization
        super(EditTournamentsGrid, self).__init__(Tournament, Tournament.all(order_by_clause=Tournament.tournament_dt)) #@UndefinedVariable
        
        # Creation of a customized date field to edit the tournaments' date
        self.append(create_date_field("formatted_tournament_dt", "tournament_dt", DT_FORMAT))
        
        # Grid configuration
        inc = [SEASON_READONLY(self.season_id), POSITION_READONLY(self.position), FORMATTED_DT(self.formatted_tournament_dt), BUYIN(self.buyin)] 
        self.configure(include=inc)
예제 #5
0
파일: news_forms.py 프로젝트: franck260/vpt
 def __init__(self):
     
     # FieldSet initialization
     super(NewNewsFieldSet, self).__init__(News)
     
     # Creation of a customized date field to edit the news' date
     self.append(create_date_field("formatted_news_dt", "news_dt", DT_FORMAT))
     
     # FieldSet configuration
     inc = [FORMATTED_DT(self.formatted_news_dt), NEWS(self.news)] 
     self.configure(include=inc)
예제 #6
0
 def __init__(self):
     
     # FieldSet initialization
     super(NewTournamentFieldSet, self).__init__(Tournament)
     
     # Creation of a customized date field to edit the tournament's date
     self.append(create_date_field("formatted_tournament_dt", "tournament_dt", DT_FORMAT))
     
     # FieldSet configuration
     season_options = [("Saison %s (%s - %s)" %(season.id, season.start_year, season.end_year), season.id) for season in Season.all()]
     inc = [SEASON(self.season, season_options), FORMATTED_DT(self.formatted_tournament_dt), BUYIN(self.buyin)]
     self.configure(include=inc)
예제 #7
0
파일: news_forms.py 프로젝트: franck260/vpt
    def __init__(self):

        # FieldSet initialization
        super(NewNewsFieldSet, self).__init__(News)

        # Creation of a customized date field to edit the news' date
        self.append(
            create_date_field("formatted_news_dt", "news_dt", DT_FORMAT))

        # FieldSet configuration
        inc = [FORMATTED_DT(self.formatted_news_dt), NEWS(self.news)]
        self.configure(include=inc)
예제 #8
0
파일: poll_forms.py 프로젝트: franck260/vpt
    def __init__(self):
        
        # Grid initialization
        super(EditPollsGrid, self).__init__(Poll, Poll.all(joined_attrs=["choices"])) #@UndefinedVariable

        # Creation of customized date fields to edit the poll dates
        self.append(create_date_field("formatted_start_dt", "start_dt", DT_FORMAT, today_by_default=True))
        self.append(create_date_field("formatted_end_dt", "end_dt", DT_FORMAT, today_by_default=False))
        self.append(
            Field(
                name="formatted_possible_dates",
                value=lambda model: "[%s]" % ",".join([formatting.format_date(dt, DT_FORMAT) for dt in model.possible_dates])
            )
        )
        
        # Grid configuration
        inc = [
            TITLE(self.title),
            FORMATTED_START_DT(self.formatted_start_dt),
            FORMATTED_END_DT(self.formatted_end_dt),
            FORMATTED_POSSIBLE_DATES_READONLY(self.formatted_possible_dates)
        ]
        self.configure(include=inc)
예제 #9
0
파일: poll_forms.py 프로젝트: franck260/vpt
    def __init__(self):

        # FieldSet initialization
        super(NewPollFieldSet, self).__init__(Poll)

        # Creation of customized date fields to edit the poll dates
        self.append(
            create_date_field("formatted_start_dt",
                              "start_dt",
                              DT_FORMAT,
                              today_by_default=True))
        self.append(
            create_date_field("formatted_end_dt",
                              "end_dt",
                              DT_FORMAT,
                              today_by_default=False))
        [
            self.append(
                create_generic_date_field(
                    name,
                    lambda model: utils.safeget(model.possible_dates, i),
                    DT_FORMAT,
                    today_by_default=False))
            for i, name in enumerate(self.possible_date_fields_names)
        ]

        # FieldSet configuration
        inc = [
            TITLE(self.title),
            FORMATTED_START_DT(self.formatted_start_dt),
            FORMATTED_END_DT(self.formatted_end_dt),
        ] + [
            FORMATTED_POSSIBLE_DT(field, i)
            for i, field in enumerate(self.possible_date_fields, start=1)
        ]

        self.configure(include=inc)
예제 #10
0
파일: poll_forms.py 프로젝트: franck260/vpt
    def __init__(self):

        # FieldSet initialization
        super(NewPollFieldSet, self).__init__(Poll)
        
        # Creation of customized date fields to edit the poll dates
        self.append(create_date_field("formatted_start_dt", "start_dt", DT_FORMAT, today_by_default=True))
        self.append(create_date_field("formatted_end_dt", "end_dt", DT_FORMAT, today_by_default=False))
        [self.append(
            create_generic_date_field(
                name,
                lambda model: utils.safeget(model.possible_dates, i),
                DT_FORMAT,
                today_by_default=False
            )) for i, name in enumerate(self.possible_date_fields_names)]
        
        # FieldSet configuration
        inc = [
            TITLE(self.title),
            FORMATTED_START_DT(self.formatted_start_dt),
            FORMATTED_END_DT(self.formatted_end_dt),
        ] + [FORMATTED_POSSIBLE_DT(field, i) for i, field in enumerate(self.possible_date_fields, start=1)]
            
        self.configure(include=inc)