From 27b0b59fed4b886e8d2e968911ca26a0ed11d3bc Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Fri, 18 Sep 2015 18:50:56 +0200 Subject: [PATCH] Python3 compatibility --- database/platal/models.py | 626 ++++++++++++++++++++++++++-------------------- 1 file changed, 354 insertions(+), 272 deletions(-) diff --git a/database/platal/models.py b/database/platal/models.py index 29f4761..7ef05e4 100644 --- a/database/platal/models.py +++ b/database/platal/models.py @@ -25,8 +25,10 @@ https://github.com/Polytechnique-org/platal/tree/xorg/maint/upgrade This requires Django to work. """ +from __future__ import unicode_literals import collections from django.db import models +from django.utils.encoding import python_2_unicode_compatible def is_ax_visible(field): @@ -37,6 +39,7 @@ def is_ax_visible(field): # ======================== +@python_2_unicode_compatible class Skin(models.Model): #id = models.IntegerField(primary_key=True) name = models.CharField(max_length=96) @@ -46,33 +49,36 @@ class Skin(models.Model): skin_tpl = models.CharField(max_length=96) ext = models.CharField(max_length=9) class Meta: - db_table = u'skins' + db_table = 'skins' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible class EmailVirtualDomain(models.Model): #id = models.IntegerField(primary_key=True) name = models.CharField(max_length=765) aliasing = models.ForeignKey('self', db_column='aliasing') class Meta: - db_table = u'email_virtual_domains' + db_table = 'email_virtual_domains' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible class ProfileSectionEnum(models.Model): #id = models.IntegerField(primary_key=True) text = models.CharField(max_length=150, unique=True) class Meta: - db_table = u'profile_section_enum' + db_table = 'profile_section_enum' - def __unicode__(self): + def __str__(self): return self.text +@python_2_unicode_compatible class GeolocCountry(models.Model): iso_3166_1_a2 = models.CharField(max_length=6, primary_key=True) iso_3166_1_a3 = models.CharField(max_length=9, unique=True) @@ -89,9 +95,9 @@ class GeolocCountry(models.Model): belongsto = models.ForeignKey('self', null=True, db_column='belongsTo', blank=True) # Field name made lowercase. countryplain = models.CharField(max_length=765, db_column='countryPlain', blank=True) # Field name made lowercase. class Meta: - db_table = u'geoloc_countries' + db_table = 'geoloc_countries' - def __unicode__(self): + def __str__(self): return self.iso_3166_1_a2 @@ -99,17 +105,19 @@ class GeolocCountry(models.Model): # =============== +@python_2_unicode_compatible class AccountType(models.Model): type = models.CharField(max_length=48, primary_key=True) perms = models.CharField(max_length=321) description = models.TextField(blank=True) class Meta: - db_table = u'account_types' + db_table = 'account_types' - def __unicode__(self): + def __str__(self): return self.type +@python_2_unicode_compatible class Account(models.Model): uid = models.AutoField(primary_key=True) hruid = models.CharField(max_length=255, unique=True) @@ -138,16 +146,17 @@ class Account(models.Model): from_email = models.CharField(max_length=765) from_format = models.CharField(max_length=12) class Meta: - db_table = u'accounts' + db_table = 'accounts' - def __unicode__(self): - return u'%s (%s)' % (self.hruid, self.full_name) + def __str__(self): + return '%s (%s)' % (self.hruid, self.full_name) @property def profile(self): return self.profiles.filter(perms='owner').get().profile +@python_2_unicode_compatible class ProfileAlias(object): def __init__(self, alias_of, kind, lastname, firstname=None): self.alias_of = alias_of @@ -166,13 +175,13 @@ class ProfileAlias(object): def get_kind_display(self): if self.kind == self.ALT_MARITAL: if self.female: - return u"Mme" + return "Mme" else: - return u"M." + return "M." elif self.kind == self.ALT_PSEUDO: - return u"Pseudonyme" + return "Pseudonyme" else: - return u"" + return "" def __getattr__(self, attr): return getattr(self.alias_of, attr) @@ -181,6 +190,7 @@ class ProfileAlias(object): return '' % (self.kind, self.alias_of) +@python_2_unicode_compatible class Profile(models.Model): alias_of = None @@ -213,9 +223,9 @@ class Profile(models.Model): title = models.CharField(max_length=12) class Meta: - db_table = u'profiles' + db_table = 'profiles' - def __unicode__(self): + def __str__(self): return self.hrpid @property @@ -273,7 +283,7 @@ class Profile(models.Model): def country_name(self): nat = self.nationality if nat is None: - return u"France" + return "France" return nat.country @property @@ -381,58 +391,63 @@ class Profile(models.Model): return jobs +@python_2_unicode_compatible class AccountProfile(models.Model): account = models.ForeignKey(Account, db_column='uid', related_name='profiles') profile = models.ForeignKey(Profile, db_column='pid', related_name='accounts') pkey = models.CompositeField(account, profile, primary_key=True) perms = models.CharField(max_length=15) class Meta: - db_table = u'account_profiles' + db_table = 'account_profiles' - def __unicode__(self): - return u'%s -> %s' % (self.account.hruid, self.profile.hrpid) + def __str__(self): + return '%s -> %s' % (self.account.hruid, self.profile.hrpid) # Account-related # =============== +@python_2_unicode_compatible class AccountAuthOpenid(models.Model): #id = models.IntegerField(primary_key=True) account = models.ForeignKey(Account, unique=True, null=True, db_column='uid', blank=True) url = models.CharField(max_length=255, unique=True) class Meta: - db_table = u'account_auth_openid' + db_table = 'account_auth_openid' - def __unicode__(self): - return u"%s at %s" % (self.account, self.url) + def __str__(self): + return "%s at %s" % (self.account, self.url) +@python_2_unicode_compatible class AccountLostPassword(models.Model): certificat = models.CharField(max_length=96, primary_key=True) account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) created = models.DateTimeField(null=True, blank=True) class Meta: - db_table = u'account_lost_passwords' + db_table = 'account_lost_passwords' - def __unicode__(self): - return u"%s on %s" % (self.account.hruid, self.created) + def __str__(self): + return "%s on %s" % (self.account.hruid, self.created) +@python_2_unicode_compatible class AccountXnetLostPassword(models.Model): account = models.ForeignKey(Account, primary_key=True, db_column='uid') date = models.DateTimeField(null=True, blank=True) hash = models.CharField(max_length=96) class Meta: - db_table = u'account_xnet_lost_passwords' + db_table = 'account_xnet_lost_passwords' - def __unicode__(self): - return u"%s on %s" % (self.account.hruid, self.date) + def __str__(self): + return "%s on %s" % (self.account.hruid, self.date) # Announces # ========= +@python_2_unicode_compatible class Announce(models.Model): #id = models.IntegerField(primary_key=True) account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) @@ -447,12 +462,13 @@ class Announce(models.Model): post_id = models.IntegerField(null=True, blank=True, editable=False, help_text=u"NNTP post identifier") class Meta: - db_table = u'announces' + db_table = 'announces' - def __unicode__(self): - return u"%s: %s" % (self.id, self.titre) + def __str__(self): + return "%s: %s" % (self.id, self.titre) +@python_2_unicode_compatible class AnnouncePhoto(models.Model): eid = models.ForeignKey(Announce, primary_key=True, db_column='eid') attachmime = models.CharField(max_length=12) @@ -460,27 +476,29 @@ class AnnouncePhoto(models.Model): x = models.IntegerField() y = models.IntegerField() class Meta: - db_table = u'announce_photos' + db_table = 'announce_photos' - def __unicode__(self): - return u"%s (%s, %d x %d)" % (self.eid, self.attachmime, self.x, self.y) + def __str__(self): + return "%s (%s, %d x %d)" % (self.eid, self.attachmime, self.x, self.y) +@python_2_unicode_compatible class AnnounceRead(models.Model): evt = models.ForeignKey(Announce) account = models.ForeignKey(Account, db_column='uid') pkey = models.CompositeField(evt, account, primary_key=True) class Meta: - db_table = u'announce_read' + db_table = 'announce_read' - def __unicode__(self): - return u"%s: %s" % (self.account, self.evt) + def __str__(self): + return "%s: %s" % (self.account, self.evt) # Email routing # ============= +@python_2_unicode_compatible class EmailVirtual(models.Model): email = models.CharField(max_length=255) domain = models.ForeignKey(EmailVirtualDomain, db_column='domain') @@ -489,12 +507,13 @@ class EmailVirtual(models.Model): type = models.CharField(max_length=21, blank=True) expire = models.DateField() class Meta: - db_table = u'email_virtual' + db_table = 'email_virtual' - def __unicode__(self): - return u"%s@%s (%s)" % (self.email, self.domain, self.type) + def __str__(self): + return "%s@%s (%s)" % (self.email, self.domain, self.type) +@python_2_unicode_compatible class EmailRedirectAccount(models.Model): account = models.ForeignKey(Account, db_column='uid') redirect = models.CharField(max_length=765) @@ -509,12 +528,13 @@ class EmailRedirectAccount(models.Model): hash = models.CharField(max_length=96, blank=True) allow_rewrite = models.BooleanField() class Meta: - db_table = u'email_redirect_account' + db_table = 'email_redirect_account' - def __unicode__(self): - return u"%s for %s (%s)" % (self.redirect, self.account.hruid, self.type) + def __str__(self): + return "%s for %s (%s)" % (self.redirect, self.account.hruid, self.type) +@python_2_unicode_compatible class EmailSourceAccount(models.Model): email = models.CharField(max_length=255) domain = models.ForeignKey(EmailVirtualDomain, db_column='domain') @@ -525,12 +545,13 @@ class EmailSourceAccount(models.Model): flags = models.CharField(max_length=69) expire = models.DateField(null=True, blank=True) class Meta: - db_table = u'email_source_account' + db_table = 'email_source_account' - def __unicode__(self): - return u"%s@%s (%s)" % (self.email, self.domain, self.type) + def __str__(self): + return "%s@%s (%s)" % (self.email, self.domain, self.type) +@python_2_unicode_compatible class EmailSourceOther(models.Model): email = models.CharField(max_length=255) domain = models.ForeignKey(EmailVirtualDomain, db_column='domain') @@ -540,12 +561,13 @@ class EmailSourceOther(models.Model): type = models.CharField(max_length=24, blank=True) expire = models.DateField(null=True, blank=True) class Meta: - db_table = u'email_source_other' + db_table = 'email_source_other' - def __unicode__(self): - return u"%s@%s (%s)" % (self.email, self.domain, self.type) + def __str__(self): + return "%s@%s (%s)" % (self.email, self.domain, self.type) +@python_2_unicode_compatible class EmailRedirectOther(models.Model): hrmid = models.ForeignKey(EmailSourceOther, db_column='hrmid') redirect = models.CharField(max_length=765) @@ -553,16 +575,17 @@ class EmailRedirectOther(models.Model): type = models.CharField(max_length=30) action = models.CharField(max_length=54) class Meta: - db_table = u'email_redirect_other' + db_table = 'email_redirect_other' - def __unicode__(self): - return u"%s -> %s (%s)" % (self.hrmid, self.redirect, self.type) + def __str__(self): + return "%s -> %s (%s)" % (self.hrmid, self.redirect, self.type) # innd-related # ============ +@python_2_unicode_compatible class InndForum(models.Model): """ACLs for innd""" id_innd = models.AutoField(primary_key=True) @@ -574,12 +597,13 @@ class InndForum(models.Model): priority = models.IntegerField(null=True, blank=True) comment = models.TextField(blank=True) class Meta: - db_table = u'forum_innd' + db_table = 'forum_innd' - def __unicode__(self): + def __str__(self): return "%d: %s" % (self.id_innd, self.account.hruid) +@python_2_unicode_compatible class ForumProfile(models.Model): account = models.ForeignKey(Account, primary_key=True, db_column='uid') name = models.CharField(max_length=192) @@ -590,37 +614,40 @@ class ForumProfile(models.Model): tree_read = models.CharField(max_length=24) last_seen = models.DateTimeField() class Meta: - db_table = u'forum_profiles' + db_table = 'forum_profiles' - def __unicode__(self): - return u"%s: %s" % (self.account.hruid, self.name) + def __str__(self): + return "%s: %s" % (self.account.hruid, self.name) +@python_2_unicode_compatible class Forum(models.Model): fid = models.IntegerField(primary_key=True) name = models.CharField(max_length=192) class Meta: - db_table = u'forums' + db_table = 'forums' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible 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 = u'forum_subs' + db_table = 'forum_subs' - def __unicode__(self): - return u"%s by %s" % (self.forum.name, self.account.hruid) + def __str__(self): + return "%s by %s" % (self.forum.name, self.account.hruid) # Payments # ======== +@python_2_unicode_compatible class PaymentBankAccount(models.Model): #id = models.IntegerField(primary_key=True) asso = models.ForeignKey('Group', blank=True, null=True) @@ -629,12 +656,13 @@ class PaymentBankAccount(models.Model): status = models.CharField(max_length=36) bic = models.CharField(max_length=11) class Meta: - db_table = u'payment_bankaccounts' + db_table = 'payment_bankaccounts' - def __unicode__(self): - return u'%s: %s' % (self.asso.name, self.account) + def __str__(self): + return '%s: %s' % (self.asso.name, self.account) +@python_2_unicode_compatible class Payment(models.Model): #id = models.IntegerField(primary_key=True) text = models.CharField(max_length=765) @@ -648,33 +676,36 @@ class Payment(models.Model): asso = models.ForeignKey('Group', null=True, blank=True) rib = models.ForeignKey(PaymentBankAccount) class Meta: - db_table = u'payments' + db_table = 'payments' - def __unicode__(self): - return u"%s: %s" % (self.id, self.text) + def __str__(self): + return "%s: %s" % (self.id, self.text) +@python_2_unicode_compatible class PaymentCodeC(models.Model): id = models.IntegerField(primary_key=True) text = models.CharField(max_length=192) class Meta: - db_table = u'payment_codeC' + db_table = 'payment_codeC' - def __unicode__(self): + def __str__(self): return self.text +@python_2_unicode_compatible 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 = u'payment_codeRCB' + db_table = 'payment_codeRCB' - def __unicode__(self): + def __str__(self): return self.text +@python_2_unicode_compatible class PaymentMethod(models.Model): id = models.IntegerField(primary_key=True) text = models.CharField(max_length=96) @@ -682,12 +713,13 @@ class PaymentMethod(models.Model): short_name = models.CharField(max_length=30) flags = models.CharField(max_length=36, blank=True) class Meta: - db_table = u'payment_methods' + db_table = 'payment_methods' - def __unicode__(self): + def __str__(self): return self.short_name +@python_2_unicode_compatible class PaymentReconcilation(models.Model): #id = models.IntegerField(primary_key=True) method = models.ForeignKey(PaymentMethod) @@ -700,12 +732,13 @@ class PaymentReconcilation(models.Model): comments = models.TextField() recongroup_id = models.IntegerField(null=True, blank=True) class Meta: - db_table = u'payment_reconcilations' + db_table = 'payment_reconcilations' - def __unicode__(self): - return u"%s: %s" % (self.method, self.status) + def __str__(self): + return "%s: %s" % (self.method, self.status) +@python_2_unicode_compatible class PaymentTransaction(models.Model): id = models.CharField(max_length=192, primary_key=True) method = models.ForeignKey(PaymentMethod, null=True, blank=True) @@ -722,12 +755,13 @@ class PaymentTransaction(models.Model): recon = models.ForeignKey(PaymentReconcilation, null=True, blank=True) display = models.IntegerField() class Meta: - db_table = u'payment_transactions' + db_table = 'payment_transactions' - def __unicode__(self): - return u"%s (%s)" % (self.fullref, self.ref) + def __str__(self): + return "%s (%s)" % (self.fullref, self.ref) +@python_2_unicode_compatible class PaymentTransfer(models.Model): #id = models.IntegerField(primary_key=True) recongroup_id = models.IntegerField() @@ -737,27 +771,29 @@ class PaymentTransfer(models.Model): message = models.CharField(max_length=765) date = models.DateField(null=True, blank=True) class Meta: - db_table = u'payment_transfers' + db_table = 'payment_transfers' - def __unicode__(self): - return u"%s: %s" % (self.id, self.amount) + def __str__(self): + return "%s: %s" % (self.id, self.amount) # Groups # ====== +@python_2_unicode_compatible class GroupDom(models.Model): #id = models.IntegerField(primary_key=True) name = models.TextField(db_column='nom') cat = models.CharField(max_length=117) class Meta: - db_table = u'group_dom' + db_table = 'group_dom' - def __unicode__(self): - return u"%s :: %s" % (self.cat, self.name) + def __str__(self): + return "%s :: %s" % (self.cat, self.name) +@python_2_unicode_compatible class Group(models.Model): #id = models.IntegerField(primary_key=True) name = models.CharField(max_length=765, db_column='nom') @@ -784,9 +820,9 @@ class Group(models.Model): disable_mails = models.BooleanField() status = models.CharField(max_length=117) class Meta: - db_table = u'groups' + db_table = 'groups' - def __unicode__(self): + def __str__(self): return self.name @@ -794,6 +830,7 @@ class Group(models.Model): # ----------------- +@python_2_unicode_compatible class GroupMember(models.Model): asso = models.ForeignKey(Group) account = models.ForeignKey(Account, db_column='uid') @@ -804,12 +841,13 @@ class GroupMember(models.Model): position = models.CharField(max_length=54, blank=True) flags = models.CharField(max_length=18) class Meta: - db_table = u'group_members' + db_table = 'group_members' - def __unicode__(self): - return u"%s to %s" % (self.account.hruid, self.asso.name) + def __str__(self): + return "%s to %s" % (self.account.hruid, self.asso.name) +@python_2_unicode_compatible class GroupMemberSubRequest(models.Model): asso = models.ForeignKey(Group) account = models.ForeignKey(Account, db_column='uid') @@ -818,12 +856,13 @@ class GroupMemberSubRequest(models.Model): ts = models.DateTimeField() reason = models.TextField(blank=True) class Meta: - db_table = u'group_member_sub_requests' + db_table = 'group_member_sub_requests' - def __unicode__(self): - return u"%s to %s" % (self.account.hruid, self.asso.name) + def __str__(self): + return "%s to %s" % (self.account.hruid, self.asso.name) +@python_2_unicode_compatible class GroupFormerMember(models.Model): asso = models.ForeignKey(Group) account = models.ForeignKey(Account, db_column='uid') @@ -832,16 +871,17 @@ class GroupFormerMember(models.Model): remember = models.IntegerField() unsubsciption_date = models.DateField() class Meta: - db_table = u'group_former_members' + db_table = 'group_former_members' - def __unicode__(self): - return u"%s to %s" % (self.account.hruid, self.asso.name) + def __str__(self): + return "%s to %s" % (self.account.hruid, self.asso.name) # Group::Announces # ---------------- +@python_2_unicode_compatible class GroupAnnounce(models.Model): #id = models.IntegerField(primary_key=True) account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) @@ -857,12 +897,13 @@ class GroupAnnounce(models.Model): post_id = models.IntegerField(null=True, blank=True, help_text=u"NNTP post ID") class Meta: - db_table = u'group_announces' + db_table = 'group_announces' - def __unicode__(self): - return u"%s: %s" % (self.asso.name, self.titre) + def __str__(self): + return "%s: %s" % (self.asso.name, self.titre) +@python_2_unicode_compatible class GroupAnnouncePhoto(models.Model): eid = models.ForeignKey(GroupAnnounce, primary_key=True, db_column='eid') attachmime = models.CharField(max_length=12) @@ -870,27 +911,29 @@ class GroupAnnouncePhoto(models.Model): x = models.IntegerField() y = models.IntegerField() class Meta: - db_table = u'group_announces_photo' + db_table = 'group_announces_photo' - def __unicode__(self): - return u"%s (%s, %d x %d)" % (self.eid, self.attachmime, self.x, self.y) + def __str__(self): + return "%s (%s, %d x %d)" % (self.eid, self.attachmime, self.x, self.y) +@python_2_unicode_compatible 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 = u'group_announces_read' + db_table = 'group_announces_read' - def __unicode__(self): - return u"%s: %s" % (self.account.hruid, self.announce_id) + def __str__(self): + return "%s: %s" % (self.account.hruid, self.announce_id) # Group::Event # ------------ +@python_2_unicode_compatible class GroupEvent(models.Model): eid = models.IntegerField(primary_key=True) asso = models.ForeignKey(Group, null=True, blank=True) @@ -908,12 +951,13 @@ class GroupEvent(models.Model): archive = models.BooleanField() subscription_notification = models.CharField(max_length=24) class Meta: - db_table = u'group_events' + db_table = 'group_events' - def __unicode__(self): - return u"%s: %s" % (self.asso.name, self.intitule) + def __str__(self): + return "%s: %s" % (self.asso.name, self.intitule) +@python_2_unicode_compatible class GroupEventItem(models.Model): event = models.ForeignKey(GroupEvent, db_column='eid') item_id = models.IntegerField() @@ -923,12 +967,13 @@ class GroupEventItem(models.Model): details = models.TextField() montant = models.DecimalField(max_digits=12, decimal_places=2) class Meta: - db_table = u'group_event_items' + db_table = 'group_event_items' - def __unicode__(self): - return u"%s - %s" % (self.event, self.item_id) + def __str__(self): + return "%s - %s" % (self.event, self.item_id) +@python_2_unicode_compatible class GroupEventParticipant(models.Model): event = models.ForeignKey(GroupEvent, db_column='eid') item_id = models.IntegerField() @@ -940,16 +985,17 @@ class GroupEventParticipant(models.Model): flags = models.CharField(max_length=42) paid = models.FloatField() class Meta: - db_table = u'group_event_participants' + db_table = 'group_event_participants' - def __unicode__(self): - return u"%s to %s" % (self.account.hruid, self.item) + def __str__(self): + return "%s to %s" % (self.account.hruid, self.item) # Group::misc # ----------- +@python_2_unicode_compatible class GroupAuth(models.Model): #id = models.IntegerField(primary_key=True) privkey = models.CharField(max_length=120, unique=True) @@ -960,9 +1006,9 @@ class GroupAuth(models.Model): group = models.ForeignKey(Group, null=True, blank=True) flags = models.CharField(max_length=63, blank=True) class Meta: - db_table = u'group_auth' + db_table = 'group_auth' - def __unicode__(self): + def __str__(self): return self.name @@ -970,6 +1016,7 @@ class GroupAuth(models.Model): # ======= +@python_2_unicode_compatible class IpWatch(models.Model): state = models.CharField(max_length=27) detection = models.DateField(null=True, blank=True) @@ -979,23 +1026,25 @@ class IpWatch(models.Model): ip = models.IntegerField(primary_key=True) mask = models.IntegerField() class Meta: - db_table = u'ip_watch' + db_table = 'ip_watch' - def __unicode__(self): + def __str__(self): return self.ip +@python_2_unicode_compatible class LogAction(models.Model): #id = models.IntegerField(primary_key=True) text = models.CharField(max_length=96) description = models.CharField(max_length=765) class Meta: - db_table = u'log_actions' + db_table = 'log_actions' - def __unicode__(self): + def __str__(self): return self.text +@python_2_unicode_compatible class LogSession(models.Model): #id = models.IntegerField(primary_key=True) auth = models.CharField(max_length=18) @@ -1010,50 +1059,54 @@ class LogSession(models.Model): ip = models.IntegerField() forward_ip = models.IntegerField(null=True, blank=True) class Meta: - db_table = u'log_sessions' + db_table = 'log_sessions' - def __unicode__(self): - return u"%s: %s@%s" % (self.id, self.account.hruid, self.host) + def __str__(self): + return "%s: %s@%s" % (self.id, self.account.hruid, self.host) +@python_2_unicode_compatible 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 = u'log_last_sessions' + db_table = 'log_last_sessions' - def __unicode__(self): + def __str__(self): return self.account.hruid +@python_2_unicode_compatible class LogEvent(models.Model): stamp = models.DateTimeField(primary_key=True) session = models.ForeignKey(LogSession, db_column='session') action = models.ForeignKey(LogAction, db_column='action') data = models.TextField(blank=True) class Meta: - db_table = u'log_events' + db_table = 'log_events' - def __unicode__(self): - return u"%s@%s: %s" % (self.session_id, self.stamp, self.action.text) + def __str__(self): + return "%s@%s: %s" % (self.session_id, self.stamp, self.action.text) # Newsletters # =========== +@python_2_unicode_compatible class Newsletter(models.Model): #id = models.IntegerField(primary_key=True) group = models.ForeignKey(Group, unique=True) name = models.CharField(max_length=765) criteria = models.CharField(max_length=42, blank=True) class Meta: - db_table = u'newsletters' + db_table = 'newsletters' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible class NewsletterIssue(models.Model): nlid = models.ForeignKey(Newsletter, unique=True, db_column='nlid') #id = models.IntegerField(primary_key=True) @@ -1069,24 +1122,26 @@ class NewsletterIssue(models.Model): unsubscribe = models.IntegerField() reply_to = models.CharField(max_length=765) class Meta: - db_table = u'newsletter_issues' + db_table = 'newsletter_issues' - def __unicode__(self): + def __str__(self): return self.title +@python_2_unicode_compatible class NewsletterCat(models.Model): cid = models.AutoField(primary_key=True) nlid = models.ForeignKey(Newsletter, db_column='nlid') pos = models.IntegerField() title = models.CharField(max_length=384) class Meta: - db_table = u'newsletter_cat' + db_table = 'newsletter_cat' - def __unicode__(self): + def __str__(self): return self.title +@python_2_unicode_compatible class NewsletterArt(models.Model): issue = models.ForeignKey(NewsletterIssue, db_column='id') aid = models.IntegerField() @@ -1097,12 +1152,13 @@ class NewsletterArt(models.Model): body = models.TextField() append = models.TextField() class Meta: - db_table = u'newsletter_art' + db_table = 'newsletter_art' - def __unicode__(self): - return u"%s: %s" % (self.issue_id, self.title) + def __str__(self): + return "%s: %s" % (self.issue_id, self.title) +@python_2_unicode_compatible class NewsletterIns(models.Model): account = models.ForeignKey(Account, db_column='uid') nl = models.ForeignKey(Newsletter, db_column='nlid') @@ -1110,16 +1166,17 @@ class NewsletterIns(models.Model): last = models.ForeignKey(NewsletterIssue, null=True, db_column='last', blank=True) hash = models.CharField(max_length=96, blank=True) class Meta: - db_table = u'newsletter_ins' + db_table = 'newsletter_ins' - def __unicode__(self): - return u"%s to %s" % (self.account.hruid, self.nl.title) + def __str__(self): + return "%s to %s" % (self.account.hruid, self.nl.title) # Profile # ======= +@python_2_unicode_compatible class ProfileDisplay(models.Model): profile = models.OneToOneField(Profile, primary_key=True, db_column='pid') yourself = models.CharField(max_length=765) @@ -1130,12 +1187,13 @@ class ProfileDisplay(models.Model): sort_name = models.CharField(max_length=765) promo = models.CharField(max_length=765) class Meta: - db_table = u'profile_display' + db_table = 'profile_display' - def __unicode__(self): + def __str__(self): return self.profile.hrpid +@python_2_unicode_compatible class ProfilePhone(models.Model): LINK_ADDRESS = 'address' LINK_PRO = 'pro' @@ -1172,10 +1230,10 @@ class ProfilePhone(models.Model): comment = models.CharField(max_length=240) class Meta: - db_table = u'profile_phones' + db_table = 'profile_phones' - def __unicode__(self): - return u"%s: %s (%s)" % (self.profile.hrpid, self.display_tel, self.tel_type) + def __str__(self): + return "%s: %s (%s)" % (self.profile.hrpid, self.display_tel, self.tel_type) @property def is_address(self): @@ -1190,6 +1248,7 @@ class ProfilePhone(models.Model): return is_ax_visible(self.pub) +@python_2_unicode_compatible class ProfilePhoto(models.Model): profile = models.OneToOneField(Profile, primary_key=True, db_column='pid', related_name='photo') attachmime = models.CharField(max_length=12) @@ -1199,12 +1258,13 @@ class ProfilePhoto(models.Model): pub = models.CharField(max_length=21) last_update = models.DateTimeField() class Meta: - db_table = u'profile_photos' + db_table = 'profile_photos' - def __unicode__(self): + def __str__(self): return self.profile.hrpid +@python_2_unicode_compatible class ProfilePrivateName(models.Model): profile = models.ForeignKey(Profile, db_column='pid', related_name='private_name') type = models.CharField(max_length=27) @@ -1212,12 +1272,13 @@ class ProfilePrivateName(models.Model): pkey = models.CompositeField(profile, type, id, primary_key=True) name = models.CharField(max_length=765) class Meta: - db_table = u'profile_private_names' + db_table = 'profile_private_names' - def __unicode__(self): - return u"%s: %s" % (self.profile.hrpid, self.type) + def __str__(self): + return "%s: %s" % (self.profile.hrpid, self.type) +@python_2_unicode_compatible class ProfilePublicName(models.Model): profile = models.OneToOneField(Profile, primary_key=True, db_column='pid', related_name='public_name') lastname_initial = models.CharField(max_length=765) @@ -1229,9 +1290,9 @@ class ProfilePublicName(models.Model): firstname_ordinary = models.CharField(max_length=765) pseudonym = models.CharField(max_length=765) class Meta: - db_table = u'profile_public_names' + db_table = 'profile_public_names' - def __unicode__(self): + def __str__(self): return self.profile.hrpid @@ -1239,6 +1300,7 @@ class ProfilePublicName(models.Model): # ------------------ +@python_2_unicode_compatible class ProfileAddress(models.Model): KIND_HOME = 'home' @@ -1288,9 +1350,9 @@ class ProfileAddress(models.Model): through='ProfileAddressComponent', related_name='addresses') class Meta: - db_table = u'profile_addresses' + db_table = 'profile_addresses' - def __unicode__(self): + def __str__(self): if self.addr_type == self.KIND_HOME: rel = self.profile.hrpid elif self.addr_type == self.KIND_HQ: @@ -1302,7 +1364,7 @@ class ProfileAddress(models.Model): rel = unicode(self.group) else: rel = u"%s at %s" % (self.profile.hrpid, self.pjob.company) - return u"%s address %d for %s" % ( + return "%s address %d for %s" % ( self.get_addr_type_display(), self.subid, rel) @property @@ -1345,18 +1407,20 @@ class ProfileAddress(models.Model): return self.addr_type == self.KIND_JOB +@python_2_unicode_compatible class ProfileAddressComponentEnum(models.Model): #id = models.BigIntegerField(primary_key=True) short_name = models.CharField(max_length=765) long_name = models.CharField(max_length=765) types = models.CharField(max_length=891) class Meta: - db_table = u'profile_addresses_components_enum' + db_table = 'profile_addresses_components_enum' - def __unicode__(self): - return u'%s (%s)' % (self.short_name, self.types) + def __str__(self): + return '%s (%s)' % (self.short_name, self.types) +@python_2_unicode_compatible class ProfileAddressComponent(models.Model): profile = models.ForeignKey(Profile, db_column='pid') job = models.ForeignKey('ProfileJobEnum', db_column='jobid') @@ -1369,10 +1433,10 @@ class ProfileAddressComponent(models.Model): address = models.ForeignKey(ProfileAddress, related_name='component_links', aux_field='pkey') class Meta: - db_table = u'profile_addresses_components' + db_table = 'profile_addresses_components' - def __unicode__(self): - return u"%s (%s) for %s" % ( + def __str__(self): + return "%s (%s) for %s" % ( self.component.long_name, self.component.types, self.address, @@ -1388,7 +1452,7 @@ class ProfileBinetEnum(models.Model): text = models.CharField(max_length=150) url = models.CharField(max_length=765) class Meta: - db_table = u'profile_binet_enum' + db_table = 'profile_binet_enum' class ProfileBinet(models.Model): @@ -1396,7 +1460,7 @@ class ProfileBinet(models.Model): binet = models.ForeignKey(ProfileBinetEnum) pkey = models.CompositeField(profile, binet, primary_key=True) class Meta: - db_table = u'profile_binets' + db_table = 'profile_binets' class ProfileHobby(models.Model): @@ -1407,7 +1471,7 @@ class ProfileHobby(models.Model): text = models.CharField(max_length=765) pub = models.CharField(max_length=21) class Meta: - db_table = u'profile_hobby' + db_table = 'profile_hobby' class ProfileNetworkingEnum(models.Model): @@ -1418,7 +1482,7 @@ class ProfileNetworkingEnum(models.Model): network_type = models.CharField(max_length=18) link = models.CharField(max_length=765) class Meta: - db_table = u'profile_networking_enum' + db_table = 'profile_networking_enum' class ProfileNetworking(models.Model): @@ -1429,36 +1493,39 @@ class ProfileNetworking(models.Model): address = models.CharField(max_length=765) pub = models.CharField(max_length=21) class Meta: - db_table = u'profile_networking' + db_table = 'profile_networking' # Profile::corps # -------------- +@python_2_unicode_compatible class ProfileCorpsEnum(models.Model): #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 = u'profile_corps_enum' + db_table = 'profile_corps_enum' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible class ProfileCorpsRankEnum(models.Model): #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 = u'profile_corps_rank_enum' + db_table = 'profile_corps_rank_enum' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible class ProfileCorps(models.Model): profile = models.OneToOneField(Profile, primary_key=True, db_column='pid') original = models.ForeignKey(ProfileCorpsEnum, db_column='original_corpsid', related_name='original_members') @@ -1467,16 +1534,17 @@ class ProfileCorps(models.Model): # Ignored: corps is public information anyway. corps_pub = models.CharField(max_length=21) class Meta: - db_table = u'profile_corps' + db_table = 'profile_corps' - def __unicode__(self): - return u"%s: %s" % (self.profile.hrpid, self.current.name) + def __str__(self): + return "%s: %s" % (self.profile.hrpid, self.current.name) # Profile::edu # ------------ +@python_2_unicode_compatible class ProfileEducationEnum(models.Model): #id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255, unique=True, blank=True) @@ -1484,9 +1552,9 @@ class ProfileEducationEnum(models.Model): url = models.CharField(max_length=765, blank=True) country = models.ForeignKey(GeolocCountry, null=True, db_column='country', blank=True) class Meta: - db_table = u'profile_education_enum' + db_table = 'profile_education_enum' - def __unicode__(self): + def __str__(self): return self.name @property @@ -1494,28 +1562,31 @@ class ProfileEducationEnum(models.Model): return self.abbreviation or self.name +@python_2_unicode_compatible class ProfileEducationDegreeEnum(models.Model): #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 = u'profile_education_degree_enum' + db_table = 'profile_education_degree_enum' - def __unicode__(self): + def __str__(self): return self.degree +@python_2_unicode_compatible class ProfileEducationFieldEnum(models.Model): #id = models.IntegerField(primary_key=True) field = models.CharField(max_length=255, unique=True, blank=True) class Meta: - db_table = u'profile_education_field_enum' + db_table = 'profile_education_field_enum' - def __unicode__(self): + def __str__(self): return self.field +@python_2_unicode_compatible class ProfileEducation(models.Model): id = models.IntegerField() profile = models.ForeignKey(Profile, db_column='pid', related_name='educations') @@ -1530,27 +1601,29 @@ class ProfileEducation(models.Model): program = models.CharField(max_length=765, blank=True) flags = models.CharField(max_length=81) class Meta: - db_table = u'profile_education' + db_table = 'profile_education' - def __unicode__(self): - return u"%s: %s" % (self.profile.hrpid, self.edu.name) + def __str__(self): + return "%s: %s" % (self.profile.hrpid, self.edu.name) +@python_2_unicode_compatible 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 = u'profile_education_degree' + db_table = 'profile_education_degree' - def __unicode__(self): - return u"%s - %s" % (self.edu, self.degree) + def __str__(self): + return "%s - %s" % (self.edu, self.degree) # Profile::jobs # ------------- +@python_2_unicode_compatible class ProfileJobEnum(models.Model): #id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255, unique=True) @@ -1562,9 +1635,9 @@ class ProfileJobEnum(models.Model): 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 = u'profile_job_enum' + db_table = 'profile_job_enum' - def __unicode__(self): + def __str__(self): return self.name @property @@ -1579,6 +1652,7 @@ class ProfileJobEnum(models.Model): return self._address +@python_2_unicode_compatible class ProfileJob(models.Model): id = models.IntegerField() profile = models.ForeignKey(Profile, db_column='pid', related_name='jobs') @@ -1592,7 +1666,7 @@ class ProfileJob(models.Model): email_pub = models.CharField(max_length=21) entry_year = models.CharField(max_length=12, blank=True) class Meta: - db_table = u'profile_job' + db_table = 'profile_job' @property def ax_visible(self): @@ -1602,25 +1676,27 @@ class ProfileJob(models.Model): def ax_visible_email(self): return is_ax_visible(self.email_pub) - def __unicode__(self): - return u"%s at %s" % (self.profile.hrpid, self.company.name if self.company else '') + def __str__(self): + return "%s at %s" % (self.profile.hrpid, self.company.name if self.company else '') # Profile::job::terms # ------------------- +@python_2_unicode_compatible 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 = u'profile_job_term_enum' + db_table = 'profile_job_term_enum' - def __unicode__(self): + def __str__(self): return self.name +@python_2_unicode_compatible class ProfileJobTermRelation(models.Model): jtid_1 = models.ForeignKey(ProfileJobTermEnum, db_column='jtid_1', related_name='relations_from') jtid_2 = models.ForeignKey(ProfileJobTermEnum, db_column='jtid_2', related_name='relations_to') @@ -1628,23 +1704,25 @@ class ProfileJobTermRelation(models.Model): computed = models.CharField(max_length=24) pkey = models.CompositeField(jtid_1, jtid_2, computed, primary_key=True) class Meta: - db_table = u'profile_job_term_relation' + db_table = 'profile_job_term_relation' - def __unicode__(self): - return u"%s <-> %s" % (self.jtid_1.name, self.jtid_2.name) + def __str__(self): + return "%s <-> %s" % (self.jtid_1.name, self.jtid_2.name) +@python_2_unicode_compatible 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 = u'profile_job_term_search' + db_table = 'profile_job_term_search' - def __unicode__(self): - return u"%s => %s" % (self.search, self.job_term.name) + def __str__(self): + return "%s => %s" % (self.search, self.job_term.name) +@python_2_unicode_compatible class ProfileJobTerm(models.Model): profile = models.ForeignKey(Profile, db_column='pid') company = models.ForeignKey(ProfileJobEnum, db_column='jid') @@ -1653,27 +1731,29 @@ class ProfileJobTerm(models.Model): computed = models.CharField(max_length=24) pkey = models.CompositeField(profile, company, job_term, primary_key=True) class Meta: - db_table = u'profile_job_term' + db_table = 'profile_job_term' - def __unicode__(self): - return u"%s at %s: %s" % (self.profile.hrpid, self.company.name, self.job_term.name) + def __str__(self): + return "%s at %s: %s" % (self.profile.hrpid, self.company.name, self.job_term.name) +@python_2_unicode_compatible class ProfileJobEntrepriseTerm(models.Model): job = models.ForeignKey(ProfileJobEnum, db_column='eid') job_term = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') pkey = models.CompositeField(job, job_term, primary_key=True) class Meta: - db_table = u'profile_job_entreprise_term' + db_table = 'profile_job_entreprise_term' - def __unicode__(self): - return u"%s: %s" % (self.job.name, self.job_term.name) + def __str__(self): + return "%s: %s" % (self.job.name, self.job_term.name) # Profile::skills # --------------- +@python_2_unicode_compatible class ProfileLangSkillEnum(models.Model): iso_639_2b = models.CharField(max_length=9, primary_key=True) language = models.CharField(max_length=765) @@ -1681,24 +1761,26 @@ class ProfileLangSkillEnum(models.Model): iso_639_2t = models.CharField(max_length=9) iso_639_1 = models.CharField(max_length=6, blank=True) class Meta: - db_table = u'profile_langskill_enum' + db_table = 'profile_langskill_enum' - def __unicode__(self): + def __str__(self): return self.iso_639_2b +@python_2_unicode_compatible class ProfileLangSkill(models.Model): profile = models.ForeignKey(Profile, db_column='pid') lang = models.ForeignKey(ProfileLangSkillEnum, db_column='lid') pkey = models.CompositeField(profile, lang, primary_key=True) level = models.IntegerField(null=True, blank=True) class Meta: - db_table = u'profile_langskills' + db_table = 'profile_langskills' - def __unicode__(self): - return u"%s: %s" % (self.profile.hrpid, self.lang.iso_639_2b) + def __str__(self): + return "%s: %s" % (self.profile.hrpid, self.lang.iso_639_2b) +@python_2_unicode_compatible class ProfileSkillEnum(models.Model): id = models.CharField(max_length=9, primary_key=True) text_fr = models.CharField(max_length=330) @@ -1706,22 +1788,23 @@ class ProfileSkillEnum(models.Model): flags = models.CharField(max_length=15) axfreetext = models.TextField() class Meta: - db_table = u'profile_skill_enum' + db_table = 'profile_skill_enum' - def __unicode__(self): + def __str__(self): return self.text_en +@python_2_unicode_compatible class ProfileSkill(models.Model): profile = models.ForeignKey(Profile, db_column='pid') skill = models.ForeignKey(ProfileSkillEnum, db_column='cid') pkey = models.CompositeField(profile, skill, primary_key=True) level = models.CharField(max_length=54) class Meta: - db_table = u'profile_skills' + db_table = 'profile_skills' - def __unicode__(self): - return u"%s: %s" % (self.profile.hrpid, self.skill.text_en) + def __str__(self): + return "%s: %s" % (self.profile.hrpid, self.skill.text_en) # Profile::medals @@ -1735,7 +1818,7 @@ class ProfileMedalEnum(models.Model): img = models.CharField(max_length=765, blank=True) flags = models.CharField(max_length=63) class Meta: - db_table = u'profile_medal_enum' + db_table = 'profile_medal_enum' class ProfileMedalGradeEnum(models.Model): @@ -1745,7 +1828,7 @@ class ProfileMedalGradeEnum(models.Model): text = models.CharField(max_length=765, blank=True) pos = models.IntegerField() class Meta: - db_table = u'profile_medal_grade_enum' + db_table = 'profile_medal_grade_enum' class ProfileMedal(models.Model): @@ -1756,7 +1839,7 @@ class ProfileMedal(models.Model): pkey = models.CompositeField(profile, medal, gid, primary_key=True) level = models.CharField(max_length=18) class Meta: - db_table = u'profile_medals' + db_table = 'profile_medals' # Profile::mentor @@ -1767,7 +1850,7 @@ class ProfileMentor(models.Model): profile = models.OneToOneField(Profile, primary_key=True, db_column='pid') expertise = models.TextField() class Meta: - db_table = u'profile_mentor' + db_table = 'profile_mentor' class ProfileMentorCountry(models.Model): @@ -1775,7 +1858,7 @@ class ProfileMentorCountry(models.Model): country = models.ForeignKey(GeolocCountry, db_column='country') pkey = models.CompositeField(profile, country, primary_key=True) class Meta: - db_table = u'profile_mentor_country' + db_table = 'profile_mentor_country' class ProfileMentorTerm(models.Model): @@ -1783,7 +1866,7 @@ class ProfileMentorTerm(models.Model): job_term = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') pkey = models.CompositeField(profile, job_term, primary_key=True) class Meta: - db_table = u'profile_mentor_term' + db_table = 'profile_mentor_term' # Profile::partner @@ -1800,7 +1883,7 @@ class ProfilePartnersharingEnum(models.Model): has_directory = models.IntegerField() has_bulkmail = models.IntegerField() class Meta: - db_table = u'profile_partnersharing_enum' + db_table = 'profile_partnersharing_enum' class ProfilePartnersharingSetting(models.Model): @@ -1812,7 +1895,7 @@ class ProfilePartnersharingSetting(models.Model): allow_email = models.CharField(max_length=18, blank=True) last_connection = models.DateTimeField(null=True, blank=True) class Meta: - db_table = u'profile_partnersharing_settings' + db_table = 'profile_partnersharing_settings' class ProfilePhotoToken(models.Model): @@ -1820,7 +1903,7 @@ class ProfilePhotoToken(models.Model): token = models.CharField(max_length=765) expires = models.DateTimeField() class Meta: - db_table = u'profile_photo_tokens' + db_table = 'profile_photo_tokens' # Profile::misc @@ -1835,7 +1918,7 @@ class ProfileMergeIssue(models.Model): name = models.CharField(max_length=765, blank=True) name_type = models.IntegerField(null=True, blank=True) class Meta: - db_table = u'profile_merge_issues' + db_table = 'profile_merge_issues' class ProfileModification(models.Model): @@ -1848,7 +1931,7 @@ class ProfileModification(models.Model): type = models.CharField(max_length=33) timestamp = models.DateTimeField() class Meta: - db_table = u'profile_modifications' + db_table = 'profile_modifications' class ProfileVisibilityEnum(models.Model): @@ -1856,7 +1939,7 @@ class ProfileVisibilityEnum(models.Model): best_display_level = models.CharField(max_length=21, blank=True) display_levels = models.CharField(max_length=72, blank=True) class Meta: - db_table = u'profile_visibility_enum' + db_table = 'profile_visibility_enum' @@ -1864,7 +1947,7 @@ class ProfileDeltaten(models.Model): profile = models.OneToOneField(Profile, primary_key=True, db_column='pid') message = models.TextField() class Meta: - db_table = u'profile_deltaten' + db_table = 'profile_deltaten' # Reminders @@ -1879,7 +1962,7 @@ class ReminderType(models.Model): remind_delay_no = models.IntegerField() remind_delay_dismiss = models.IntegerField() class Meta: - db_table = u'reminder_type' + db_table = 'reminder_type' class Reminder(models.Model): @@ -1890,7 +1973,7 @@ class Reminder(models.Model): remind_last = models.DateTimeField() remind_next = models.DateTimeField(null=True, blank=True) class Meta: - db_table = u'reminder' + db_table = 'reminder' class ReminderTip(models.Model): @@ -1903,7 +1986,7 @@ class ReminderTip(models.Model): promo_max = models.IntegerField() state = models.CharField(max_length=18) class Meta: - db_table = u'reminder_tips' + db_table = 'reminder_tips' # Surveys @@ -1920,7 +2003,7 @@ class Survey(models.Model): mode = models.IntegerField() promos = models.CharField(max_length=765) class Meta: - db_table = u'surveys' + db_table = 'surveys' class SurveyVote(models.Model): @@ -1928,7 +2011,7 @@ class SurveyVote(models.Model): survey = models.ForeignKey(Survey) account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) class Meta: - db_table = u'survey_votes' + db_table = 'survey_votes' class SurveyAnswer(models.Model): @@ -1937,7 +2020,7 @@ class SurveyAnswer(models.Model): question_id = models.IntegerField() answer = models.TextField() class Meta: - db_table = u'survey_answers' + db_table = 'survey_answers' # GApps @@ -1961,7 +2044,7 @@ class GappsAccount(models.Model): r_last_login = models.DateField(null=True, blank=True) r_last_webmail = models.DateField(null=True, blank=True) class Meta: - db_table = u'gapps_accounts' + db_table = 'gapps_accounts' class GappsNickname(models.Model): @@ -1969,7 +2052,7 @@ class GappsNickname(models.Model): g_account_name = models.CharField(max_length=768) g_nickname = models.CharField(max_length=255, primary_key=True) class Meta: - db_table = u'gapps_nicknames' + db_table = 'gapps_nicknames' class GappsQueue(models.Model): @@ -1989,7 +2072,7 @@ class GappsQueue(models.Model): r_softfail_count = models.IntegerField() r_result = models.CharField(max_length=768, blank=True) class Meta: - db_table = u'gapps_queue' + db_table = 'gapps_queue' class GappsReporting(models.Model): @@ -2005,7 +2088,7 @@ class GappsReporting(models.Model): usage_in_bytes = models.BigIntegerField(null=True, blank=True) quota_in_mb = models.IntegerField(null=True, blank=True) class Meta: - db_table = u'gapps_reporting' + db_table = 'gapps_reporting' @@ -2019,7 +2102,7 @@ class Watch(models.Model): actions = models.CharField(max_length=105) last = models.DateTimeField() class Meta: - db_table = u'watch' + db_table = 'watch' class WatchGroup(models.Model): @@ -2027,7 +2110,7 @@ class WatchGroup(models.Model): group = models.ForeignKey(Group, db_column='groupid') pkey = models.CompositeField(account, group, primary_key=True) class Meta: - db_table = u'watch_group' + db_table = 'watch_group' class WatchNonins(models.Model): @@ -2035,7 +2118,7 @@ class WatchNonins(models.Model): watched = models.ForeignKey(Account, db_column='ni', related_name='watched_by') pkey = models.CompositeField(account, watched, primary_key=True) class Meta: - db_table = u'watch_nonins' + db_table = 'watch_nonins' class WatchProfile(models.Model): @@ -2044,7 +2127,7 @@ class WatchProfile(models.Model): field = models.CharField(max_length=36) pkey = models.CompositeField(profile, field, primary_key=True) class Meta: - db_table = u'watch_profile' + db_table = 'watch_profile' class WatchPromo(models.Model): @@ -2052,7 +2135,7 @@ class WatchPromo(models.Model): promo = models.IntegerField() pkey = models.CompositeField(account, promo, primary_key=True) class Meta: - db_table = u'watch_promo' + db_table = 'watch_promo' # Postfix @@ -2064,14 +2147,14 @@ class MxWatch(models.Model): state = models.CharField(max_length=21, blank=True) text = models.TextField() class Meta: - db_table = u'mx_watch' + db_table = 'mx_watch' class PostfixBlacklist(models.Model): email = models.CharField(max_length=255, primary_key=True) reject_text = models.CharField(max_length=192) class Meta: - db_table = u'postfix_blacklist' + db_table = 'postfix_blacklist' class PostfixMailseen(models.Model): @@ -2081,13 +2164,13 @@ class PostfixMailseen(models.Model): create_time = models.DateTimeField() release = models.CharField(max_length=18) class Meta: - db_table = u'postfix_mailseen' + db_table = 'postfix_mailseen' class PostfixWhitelist(models.Model): email = models.CharField(max_length=255, primary_key=True) class Meta: - db_table = u'postfix_whitelist' + db_table = 'postfix_whitelist' # Register @@ -2109,7 +2192,7 @@ class RegisterMarketing(models.Model): message_data = models.CharField(max_length=192, blank=True) personal_notes = models.TextField(blank=True) class Meta: - db_table = u'register_marketing' + db_table = 'register_marketing' class RegisterMstat(models.Model): @@ -2117,7 +2200,7 @@ class RegisterMstat(models.Model): sender = models.ForeignKey(Account, null=True, db_column='sender', blank=True, related_name='sent_marketings_stats') success = models.DateField() class Meta: - db_table = u'register_mstats' + db_table = 'register_mstats' class RegisterPending(models.Model): @@ -2133,7 +2216,7 @@ class RegisterPending(models.Model): hash = models.CharField(max_length=36) services = models.CharField(max_length=78) class Meta: - db_table = u'register_pending' + db_table = 'register_pending' class RegisterPendingXnet(models.Model): @@ -2146,7 +2229,7 @@ class RegisterPendingXnet(models.Model): sender_name = models.CharField(max_length=765) group_name = models.CharField(max_length=765) class Meta: - db_table = u'register_pending_xnet' + db_table = 'register_pending_xnet' class RegisterSubs(models.Model): @@ -2156,7 +2239,7 @@ class RegisterSubs(models.Model): domain = models.CharField(max_length=192) pkey = models.CompositeField(account, type, sub, domain, primary_key=True) class Meta: - db_table = u'register_subs' + db_table = 'register_subs' # Search @@ -2170,7 +2253,7 @@ class SearchAutocomplete(models.Model): result = models.TextField() generated = models.DateTimeField() class Meta: - db_table = u'search_autocomplete' + db_table = 'search_autocomplete' class SearchName(models.Model): @@ -2182,7 +2265,7 @@ class SearchName(models.Model): flags = models.CharField(max_length=18) general_type = models.CharField(max_length=27) class Meta: - db_table = u'search_name' + db_table = 'search_name' # Requests @@ -2197,7 +2280,7 @@ class Request(models.Model): profile = models.ForeignKey(Profile, null=True, db_column='pid', blank=True) pkey = models.CompositeField(account, stamp, type, primary_key=True) class Meta: - db_table = u'requests' + db_table = 'requests' class RequestAnswer(models.Model): @@ -2206,14 +2289,14 @@ class RequestAnswer(models.Model): title = models.CharField(max_length=150) answer = models.TextField() class Meta: - db_table = u'requests_answers' + db_table = 'requests_answers' class RequestHidden(models.Model): account = models.ForeignKey(Account, primary_key=True, db_column='uid') hidden_requests = models.TextField() class Meta: - db_table = u'requests_hidden' + db_table = 'requests_hidden' # Misc @@ -2235,14 +2318,14 @@ class AXLetter(models.Model): date = models.DateField() bits = models.CharField(max_length=48) class Meta: - db_table = u'axletter' + db_table = 'axletter' class Carva(models.Model): account = models.ForeignKey(Account, primary_key=True, db_column='uid') url = models.CharField(max_length=765) class Meta: - db_table = u'carvas' + db_table = 'carvas' class Contact(models.Model): @@ -2250,7 +2333,7 @@ class Contact(models.Model): contact = models.ForeignKey(Profile, db_column='contact') pkey = models.CompositeField(account, contact, primary_key=True) class Meta: - db_table = u'contacts' + db_table = 'contacts' class Downtime(models.Model): @@ -2260,7 +2343,7 @@ class Downtime(models.Model): description = models.TextField() services = models.CharField(max_length=54) class Meta: - db_table = u'downtimes' + db_table = 'downtimes' class EmailListModerate(models.Model): @@ -2274,14 +2357,14 @@ class EmailListModerate(models.Model): message = models.TextField(blank=True) handler = models.IntegerField(null=True, blank=True) class Meta: - db_table = u'email_list_moderate' + db_table = 'email_list_moderate' class EmailSendSave(models.Model): account = models.OneToOneField(Account, primary_key=True, db_column='uid') data = models.TextField() class Meta: - db_table = u'email_send_save' + db_table = 'email_send_save' class EmailWatch(models.Model): @@ -2292,7 +2375,7 @@ class EmailWatch(models.Model): account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) description = models.TextField() class Meta: - db_table = u'email_watch' + db_table = 'email_watch' class GeolocLanguage(models.Model): @@ -2302,7 +2385,7 @@ class GeolocLanguage(models.Model): country = models.CharField(max_length=765, blank=True) countryplain = models.CharField(max_length=765, db_column='countryPlain', blank=True) # Field name made lowercase. class Meta: - db_table = u'geoloc_languages' + db_table = 'geoloc_languages' class HomonymList(models.Model): @@ -2310,12 +2393,11 @@ class HomonymList(models.Model): account = models.ForeignKey(Account, db_column='uid') pkey = models.CompositeField(hrmid, account, primary_key=True) class Meta: - db_table = u'homonyms_list' + db_table = 'homonyms_list' class UrlShortener(models.Model): alias = models.CharField(max_length=255, primary_key=True) url = models.TextField() class Meta: - db_table = u'url_shortener' - + db_table = 'url_shortener' -- 2.1.4