Exemple #1
0
    class UserCrud(CrudBase):
        crudsettings = CrudSettings(User, **Response)

        @saves_custom_fields('articles'
                             )  # got to provide it ; otherwise, it complains
        def save_articles(self):
            raise NotImplementedError
Exemple #2
0
    class UserCrud(CrudBase):
        crudsettings = CrudSettings(User, **Response).primary_key_config(
            primary_key=['login'], natural_primary_key=True)

        @saves_custom_fields('articles'
                             )  # got to provide it ; otherwise, it complains
        def save_articles(self):
            raise NotImplementedError
Exemple #3
0
 class UserCrud(CrudBase):
     crudsettings = CrudSettings(User, **Response).field_names_config(
         ro_fields=('id', ),
         rw_fields=('id', 'name', 'passwd', 'age'),
         const_fields=('login', ),
     ).exclude_config(create_and_update=(
         'articles',
         'age_in_100_years',
     ), )
Exemple #4
0
    class UserCrud(CrudBase):
        crudsettings = CrudSettings(User, **Response).field_names_config(
            ro_fields=('id', 'articles', 'age_in_100_years'),
            rw_fields=('id', 'name', 'login', 'passwd', 'age'),
        )

        @saves_custom_fields('articles'
                             )  # got to provide it ; otherwise, it complains
        def save_articles(self):
            raise NotImplementedError
Exemple #5
0
    class UserCrud(CrudBase):
        crudsettings = CrudSettings(User, **Response).field_names_config(
            ro_fields=('id', 'age_in_100_years'),
            rw_fields=('id', 'name', 'passwd', 'age'),
            rw_relations=('articles', ),
            const_fields=('login', ),
        )

        @saves_custom_fields('articles')
        def saves_articles(self,
                           new: User,
                           prev: User = None,
                           articles: List[Article] = None):
            pass