Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @classmethod
- def get_user_contact_table_structure(cls, fields=None) -> tuple:
- """Возвращает структуру таблицы UserSocialMedia."""
- social_media_type_values = []
- for value, verbose in UserSocialMedia.SocialMediaType.choices:
- social_media_type_values.append({'value': value, 'verbose': verbose})
- result = (
- cls.get_formated_field(name='id_field', field_type=cls.DataFormat.TEXT, verbose='ID', cell_width=5,
- is_visible=False),
- cls.get_formated_field(name='link_field', field_type=cls.DataFormat.TEXT, verbose='Ссылка на профиль',
- cell_width=5, is_visible=False),
- cls.get_formated_field(name='social_media_type_field', field_type=cls.DataFormat.SELECT,
- verbose='Тип соц. сети', cell_width=11, options=social_media_type_values,
- is_sorting=True),
- cls.get_formated_field(name='delete_btn_field', field_type=cls.DataFormat.BUTTON, verbose='',
- cell_width=2),
- )
- mandatory_fields = UserContactSerializer.mandatory_fields
- if fields:
- result = cls.filter_fields(structure=result, fields=fields, mandatory_fields=mandatory_fields)
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement