from django.db import models from django.conf import settings class UserProfileCollections(models.Model): SOURCE_PROFILE = 'profile' SOURCE_PE_PROFILE = 'pe_profile' SOURCE_TUG_APPLICATION = 'tug_application' SOURCE_TUG_ACTIVITY = 'tug_activity' SOURCE_CONTACT_US = 'contact_us' SOURCE_ORGANIZATION = 'organization' SOURCE_ADMIN_EDIT = 'admin_edit' SOURCE_FORM = 'form' SOURCE_CHOICES = ( (SOURCE_PROFILE, '个人主页'), (SOURCE_PE_PROFILE, 'PE 个人主页'), (SOURCE_TUG_APPLICATION, 'TUG 申请'), (SOURCE_TUG_ACTIVITY, 'TUG 活动'), (SOURCE_CONTACT_US, '联系我们'), (SOURCE_ORGANIZATION, '团队'), (SOURCE_ADMIN_EDIT, '管理员录入'), (SOURCE_FORM, '表单'), ) user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING) name = models.CharField(max_length=32, blank=True, null=True) gender = models.CharField(max_length=8, blank=True, null=True) company = models.CharField(max_length=64, blank=True, null=True) industry = models.CharField(max_length=32, blank=True, null=True) job_title = models.CharField(max_length=32, blank=True, null=True) address = models.CharField(max_length=128, blank=True, null=True) phone = models.CharField(max_length=16, blank=True, null=True) email = models.CharField(max_length=64, blank=True, null=True) wechat_id = models.CharField(max_length=64, blank=True, null=True) github_id = models.CharField(max_length=64, blank=True, null=True) tidb_use_experience = models.CharField(max_length=64, blank=True, null=True) tidb_use_stage = models.CharField(max_length=64, blank=True, null=True) source = models.CharField(max_length=32, blank=True, null=True, choices=SOURCE_CHOICES) comment = models.CharField(max_length=128, blank=True, null=True) external_id = models.CharField( max_length=64, unique=True, blank=True, null=True, help_text='外部 ID, 用于与外部系统关联来保证数据不重复' ) is_primary = models.BooleanField(default=False) created_by_user = models.ForeignKey( settings.AUTH_USER_MODEL, related_name='created_user_profile_collections', on_delete=models.DO_NOTHING, blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) deleted_at = models.DateTimeField(blank=True, null=True) deleted_by_user = models.ForeignKey( settings.AUTH_USER_MODEL, related_name='deleted_user_profile_collections', on_delete=models.DO_NOTHING, blank=True, null=True) class Meta: db_table = 'pingcap_user_profile_collections'