From 07d99dd186f7dff8e53eb7b11e63deccbba6c918 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sun, 20 Sep 2015 19:14:20 +0200 Subject: [PATCH] In the middle of making "manage.py" at least show help --- database/platal/models.py | 215 +++++++++++++++++++++++++++------------------- 1 file changed, 129 insertions(+), 86 deletions(-) diff --git a/database/platal/models.py b/database/platal/models.py index 3345d76..7ab61b9 100644 --- a/database/platal/models.py +++ b/database/platal/models.py @@ -556,14 +556,14 @@ class EmailRedirectAccount(models.Model): class EmailSourceAccount(models.Model): email = models.CharField(max_length=255) domain = models.ForeignKey(EmailVirtualDomain, db_column='domain') - pkey = models.CompositeField(email, domain, primary_key=True) - account = models.ForeignKey(Account, db_column='uid') - type = models.CharField(max_length=27) - flags = models.CharField(max_length=69) - expire = models.DateField(null=True, blank=True) + type = models.CharField(max_length=9) + flags = models.CharField(max_length=23) + expire = models.DateField(blank=True, null=True) + class Meta: db_table = 'email_source_account' + unique_together = (('email', 'domain'),) def __str__(self): return "%s@%s (%s)" % (self.email, self.domain, self.type) @@ -573,13 +573,13 @@ class EmailSourceAccount(models.Model): class EmailSourceOther(models.Model): email = models.CharField(max_length=255) domain = models.ForeignKey(EmailVirtualDomain, db_column='domain') - pkey = models.CompositeField(email, domain, primary_key=True) + hrmid = models.CharField(max_length=255) + type = models.CharField(max_length=8, blank=True, null=True) + expire = models.DateField(blank=True, null=True) - hrmid = models.CharField(max_length=765) - type = models.CharField(max_length=24, blank=True) - expire = models.DateField(null=True, blank=True) class Meta: db_table = 'email_source_other' + unique_together = (('email', 'domain'),) def __str__(self): return "%s@%s (%s)" % (self.email, self.domain, self.type) @@ -588,12 +588,13 @@ class EmailSourceOther(models.Model): @python_2_unicode_compatible class EmailRedirectOther(models.Model): hrmid = models.ForeignKey(EmailSourceOther, db_column='hrmid') - redirect = models.CharField(max_length=765) - pkey = models.CompositeField(hrmid, redirect, primary_key=True) - type = models.CharField(max_length=30) - action = models.CharField(max_length=54) + redirect = models.CharField(max_length=255) + type = models.CharField(max_length=10) + action = models.CharField(max_length=18) + class Meta: db_table = 'email_redirect_other' + unique_together = (('hrmid', 'redirect'),) def __str__(self): return "%s -> %s (%s)" % (self.hrmid, self.redirect, self.type) @@ -614,6 +615,7 @@ class InndForum(models.Model): write_perm = models.CharField(max_length=300, blank=True) priority = models.IntegerField(null=True, blank=True) comment = models.TextField(blank=True) + class Meta: db_table = 'forum_innd' @@ -631,6 +633,7 @@ class ForumProfile(models.Model): tree_unread = models.CharField(max_length=24) tree_read = models.CharField(max_length=24) last_seen = models.DateTimeField() + class Meta: db_table = 'forum_profiles' @@ -642,6 +645,7 @@ class ForumProfile(models.Model): class Forum(models.Model): fid = models.IntegerField(primary_key=True) name = models.CharField(max_length=192) + class Meta: db_table = 'forums' @@ -653,9 +657,10 @@ class Forum(models.Model): class ForumSubs(models.Model): forum = models.ForeignKey(Forum, db_column='fid') account = models.ForeignKey(Account, db_column='uid') - pkey = models.CompositeField(forum, account, primary_key=True) + class Meta: db_table = 'forum_subs' + unique_together = (('fid', 'uid'),) def __str__(self): return "%s by %s" % (self.forum.name, self.account.hruid) @@ -667,12 +672,13 @@ class ForumSubs(models.Model): @python_2_unicode_compatible class PaymentBankAccount(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) asso = models.ForeignKey('Group', blank=True, null=True) iban = models.CharField(max_length=33) owner = models.CharField(max_length=300) status = models.CharField(max_length=36) bic = models.CharField(max_length=11) + class Meta: db_table = 'payment_bankaccounts' @@ -682,7 +688,7 @@ class PaymentBankAccount(models.Model): @python_2_unicode_compatible class Payment(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) text = models.CharField(max_length=765) url = models.CharField(max_length=384) flags = models.CharField(max_length=51) @@ -693,6 +699,7 @@ class Payment(models.Model): confirmation = models.TextField() asso = models.ForeignKey('Group', null=True, blank=True) rib = models.ForeignKey(PaymentBankAccount) + class Meta: db_table = 'payments' @@ -704,6 +711,7 @@ class Payment(models.Model): class PaymentCodeC(models.Model): id = models.IntegerField(primary_key=True) text = models.CharField(max_length=192) + class Meta: db_table = 'payment_codeC' @@ -716,6 +724,7 @@ class PaymentCodeRCB(models.Model): id = models.IntegerField(primary_key=True) text = models.CharField(max_length=192) codec = models.IntegerField(db_column='codeC') # Field name made lowercase. + class Meta: db_table = 'payment_codeRCB' @@ -730,6 +739,7 @@ class PaymentMethod(models.Model): include = models.CharField(max_length=96) short_name = models.CharField(max_length=30) flags = models.CharField(max_length=36, blank=True) + class Meta: db_table = 'payment_methods' @@ -749,6 +759,7 @@ class PaymentReconcilation(models.Model): sum_commissions = models.DecimalField(max_digits=11, decimal_places=2) comments = models.TextField() recongroup_id = models.IntegerField(null=True, blank=True) + class Meta: db_table = 'payment_reconcilations' @@ -772,6 +783,7 @@ class PaymentTransaction(models.Model): status = models.CharField(max_length=27) recon = models.ForeignKey(PaymentReconcilation, null=True, blank=True) display = models.IntegerField() + class Meta: db_table = 'payment_transactions' @@ -788,6 +800,7 @@ class PaymentTransfer(models.Model): account = models.ForeignKey(Account, null=True, blank=True) message = models.CharField(max_length=765) date = models.DateField(null=True, blank=True) + class Meta: db_table = 'payment_transfers' @@ -801,9 +814,10 @@ class PaymentTransfer(models.Model): @python_2_unicode_compatible class GroupDom(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) name = models.TextField(db_column='nom') cat = models.CharField(max_length=117) + class Meta: db_table = 'group_dom' @@ -813,7 +827,7 @@ class GroupDom(models.Model): @python_2_unicode_compatible class Group(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) name = models.CharField(max_length=765, db_column='nom') diminutif = models.CharField(max_length=192, unique=True) cat = models.CharField(max_length=117) @@ -837,6 +851,7 @@ class Group(models.Model): event_order = models.CharField(max_length=8) disable_mails = models.BooleanField() status = models.CharField(max_length=117) + class Meta: db_table = 'groups' @@ -852,14 +867,14 @@ class Group(models.Model): class GroupMember(models.Model): asso = models.ForeignKey(Group) account = models.ForeignKey(Account, db_column='uid') - pkey = models.CompositeField(asso, account, primary_key=True) + perms = models.CharField(max_length=6) + comm = models.CharField(max_length=255, blank=True, null=True) + position = models.CharField(max_length=18, blank=True, null=True) + flags = models.CharField(max_length=6) - perms = models.CharField(max_length=18) - comm = models.CharField(max_length=765, blank=True) - position = models.CharField(max_length=54, blank=True) - flags = models.CharField(max_length=18) class Meta: db_table = 'group_members' + unique_together = (('asso', 'uid'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.asso.name) @@ -869,12 +884,12 @@ class GroupMember(models.Model): class GroupMemberSubRequest(models.Model): asso = models.ForeignKey(Group) account = models.ForeignKey(Account, db_column='uid') - pkey = models.CompositeField(asso, account, primary_key=True) - ts = models.DateTimeField() reason = models.TextField(blank=True) + class Meta: db_table = 'group_member_sub_requests' + unique_together = (('asso', 'uid'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.asso.name) @@ -884,12 +899,12 @@ class GroupMemberSubRequest(models.Model): class GroupFormerMember(models.Model): asso = models.ForeignKey(Group) account = models.ForeignKey(Account, db_column='uid') - pkey = models.CompositeField(asso, account, primary_key=True) - remember = models.IntegerField() unsubsciption_date = models.DateField() + class Meta: db_table = 'group_former_members' + unique_together = (('asso', 'uid'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.asso.name) @@ -913,7 +928,8 @@ class GroupAnnounce(models.Model): promo_max = models.IntegerField() flags = models.CharField(max_length=36) post_id = models.IntegerField(null=True, blank=True, - help_text=u"NNTP post ID") + help_text="NNTP post ID") + class Meta: db_table = 'group_announces' @@ -928,6 +944,7 @@ class GroupAnnouncePhoto(models.Model): attach = models.TextField() x = models.IntegerField() y = models.IntegerField() + class Meta: db_table = 'group_announces_photo' @@ -939,9 +956,10 @@ class GroupAnnouncePhoto(models.Model): class GroupAnnounceRead(models.Model): announce = models.ForeignKey(GroupAnnounce) account = models.ForeignKey(Account, db_column='uid') - pkey = models.CompositeField(announce, account, primary_key=True) + class Meta: db_table = 'group_announces_read' + unique_together = (('announce', 'uid'),) def __str__(self): return "%s: %s" % (self.account.hruid, self.announce_id) @@ -968,6 +986,7 @@ class GroupEvent(models.Model): accept_nonmembre = models.BooleanField() archive = models.BooleanField() subscription_notification = models.CharField(max_length=24) + class Meta: db_table = 'group_events' @@ -979,13 +998,13 @@ class GroupEvent(models.Model): class GroupEventItem(models.Model): event = models.ForeignKey(GroupEvent, db_column='eid') item_id = models.IntegerField() - pkey = models.CompositeField(event, item_id, primary_key=True) - titre = models.CharField(max_length=300) details = models.TextField() montant = models.DecimalField(max_digits=12, decimal_places=2) + class Meta: db_table = 'group_event_items' + unique_together = (('eid', 'item_id'),) def __str__(self): return "%s - %s" % (self.event, self.item_id) @@ -994,16 +1013,16 @@ class GroupEventItem(models.Model): @python_2_unicode_compatible class GroupEventParticipant(models.Model): event = models.ForeignKey(GroupEvent, db_column='eid') - item_id = models.IntegerField() account = models.ForeignKey(Account, db_column='uid') item = models.ForeignKey(GroupEventItem, to_field='pkey') - pkey = models.CompositeField(event, account, item, primary_key=True) - nb = models.IntegerField() - flags = models.CharField(max_length=42) + flags = models.CharField(max_length=14) paid = models.FloatField() + + class Meta: db_table = 'group_event_participants' + unique_together = (('eid', 'uid', 'item_id'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.item) @@ -1023,6 +1042,7 @@ class GroupAuth(models.Model): last_used = models.DateField(null=True, blank=True) group = models.ForeignKey(Group, null=True, blank=True) flags = models.CharField(max_length=63, blank=True) + class Meta: db_table = 'group_auth' @@ -1043,6 +1063,7 @@ class IpWatch(models.Model): description = models.TextField() ip = models.IntegerField(primary_key=True) mask = models.IntegerField() + class Meta: db_table = 'ip_watch' @@ -1052,9 +1073,10 @@ class IpWatch(models.Model): @python_2_unicode_compatible class LogAction(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) text = models.CharField(max_length=96) description = models.CharField(max_length=765) + class Meta: db_table = 'log_actions' @@ -1064,7 +1086,7 @@ class LogAction(models.Model): @python_2_unicode_compatible class LogSession(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) auth = models.CharField(max_length=18) account = models.ForeignKey(Account, null=True, db_column='uid', blank=True, related_name='sessions') start = models.DateTimeField() @@ -1076,6 +1098,7 @@ class LogSession(models.Model): flags = models.CharField(max_length=15) ip = models.IntegerField() forward_ip = models.IntegerField(null=True, blank=True) + class Meta: db_table = 'log_sessions' @@ -1087,6 +1110,7 @@ class LogSession(models.Model): class LogLastSession(models.Model): account = models.ForeignKey(Account, primary_key=True, db_column='uid') id = models.ForeignKey(LogSession, db_column='id') + class Meta: db_table = 'log_last_sessions' @@ -1100,6 +1124,7 @@ class LogEvent(models.Model): session = models.ForeignKey(LogSession, db_column='session') action = models.ForeignKey(LogAction, db_column='action') data = models.TextField(blank=True) + class Meta: db_table = 'log_events' @@ -1117,6 +1142,7 @@ class Newsletter(models.Model): group = models.ForeignKey(Group, unique=True) name = models.CharField(max_length=765) criteria = models.CharField(max_length=42, blank=True) + class Meta: db_table = 'newsletters' @@ -1127,7 +1153,7 @@ class Newsletter(models.Model): @python_2_unicode_compatible class NewsletterIssue(models.Model): nlid = models.ForeignKey(Newsletter, unique=True, db_column='nlid') - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) date = models.DateField() send_before = models.DateTimeField(null=True, blank=True) state = models.CharField(max_length=21) @@ -1139,6 +1165,7 @@ class NewsletterIssue(models.Model): mail_title = models.CharField(max_length=765) unsubscribe = models.IntegerField() reply_to = models.CharField(max_length=765) + class Meta: db_table = 'newsletter_issues' @@ -1152,6 +1179,7 @@ class NewsletterCat(models.Model): nlid = models.ForeignKey(Newsletter, db_column='nlid') pos = models.IntegerField() title = models.CharField(max_length=384) + class Meta: db_table = 'newsletter_cat' @@ -1163,14 +1191,15 @@ class NewsletterCat(models.Model): class NewsletterArt(models.Model): issue = models.ForeignKey(NewsletterIssue, db_column='id') aid = models.IntegerField() - pkey = models.CompositeField(issue, aid, primary_key=True) cid = models.ForeignKey(NewsletterCat, null=True, db_column='cid', blank=True) pos = models.IntegerField() title = models.TextField() body = models.TextField() append = models.TextField() + class Meta: db_table = 'newsletter_art' + unique_together = (('issue', 'aid'),) def __str__(self): return "%s: %s" % (self.issue_id, self.title) @@ -1180,11 +1209,12 @@ class NewsletterArt(models.Model): class NewsletterIns(models.Model): account = models.ForeignKey(Account, db_column='uid') nl = models.ForeignKey(Newsletter, db_column='nlid') - pkey = models.CompositeField(account, nl, primary_key=True) last = models.ForeignKey(NewsletterIssue, null=True, db_column='last', blank=True) hash = models.CharField(max_length=96, blank=True) + class Meta: db_table = 'newsletter_ins' + unique_together = (('uid', 'nlid'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.nl.title) @@ -1204,6 +1234,7 @@ class ProfileDisplay(models.Model): short_name = models.CharField(max_length=765) sort_name = models.CharField(max_length=765) promo = models.CharField(max_length=765) + class Meta: db_table = 'profile_display' @@ -1239,8 +1270,6 @@ class ProfilePhone(models.Model): link_type = models.CharField(max_length=21, choices=LINK_CHOICES) link_id = models.IntegerField() tel_id = models.IntegerField() - pkey = models.CompositeField(profile, link_type, link_id, tel_id, primary_key=True) - tel_type = models.CharField(max_length=18, choices=KIND_CHOICES) search_tel = models.CharField(max_length=75) display_tel = models.CharField(max_length=90) @@ -1249,6 +1278,7 @@ class ProfilePhone(models.Model): class Meta: db_table = 'profile_phones' + unique_together = (('pid', 'link_type', 'link_id', 'tel_id'),) def __str__(self): return "%s: %s (%s)" % (self.profile.hrpid, self.display_tel, self.tel_type) @@ -1275,6 +1305,7 @@ class ProfilePhoto(models.Model): y = models.IntegerField() pub = models.CharField(max_length=21) last_update = models.DateTimeField() + class Meta: db_table = 'profile_photos' @@ -1287,10 +1318,11 @@ class ProfilePrivateName(models.Model): profile = models.ForeignKey(Profile, db_column='pid', related_name='private_name') type = models.CharField(max_length=27) id = models.IntegerField() - pkey = models.CompositeField(profile, type, id, primary_key=True) name = models.CharField(max_length=765) + class Meta: db_table = 'profile_private_names' + unique_together = (('pid', 'type', 'id'),) def __str__(self): return "%s: %s" % (self.profile.hrpid, self.type) @@ -1307,6 +1339,7 @@ class ProfilePublicName(models.Model): firstname_main = models.CharField(max_length=765) firstname_ordinary = models.CharField(max_length=765) pseudonym = models.CharField(max_length=765) + class Meta: db_table = 'profile_public_names' @@ -1335,40 +1368,34 @@ class ProfileAddress(models.Model): profile = models.ForeignKey(Profile, db_column='pid', related_name='addresses') job = models.ForeignKey('ProfileJobEnum', db_column='jobid', blank=True, null=True, - related_name='addresses') - #job = models.IntegerField(db_column='jobid') + related_name='addresses') group = models.ForeignKey('Group', db_column='groupid', blank=True, null=True) - #groupid = models.IntegerField() - addr_type = models.CharField(max_length=15, db_column='type', choices=KIND_CHOICES) + addr_type = models.CharField(max_length=5, db_column='type', choices=KIND_CHOICES) subid = models.IntegerField(db_column='id') - pkey = models.CompositeField(profile, job, group, addr_type, subid, primary_key=True) - pjob_key = models.CompositeField(profile, subid) - pjob = models.ForeignKey('ProfileJob', aux_field='pjob_key') - - flags = models.CharField(max_length=180, blank=True) + flags = models.CharField(max_length=65, blank=True, null=True) text = models.TextField() - postaltext = models.TextField(db_column='postalText') # Field name made lowercase. + postaltext = models.TextField(db_column='postalText') # Field name made lowercase. formatted_address = models.TextField() - types = models.CharField(max_length=891) - latitude = models.FloatField(null=True, blank=True) - longitude = models.FloatField(null=True, blank=True) - southwest_latitude = models.FloatField(null=True, blank=True) - southwest_longitude = models.FloatField(null=True, blank=True) - northeast_latitude = models.FloatField(null=True, blank=True) - northeast_longitude = models.FloatField(null=True, blank=True) - location_type = models.CharField(max_length=54, blank=True) + types = models.CharField(max_length=297) + latitude = models.FloatField(blank=True, null=True) + longitude = models.FloatField(blank=True, null=True) + southwest_latitude = models.FloatField(blank=True, null=True) + southwest_longitude = models.FloatField(blank=True, null=True) + northeast_latitude = models.FloatField(blank=True, null=True) + northeast_longitude = models.FloatField(blank=True, null=True) + location_type = models.CharField(max_length=18, blank=True, null=True) partial_match = models.IntegerField() - pub = models.CharField(max_length=21) - comment = models.CharField(max_length=765, blank=True) - geocoding_date = models.DateField(null=True, blank=True) + pub = models.CharField(max_length=7) + comment = models.CharField(max_length=255, blank=True, null=True) + geocoding_date = models.DateField(blank=True, null=True) geocoding_calls = models.IntegerField() - postal_code_fr = models.CharField(max_length=15, blank=True) - + postal_code_fr = models.CharField(max_length=5, blank=True, null=True) components = models.ManyToManyField('ProfileAddressComponentEnum', through='ProfileAddressComponent', related_name='addresses') class Meta: db_table = 'profile_addresses' + unique_together = (('pid', 'jobid', 'groupid', 'type', 'id'),) def __str__(self): if self.addr_type == self.KIND_HOME: @@ -1431,6 +1458,7 @@ class ProfileAddressComponentEnum(models.Model): short_name = models.CharField(max_length=765) long_name = models.CharField(max_length=765) types = models.CharField(max_length=891) + class Meta: db_table = 'profile_addresses_components_enum' @@ -1445,13 +1473,13 @@ class ProfileAddressComponent(models.Model): group = models.ForeignKey(Group, db_column='groupid', blank=True, null=True) addr_type = models.CharField(max_length=15, db_column='type') subid = models.IntegerField(db_column='id') - pkey = models.CompositeField(profile, job, group, addr_type, subid, primary_key=True) component = models.ForeignKey(ProfileAddressComponentEnum, related_name='component_links') - address = models.ForeignKey(ProfileAddress, related_name='component_links', - aux_field='pkey') + address = models.ForeignKey(ProfileAddress, related_name='component_links') + class Meta: db_table = 'profile_addresses_components' + unique_together = (('pid', 'jobid', 'groupid', 'type', 'id'),) def __str__(self): return "%s (%s) for %s" % ( @@ -1466,9 +1494,10 @@ class ProfileAddressComponent(models.Model): class ProfileBinetEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) text = models.CharField(max_length=150) url = models.CharField(max_length=765) + class Meta: db_table = 'profile_binet_enum' @@ -1476,20 +1505,22 @@ class ProfileBinetEnum(models.Model): class ProfileBinet(models.Model): profile = models.ForeignKey(Profile, db_column='pid') binet = models.ForeignKey(ProfileBinetEnum) - pkey = models.CompositeField(profile, binet, primary_key=True) + class Meta: db_table = 'profile_binets' + unique_together = (('pid', 'binet'),) class ProfileHobby(models.Model): profile = models.ForeignKey(Profile, db_column='pid') id = models.IntegerField() - pkey = models.CompositeField(profile, id, primary_key=True) type = models.CharField(max_length=18) text = models.CharField(max_length=765) pub = models.CharField(max_length=21) + class Meta: db_table = 'profile_hobby' + unique_together = (('pid', 'id'),) class ProfileNetworkingEnum(models.Model): @@ -1499,6 +1530,7 @@ class ProfileNetworkingEnum(models.Model): filter = models.CharField(max_length=18) network_type = models.CharField(max_length=18) link = models.CharField(max_length=765) + class Meta: db_table = 'profile_networking_enum' @@ -1507,11 +1539,12 @@ class ProfileNetworking(models.Model): profile = models.ForeignKey(Profile, db_column='pid') id = models.IntegerField() nwid = models.ForeignKey(ProfileNetworkingEnum, db_column='nwid') - pkey = models.CompositeField(id, nwid, primary_key=True) address = models.CharField(max_length=765) pub = models.CharField(max_length=21) + class Meta: db_table = 'profile_networking' + unique_together = (('pid', 'nwid'),) # Profile::corps @@ -1520,10 +1553,11 @@ class ProfileNetworking(models.Model): @python_2_unicode_compatible class ProfileCorpsEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255, unique=True) abbreviation = models.CharField(max_length=15, unique=True) still_exists = models.IntegerField() + class Meta: db_table = 'profile_corps_enum' @@ -1533,9 +1567,10 @@ class ProfileCorpsEnum(models.Model): @python_2_unicode_compatible class ProfileCorpsRankEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255, unique=True) abbreviation = models.CharField(max_length=15, unique=True) + class Meta: db_table = 'profile_corps_rank_enum' @@ -1551,6 +1586,7 @@ class ProfileCorps(models.Model): rank = models.ForeignKey(ProfileCorpsRankEnum, db_column='rankid') # Ignored: corps is public information anyway. corps_pub = models.CharField(max_length=21) + class Meta: db_table = 'profile_corps' @@ -1564,7 +1600,7 @@ class ProfileCorps(models.Model): @python_2_unicode_compatible class ProfileEducationEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255, unique=True, blank=True) abbreviation = models.CharField(max_length=765) url = models.CharField(max_length=765, blank=True) @@ -1582,10 +1618,11 @@ class ProfileEducationEnum(models.Model): @python_2_unicode_compatible class ProfileEducationDegreeEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) degree = models.CharField(max_length=255, unique=True, blank=True) abbreviation = models.CharField(max_length=765) level = models.IntegerField() + class Meta: db_table = 'profile_education_degree_enum' @@ -1595,8 +1632,9 @@ class ProfileEducationDegreeEnum(models.Model): @python_2_unicode_compatible class ProfileEducationFieldEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) field = models.CharField(max_length=255, unique=True, blank=True) + class Meta: db_table = 'profile_education_field_enum' @@ -1608,8 +1646,6 @@ class ProfileEducationFieldEnum(models.Model): class ProfileEducation(models.Model): id = models.IntegerField() profile = models.ForeignKey(Profile, db_column='pid', related_name='educations') - pkey = models.CompositeField(id, profile, primary_key=True) - school = models.ForeignKey(ProfileEducationEnum, null=True, db_column='eduid', blank=True) degree = models.ForeignKey(ProfileEducationDegreeEnum, null=True, db_column='degreeid', blank=True) field = models.ForeignKey(ProfileEducationFieldEnum, null=True, db_column='fieldid', blank=True) @@ -1618,8 +1654,10 @@ class ProfileEducation(models.Model): promo_year = models.IntegerField(null=True, blank=True) program = models.CharField(max_length=765, blank=True) flags = models.CharField(max_length=81) + class Meta: db_table = 'profile_education' + unique_together = (('id', 'pid'),) def __str__(self): return "%s: %s" % (self.profile.hrpid, self.edu.name) @@ -1629,9 +1667,10 @@ class ProfileEducation(models.Model): class ProfileEducationDegree(models.Model): edu = models.ForeignKey(ProfileEducationEnum, db_column='eduid') degree = models.ForeignKey(ProfileEducationDegreeEnum, db_column='degreeid') - pkey = models.CompositeField(edu, degree, primary_key=True) + class Meta: db_table = 'profile_education_degree' + unique_together = (('eduid', 'degreeid'),) def __str__(self): return "%s - %s" % (self.edu, self.degree) @@ -1643,7 +1682,7 @@ class ProfileEducationDegree(models.Model): @python_2_unicode_compatible class ProfileJobEnum(models.Model): - #id = models.IntegerField(primary_key=True) + id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255, unique=True) acronym = models.CharField(max_length=765, blank=True) url = models.CharField(max_length=765, blank=True) @@ -1652,6 +1691,7 @@ class ProfileJobEnum(models.Model): naf_code = models.CharField(max_length=15, db_column='NAF_code', blank=True) # Field name made lowercase. ax_code = models.BigIntegerField(null=True, db_column='AX_code', blank=True) # Field name made lowercase. siren_code = models.CharField(max_length=9, null=True, db_column='SIREN_code', blank=True) # Field name made lowercase. + class Meta: db_table = 'profile_job_enum' @@ -1674,8 +1714,6 @@ class ProfileJobEnum(models.Model): class ProfileJob(models.Model): id = models.IntegerField() profile = models.ForeignKey(Profile, db_column='pid', related_name='jobs') - pkey = models.CompositeField(profile, id, primary_key=True) - company = models.ForeignKey(ProfileJobEnum, null=True, db_column='jobid', blank=True) description = models.CharField(max_length=765) url = models.CharField(max_length=765) @@ -1683,8 +1721,10 @@ class ProfileJob(models.Model): pub = models.CharField(max_length=21) email_pub = models.CharField(max_length=21) entry_year = models.CharField(max_length=12, blank=True) + class Meta: db_table = 'profile_job' + unique_together = (('pid', 'id'),) @property def ax_visible(self): @@ -1707,6 +1747,7 @@ class ProfileJobTermEnum(models.Model): jtid = models.AutoField(primary_key=True) name = models.CharField(max_length=765) full_name = models.CharField(max_length=765) + class Meta: db_table = 'profile_job_term_enum' @@ -1720,9 +1761,10 @@ class ProfileJobTermRelation(models.Model): jtid_2 = models.ForeignKey(ProfileJobTermEnum, db_column='jtid_2', related_name='relations_to') rel = models.CharField(max_length=24) computed = models.CharField(max_length=24) - pkey = models.CompositeField(jtid_1, jtid_2, computed, primary_key=True) + class Meta: db_table = 'profile_job_term_relation' + unique_together = (('jtid_1', 'jtid_2', 'computed'),) def __str__(self): return "%s <-> %s" % (self.jtid_1.name, self.jtid_2.name) @@ -1732,9 +1774,10 @@ class ProfileJobTermRelation(models.Model): class ProfileJobTermSearch(models.Model): search = models.CharField(max_length=150) job_term = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') - pkey = models.CompositeField(search, job_term, primary_key=True) + class Meta: db_table = 'profile_job_term_search' + unique_together = (('search', 'job_term'),) def __str__(self): return "%s => %s" % (self.search, self.job_term.name) -- 2.1.4