From 46709b63a0701620a72007284bef4c873d95c887 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Wed, 23 Sep 2015 14:36:45 +0200 Subject: [PATCH] Copy the full model and start working only on the email tables --- database/platal/full_models.py | 2520 ++++++++++++++++++++++++++++++ database/platal/models-from-inspectdb.py | 1902 ++++++++++++++++++++++ database/platal/models.py | 68 +- 3 files changed, 4456 insertions(+), 34 deletions(-) create mode 100644 database/platal/full_models.py create mode 100644 database/platal/models-from-inspectdb.py diff --git a/database/platal/full_models.py b/database/platal/full_models.py new file mode 100644 index 0000000..2339bc1 --- /dev/null +++ b/database/platal/full_models.py @@ -0,0 +1,2520 @@ +# -*- coding: utf-8 -*- +#*************************************************************************** +#* Copyright (C) 2015 Polytechnique.org * +#* http://opensource.polytechnique.org/ * +#* * +#* This program is free software; you can redistribute it and/or modify * +#* it under the terms of the GNU General Public License as published by * +#* the Free Software Foundation; either version 2 of the License, or * +#* (at your option) any later version. * +#* * +#* This program is distributed in the hope that it will be useful, * +#* but WITHOUT ANY WARRANTY; without even the implied warranty of * +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +#* GNU General Public License for more details. * +#* * +#* You should have received a copy of the GNU General Public License * +#* along with this program; if not, write to the Free Software * +#* Foundation, Inc., * +#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * +#***************************************************************************/ +"""Django models which fit the latest version of Plat/al database + +Latest version synced: Plat/al 1.1.15 +https://github.com/Polytechnique-org/platal/tree/xorg/maint/upgrade + +cf. https://docs.djangoproject.com/en/dev/howto/legacy-databases/ + +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): + return field in ('public', 'ax') + + +# Misc for Account/Profile +# ======================== + + +@python_2_unicode_compatible +class Skin(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=96) + date = models.DateField() + comment = models.CharField(max_length=765) + auteur = models.CharField(max_length=90) + skin_tpl = models.CharField(max_length=96) + ext = models.CharField(max_length=9) + + class Meta: + db_table = 'skins' + + 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 = 'email_virtual_domains' + + 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 = 'profile_section_enum' + + 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) + iso_3166_1_num = models.IntegerField(unique=True) + worldregion = models.CharField(max_length=6, db_column='worldRegion', blank=True) # Field name made lowercase. + country = models.CharField(max_length=765, blank=True) + countryen = models.CharField(max_length=765, db_column='countryEn', blank=True) # Field name made lowercase. + capital = models.CharField(max_length=765) + nationality = models.CharField(max_length=765, blank=True) + nationalityen = models.CharField(max_length=765, db_column='nationalityEn', blank=True) # Field name made lowercase. + phoneprefix = models.IntegerField(null=True, db_column='phonePrefix', blank=True) # Field name made lowercase. + phoneformat = models.CharField(max_length=765, db_column='phoneFormat') # Field name made lowercase. + licenseplate = models.CharField(max_length=12, db_column='licensePlate', blank=True) # Field name made lowercase. + 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 = 'geoloc_countries' + + def __str__(self): + return self.iso_3166_1_a2 + + +# Account/Profile +# =============== + + +@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 = 'account_types' + + 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) + type = models.ForeignKey(AccountType, null=True, db_column='type', blank=True) + user_perms = models.CharField(max_length=288, blank=True) + is_admin = models.BooleanField() + state = models.CharField(max_length=24) + password = models.CharField(max_length=120, blank=True) + token = models.CharField(max_length=96, blank=True) + weak_password = models.CharField(max_length=768, blank=True) + registration_date = models.DateTimeField() + flags = models.CharField(max_length=15) + comment = models.CharField(max_length=765, blank=True) + email = models.CharField(max_length=765, blank=True) + firstname = models.CharField(max_length=765, blank=True) + lastname = models.CharField(max_length=765, blank=True) + full_name = models.CharField(max_length=765, blank=True) + directory_name = models.CharField(max_length=765, blank=True) + sort_name = models.CharField(max_length=765, blank=True) + display_name = models.CharField(max_length=765, blank=True) + sex = models.CharField(max_length=18) + email_format = models.CharField(max_length=12) + skin = models.ForeignKey(Skin, null=True, db_column='skin', blank=True) + last_version = models.CharField(max_length=48) + best_domain = models.ForeignKey(EmailVirtualDomain, null=True, db_column='best_domain', blank=True) + from_email = models.CharField(max_length=765) + from_format = models.CharField(max_length=12) + + class Meta: + db_table = 'accounts' + + 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 + self.kind = kind + self.lastname = lastname + self.firstname = alias_of.firstname if firstname is None else firstname + + ALT_MARITAL = 'marital' + ALT_PSEUDO = 'pseudo' + ALT_ORDINARY = 'ordinary' + + @property + def is_pseudo(self): + return self.kind == self.ALT_PSEUDO + + def get_kind_display(self): + if self.kind == self.ALT_MARITAL: + if self.female: + return "Mme" + else: + return "M." + elif self.kind == self.ALT_PSEUDO: + return "Pseudonyme" + else: + return "" + + def __getattr__(self, attr): + return getattr(self.alias_of, attr) + + def __repr__(self): + return '' % (self.kind, self.alias_of) + + +@python_2_unicode_compatible +class Profile(models.Model): + + alias_of = None + + def __init__(self, *args, **kwargs): + super(Profile, self).__init__(*args, **kwargs) + self._aliases = None + + pid = models.AutoField(primary_key=True) + hrpid = models.CharField(max_length=255, unique=True) + xorg_id = models.IntegerField() + ax_id = models.CharField(max_length=24, blank=True) + birthdate = models.DateField(null=True, blank=True) + birthdate_ref = models.DateField(null=True, blank=True) + next_birthday = models.DateField(null=True, blank=True) + deathdate = models.DateField(null=True, blank=True) + deathdate_rec = models.DateField(null=True, blank=True) + sex = models.CharField(max_length=18) + section = models.ForeignKey(ProfileSectionEnum, null=True, db_column='section', blank=True) + cv = models.TextField(blank=True) + freetext = models.TextField(blank=True) + freetext_pub = models.CharField(max_length=21) + medals_pub = models.CharField(max_length=21) + alias_pub = models.CharField(max_length=21) + nationality1 = models.ForeignKey(GeolocCountry, null=True, db_column='nationality1', blank=True, related_name='natives') + nationality2 = models.ForeignKey(GeolocCountry, null=True, db_column='nationality2', blank=True, related_name='second_natives') + nationality3 = models.ForeignKey(GeolocCountry, null=True, db_column='nationality3', blank=True, related_name='third_natives') + email_directory = models.CharField(max_length=765, blank=True) + last_change = models.DateField() + title = models.CharField(max_length=12) + + class Meta: + db_table = 'profiles' + + def __str__(self): + return self.hrpid + + @property + def is_alive(self): + return self.deathdate is None + + @property + def account(self): + return self.accounts.filter(perms='owner').get().account + + @property + def firstname(self): + return self.public_name.firstname_ordinary or self.public_name.firstname_main or self.public_name.firstname_initial + + @property + def lastname(self): + return self.public_name.lastname_main or self.public_name.lastname_initial + + @property + def lastname_display(self): + return self.public_name.lastname_ordinary or self.public_name.lastname_marital or self.public_name.lastname_main or self.public_name.lastname_initial + + @property + def lastname_marital(self): + return self.public_name.lastname_marital + + @property + def lastname_ordinary(self): + return self.public_name.lastname_ordinary + + @property + def pseudonym(self): + return self.public_name.pseudonym + + @property + def promo(self): + return self.profiledisplay.promo + + @property + def female(self): + return self.sex == 'female' + + @property + def nationality(self): + return self.nationality1 or self.nationality2 or self.nationality3 + + @property + def country_code(self): + nat = self.nationality + if nat is None: + return 'FR' + return nat.iso_3166_1_a2 + + @property + def country_name(self): + nat = self.nationality + if nat is None: + return "France" + return nat.country + + @property + def current_corps(self): + try: + return self.profilecorps.current + except ProfileCorps.DoesNotExist: + return None + + def get_aliases(self, include_deviations=True): + if self._aliases is None: + self._aliases = [] + + alt_names = set([self.lastname]) + if self.lastname_marital and self.lastname_marital not in alt_names: + alt_names.add(self.lastname_marital) + self._aliases.append( + ProfileAlias(self, ProfileAlias.ALT_MARITAL, self.lastname_marital)) + + if self.lastname_ordinary and self.lastname_ordinary not in alt_names: + # Some people filled 'ordinary' instead of 'marital' + alt_names.add(self.lastname_ordinary) + self._aliases.append( + ProfileAlias(self, ProfileAlias.ALT_ORDINARY, self.lastname_ordinary)) + + if self.pseudonym and self.pseudonym not in alt_names: + alt_names.add(self.pseudonym) + self._aliases.append( + ProfileAlias(self, ProfileAlias.ALT_PSEUDO, self.pseudonym, firstname='')) + + if include_deviations: + return self._aliases + else: + return [a for a in self._aliases + if not a.lastname.startswith(self.lastname) + and not self.lastname.startswith(a.lastname) + ] + + @property + def mobile_line(self): + if not hasattr(self, '_mobiles'): + mobiles = [phone + for phone in self.phones.all() + if phone.link_type == phone.LINK_USER and phone.tel_type == phone.KIND_MOBILE + ] + self._mobiles = sorted(mobiles, key=lambda p: p.tel_id) + if self._mobiles: + return self._mobiles[0] + return None + + def sorted_addresses(self, for_ax=False): + personal_addresses = [addr + for addr in self.addresses.all() + if addr.is_home and (addr.ax_visible or not for_ax) + ] + + address_phones = collections.defaultdict(lambda: collections.defaultdict(list)) + + for phone in self.phones.all(): + if phone.is_address and (phone.ax_visible or not for_ax): + address_phones[phone.link_id][phone.tel_type].append(phone) + + for address in personal_addresses: + addr_phones = {} + for kind, phones in address_phones[address.subid].items(): + if phones: + addr_phones[kind] = sorted(phones, key=lambda p: p.tel_id)[0] + else: + addr_phones[kind] = None + address.phones = addr_phones + + current = [addr for addr in personal_addresses if addr.current] + secondary = [addr for addr in personal_addresses if addr.secondary and not addr.current] + if not current: + current, secondary = secondary, [] + + return [(a, True) for a in current] + [(a, False) for a in secondary] + + def sorted_educations(self): + edus = [edu for edu in self.educations.all() if edu.school and edu.school.abbreviation != 'X'] + return sorted(edus, key=lambda edu: edu.entry_year) + + def sorted_jobs(self): + jobs = sorted(self.jobs.all(), key=lambda j: (j.id, j.entry_year)) + job_addresses = {} + for addr in self.addresses.all(): + if addr.is_job: + job_addresses[addr.job_id] = addr + + job_phones = collections.defaultdict(lambda: collections.defaultdict(list)) + for phone in self.phones.all(): + if phone.is_job: + job_phones[phone.link_id][phone.tel_type].append(phone) + + for job in jobs: + job.address = job_addresses.get(job.id) + j_phones = {} + for kind, phones in job_phones[job.id].items(): + if phones: + j_phones[kind] = sorted(phones, key=lambda p: p.tel_id)[0] + else: + j_phones[kind] = None + job.phones = j_phones + + 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') + perms = models.CharField(max_length=15) + + class Meta: + db_table = 'account_profiles' + unique_together = (('account', 'profile'),) + + 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 = 'account_auth_openid' + + 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 = 'account_lost_passwords' + + 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 = 'account_xnet_lost_passwords' + + 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) + creation_date = models.DateTimeField() + titre = models.CharField(max_length=765) + texte = models.TextField() + expiration = models.DateField() + promo_min = models.IntegerField() + promo_max = models.IntegerField() + flags = models.CharField(max_length=87) + noinvite = models.IntegerField() + post_id = models.IntegerField(null=True, blank=True, editable=False, + help_text="NNTP post identifier") + + class Meta: + db_table = 'announces' + + 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) + attach = models.TextField() + x = models.IntegerField() + y = models.IntegerField() + + class Meta: + db_table = 'announce_photos' + + 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') + + class Meta: + db_table = 'announce_read' + unique_together = (('evt', 'account'),) + + 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') + redirect = models.CharField(max_length=765) + type = models.CharField(max_length=21, blank=True) + expire = models.DateField() + + class Meta: + db_table = 'email_virtual' + unique_together = (('email', 'domain'),) + + 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) + rewrite = models.CharField(max_length=765) + type = models.CharField(max_length=30) + action = models.CharField(max_length=54) + broken_date = models.DateField() + broken_level = models.IntegerField() + last = models.DateField() + flags = models.CharField(max_length=24) + hash = models.CharField(max_length=96, blank=True) + allow_rewrite = models.BooleanField() + + class Meta: + db_table = 'email_redirect_account' + unique_together = (('account', 'redirect'),) + + 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') + account = models.ForeignKey(Account, db_column='uid') + 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) + + +@python_2_unicode_compatible +class EmailSourceOther(models.Model): + email = models.CharField(max_length=255) + domain = models.ForeignKey(EmailVirtualDomain, db_column='domain') + hrmid = models.CharField(max_length=255) + type = models.CharField(max_length=8, blank=True, null=True) + expire = models.DateField(blank=True, null=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) + + +@python_2_unicode_compatible +class EmailRedirectOther(models.Model): + hrmid = models.ForeignKey(EmailSourceOther, db_column='hrmid') + 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) + + +# innd-related +# ============ + + +@python_2_unicode_compatible +class InndForum(models.Model): + """ACLs for innd""" + id_innd = models.AutoField(primary_key=True) + ipmin = models.IntegerField(null=True, blank=True) + ipmax = models.IntegerField(null=True, blank=True) + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + read_perm = models.CharField(max_length=300, blank=True) + 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' + + 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) + mail = models.CharField(max_length=210) + sig = models.TextField() + flags = models.CharField(max_length=63) + tree_unread = models.CharField(max_length=24) + tree_read = models.CharField(max_length=24) + last_seen = models.DateTimeField() + + class Meta: + db_table = 'forum_profiles' + + 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 = 'forums' + + 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') + + class Meta: + db_table = 'forum_subs' + unique_together = (('forum', 'account'),) + + 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) + 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' + + 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) + url = models.CharField(max_length=384) + flags = models.CharField(max_length=51) + amount_def = models.DecimalField(max_digits=12, decimal_places=2) + amount_min = models.DecimalField(max_digits=12, decimal_places=2) + amount_max = models.DecimalField(max_digits=12, decimal_places=2) + mail = models.CharField(max_length=192) + confirmation = models.TextField() + asso = models.ForeignKey('Group', null=True, blank=True) + rib = models.ForeignKey(PaymentBankAccount) + + class Meta: + db_table = 'payments' + + 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 = 'payment_codeC' + + 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 = 'payment_codeRCB' + + 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) + 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' + + 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) + period_start = models.DateField() + period_end = models.DateField() + status = models.CharField(max_length=33) + payment_count = models.IntegerField() + sum_amounts = models.DecimalField(max_digits=11, decimal_places=2) + 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' + + 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) + account = models.ForeignKey(Account, db_column='uid') + ref = models.IntegerField() + fullref = models.CharField(max_length=45) + ts_confirmed = models.DateTimeField(null=True, blank=True) + ts_initiated = models.DateTimeField(null=True, blank=True) + amount = models.DecimalField(max_digits=11, decimal_places=2) + commission = models.DecimalField(null=True, max_digits=11, decimal_places=2, blank=True) + pkey = models.CharField(max_length=15) + comment = models.CharField(max_length=765) + status = models.CharField(max_length=27) + recon = models.ForeignKey(PaymentReconcilation, null=True, blank=True) + display = models.IntegerField() + + class Meta: + db_table = 'payment_transactions' + + 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() + payment = models.ForeignKey(Payment) + amount = models.DecimalField(max_digits=11, decimal_places=2) + 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' + + 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 = 'group_dom' + + 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') + diminutif = models.CharField(max_length=192, unique=True) + cat = models.CharField(max_length=117) + dom = models.ForeignKey(GroupDom, null=True, db_column='dom', blank=True) + descr = models.TextField() + logo = models.TextField(blank=True) + logo_mime = models.TextField(blank=True) + site = models.CharField(max_length=765) + mail = models.CharField(max_length=765) + resp = models.CharField(max_length=765) + forum = models.CharField(max_length=765) + mail_domain = models.CharField(max_length=765) + ax = models.IntegerField() + pub = models.CharField(max_length=21) + sub_url = models.CharField(max_length=765) + inscriptible = models.IntegerField() + unsub_url = models.CharField(max_length=765) + flags = models.CharField(max_length=117) + axdate = models.DateField(null=True, db_column='axDate', blank=True) # Field name made lowercase. + welcome_msg = models.TextField(blank=True) + event_order = models.CharField(max_length=8) + disable_mails = models.BooleanField() + status = models.CharField(max_length=117) + + class Meta: + db_table = 'groups' + + def __str__(self): + return self.name + + +# Group::membership +# ----------------- + + +@python_2_unicode_compatible +class GroupMember(models.Model): + asso = models.ForeignKey(Group) + account = models.ForeignKey(Account, db_column='uid') + 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) + + class Meta: + db_table = 'group_members' + unique_together = (('asso', 'uid'),) + + 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') + 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) + + +@python_2_unicode_compatible +class GroupFormerMember(models.Model): + asso = models.ForeignKey(Group) + account = models.ForeignKey(Account, db_column='uid') + 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) + + +# 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) + asso = models.ForeignKey(Group) + create_date = models.DateTimeField() + titre = models.CharField(max_length=765) + texte = models.TextField() + contacts = models.TextField() + expiration = models.DateField() + promo_min = models.IntegerField() + promo_max = models.IntegerField() + flags = models.CharField(max_length=36) + post_id = models.IntegerField(null=True, blank=True, + help_text="NNTP post ID") + + class Meta: + db_table = 'group_announces' + + 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) + attach = models.TextField() + x = models.IntegerField() + y = models.IntegerField() + + class Meta: + db_table = 'group_announces_photo' + + 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') + + class Meta: + db_table = 'group_announces_read' + unique_together = (('announce', 'account'),) + + 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) + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + intitule = models.CharField(max_length=300) + short_name = models.CharField(max_length=90) + paiement = models.ForeignKey(Payment, null=True, blank=True) + descriptif = models.TextField() + debut = models.DateTimeField() + fin = models.DateTimeField(null=True, blank=True) + show_participants = models.BooleanField() + deadline_inscription = models.DateField(null=True, blank=True) + noinvite = models.IntegerField() + accept_nonmembre = models.BooleanField() + archive = models.BooleanField() + subscription_notification = models.CharField(max_length=24) + + class Meta: + db_table = 'group_events' + + 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() + 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 = (('event', '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') + account = models.ForeignKey(Account, db_column='uid') + nb = models.IntegerField() + flags = models.CharField(max_length=14) + paid = models.FloatField() + + + class Meta: + db_table = 'group_event_participants' + unique_together = (('event', 'account', 'item_id'),) + + 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) + name = models.CharField(max_length=96) + datafields = models.CharField(max_length=765) + returnurls = models.CharField(max_length=765) + 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' + + def __str__(self): + return self.name + + +# Logging +# ======= + + +@python_2_unicode_compatible +class IpWatch(models.Model): + state = models.CharField(max_length=27) + detection = models.DateField(null=True, blank=True) + last = models.DateTimeField() + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + description = models.TextField() + ip = models.IntegerField(primary_key=True) + mask = models.IntegerField() + + class Meta: + db_table = 'ip_watch' + + 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 = 'log_actions' + + 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) + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True, related_name='sessions') + start = models.DateTimeField() + host = models.CharField(max_length=384) + sauth = models.CharField(max_length=18) + suid = models.ForeignKey(Account, null=True, db_column='suid', blank=True, related_name='su_sessions') + browser = models.CharField(max_length=765) + forward_host = models.CharField(max_length=384, blank=True) + flags = models.CharField(max_length=15) + ip = models.IntegerField() + forward_ip = models.IntegerField(null=True, blank=True) + + class Meta: + db_table = 'log_sessions' + + 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 = 'log_last_sessions' + + 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 = 'log_events' + + 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 = 'newsletters' + + 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) + date = models.DateField() + send_before = models.DateTimeField(null=True, blank=True) + state = models.CharField(max_length=21) + sufb_json = models.TextField(blank=True) + title = models.CharField(max_length=765) + head = models.TextField() + signature = models.TextField() + short_name = models.CharField(max_length=48, unique=True, blank=True) + mail_title = models.CharField(max_length=765) + unsubscribe = models.IntegerField() + reply_to = models.CharField(max_length=765) + + class Meta: + db_table = 'newsletter_issues' + + 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 = 'newsletter_cat' + + def __str__(self): + return self.title + + +@python_2_unicode_compatible +class NewsletterArt(models.Model): + issue = models.ForeignKey(NewsletterIssue, db_column='id') + aid = models.IntegerField() + 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) + + +@python_2_unicode_compatible +class NewsletterIns(models.Model): + account = models.ForeignKey(Account, db_column='uid') + nl = models.ForeignKey(Newsletter, db_column='nlid') + 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 = (('account', 'nlid'),) + + 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) + public_name = models.CharField(max_length=765) + private_name = models.CharField(max_length=765) + directory_name = models.CharField(max_length=765) + 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' + + def __str__(self): + return self.profile.hrpid + + +@python_2_unicode_compatible +class ProfilePhone(models.Model): + LINK_ADDRESS = 'address' + LINK_PRO = 'pro' + LINK_USER = 'user' + LINK_HQ = 'hq' + LINK_GROUP = 'group' + LINK_CHOICES = ( + (LINK_ADDRESS, u"Address"), + (LINK_PRO, u"Pro"), + (LINK_USER, u"User"), + (LINK_HQ, u"HQ"), + (LINK_GROUP, u"Group"), + ) + + KIND_FIXED = 'fixed' + KIND_MOBILE = 'mobile' + KIND_FAX = 'fax' + KIND_CHOICES = ( + (KIND_FIXED, u"Fixed"), + (KIND_MOBILE, u"Mobile"), + (KIND_FAX, u"Fax"), + ) + + profile = models.ForeignKey(Profile, db_column='pid', related_name='phones') + link_type = models.CharField(max_length=21, choices=LINK_CHOICES) + link_id = models.IntegerField() + tel_id = models.IntegerField() + tel_type = models.CharField(max_length=18, choices=KIND_CHOICES) + search_tel = models.CharField(max_length=75) + display_tel = models.CharField(max_length=90) + pub = models.CharField(max_length=21) + comment = models.CharField(max_length=240) + + class Meta: + db_table = 'profile_phones' + unique_together = (('profile', 'link_type', 'link_id', 'tel_id'),) + + def __str__(self): + return "%s: %s (%s)" % (self.profile.hrpid, self.display_tel, self.tel_type) + + @property + def is_address(self): + return self.link_type == self.LINK_ADDRESS + + @property + def is_job(self): + return self.link_type == self.LINK_PRO + + @property + def ax_visible(self): + 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) + attach = models.TextField() + x = models.IntegerField() + y = models.IntegerField() + pub = models.CharField(max_length=21) + last_update = models.DateTimeField() + + class Meta: + db_table = 'profile_photos' + + 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) + id = models.IntegerField() + name = models.CharField(max_length=765) + + class Meta: + db_table = 'profile_private_names' + unique_together = (('profile', 'type', 'id'),) + + 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) + lastname_main = models.CharField(max_length=765) + lastname_marital = models.CharField(max_length=765) + lastname_ordinary = models.CharField(max_length=765) + firstname_initial = models.CharField(max_length=765) + 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' + + def __str__(self): + return self.profile.hrpid + + +# Profile::addresses +# ------------------ + + +@python_2_unicode_compatible +class ProfileAddress(models.Model): + + KIND_HOME = 'home' + KIND_HQ = 'hq' + KIND_JOB = 'job' + KIND_GROUP = 'group' + + KIND_CHOICES = ( + (KIND_HOME, u"Home"), + (KIND_HQ, u"Headquarters"), + (KIND_JOB, u"Job"), + (KIND_GROUP, u"Group"), + ) + + profile = models.ForeignKey(Profile, db_column='pid', related_name='addresses') + job = models.ForeignKey('ProfileJobEnum', db_column='jobid', blank=True, null=True, + related_name='addresses') + group = models.ForeignKey('Group', db_column='groupid', blank=True, null=True) + addr_type = models.CharField(max_length=5, db_column='type', choices=KIND_CHOICES) + subid = models.IntegerField(db_column='id') + flags = models.CharField(max_length=65, blank=True, null=True) + text = models.TextField() + postaltext = models.TextField(db_column='postalText') # Field name made lowercase. + formatted_address = models.TextField() + 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=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=5, blank=True, null=True) + components = models.ManyToManyField('ProfileAddressComponentEnum', + through='ProfileAddressComponent', related_name='addresses') + + class Meta: + db_table = 'profile_addresses' + unique_together = (('profile', 'jobid', 'groupid', 'type', 'id'),) + + def __str__(self): + if self.addr_type == self.KIND_HOME: + rel = self.profile.hrpid + elif self.addr_type == self.KIND_HQ: + if self.jobid: + rel = unicode(self.job) + else: + rel = u"[BADJOB]" + elif self.addr_type == self.KIND_GROUP: + rel = unicode(self.group) + else: + rel = u"%s at %s" % (self.profile.hrpid, self.pjob.company) + return "%s address %d for %s" % ( + self.get_addr_type_display(), self.subid, rel) + + @property + def ax_visible(self): + return is_ax_visible(self.pub) + + def get_components_by_type(self): + flags = collections.defaultdict(list) + for component in self.components.all(): + for cp_type in component.types.split(','): + flags[cp_type].append(component) + return flags + + @property + def flag_list(self): + return self.flags.split(',') + + FLAG_CURRENT = 'current' + FLAG_MAIL = 'mail' + FLAG_SECONDARY = 'secondary' + + @property + def current(self): + return self.FLAG_CURRENT in self.flag_list + + @property + def mail(self): + return self.FLAG_MAIL in self.flag_list + + @property + def secondary(self): + return self.FLAG_SECONDARY in self.flag_list + + @property + def is_home(self): + return self.addr_type == self.KIND_HOME + + @property + def is_job(self): + 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 = 'profile_addresses_components_enum' + + 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') + 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') + + component = models.ForeignKey(ProfileAddressComponentEnum, related_name='component_links') + address = models.ForeignKey(ProfileAddress, related_name='component_links') + + class Meta: + db_table = 'profile_addresses_components' + unique_together = (('profile', 'jobid', 'groupid', 'type', 'id'),) + + def __str__(self): + return "%s (%s) for %s" % ( + self.component.long_name, + self.component.types, + self.address, + ) + + +# Profile::networking +# ------------------- + + +class ProfileBinetEnum(models.Model): + 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' + + +class ProfileBinet(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + binet = models.ForeignKey(ProfileBinetEnum) + + class Meta: + db_table = 'profile_binets' + unique_together = (('profile', 'binet'),) + + +class ProfileHobby(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + id = models.IntegerField() + 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 = (('profile', 'id'),) + + +class ProfileNetworkingEnum(models.Model): + nwid = models.IntegerField(primary_key=True) + name = models.CharField(max_length=90) + icon = models.CharField(max_length=150) + 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' + + +class ProfileNetworking(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + id = models.IntegerField() + nwid = models.ForeignKey(ProfileNetworkingEnum, db_column='nwid') + address = models.CharField(max_length=765) + pub = models.CharField(max_length=21) + + class Meta: + db_table = 'profile_networking' + unique_together = (('profile', 'nwid'),) + + +# 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 = 'profile_corps_enum' + + 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 = 'profile_corps_rank_enum' + + 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') + current = models.ForeignKey(ProfileCorpsEnum, db_column='current_corpsid', related_name='current_members') + 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' + + 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) + abbreviation = models.CharField(max_length=765) + url = models.CharField(max_length=765, blank=True) + country = models.ForeignKey(GeolocCountry, null=True, db_column='country', blank=True) + + class Meta: + db_table = 'profile_education_enum' + + def __str__(self): + return self.name + + @property + def short(self): + 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 = 'profile_education_degree_enum' + + 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 = 'profile_education_field_enum' + + 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') + 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) + entry_year = models.IntegerField(null=True, blank=True) + grad_year = models.IntegerField(null=True, blank=True) + 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) + + +@python_2_unicode_compatible +class ProfileEducationDegree(models.Model): + edu = models.ForeignKey(ProfileEducationEnum, db_column='eduid') + degree = models.ForeignKey(ProfileEducationDegreeEnum, db_column='degreeid') + + class Meta: + db_table = 'profile_education_degree' + unique_together = (('eduid', 'degreeid'),) + + 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) + acronym = models.CharField(max_length=765, blank=True) + url = models.CharField(max_length=765, blank=True) + email = models.CharField(max_length=765, blank=True) + holding = models.ForeignKey('self', null=True, db_column='holdingid', blank=True) + 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' + + def __str__(self): + return self.name + + @property + def address(self): + if not hasattr(self, '_address'): + + self._address = None + for address in self.addresses.all(): + if address.addr_type == address.KIND_HQ: + self._address = address + break + return self._address + + +@python_2_unicode_compatible +class ProfileJob(models.Model): + id = models.IntegerField() + profile = models.ForeignKey(Profile, db_column='pid', related_name='jobs') + company = models.ForeignKey(ProfileJobEnum, null=True, db_column='jobid', blank=True) + description = models.CharField(max_length=765) + url = models.CharField(max_length=765) + email = models.CharField(max_length=765) + 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 = (('profile', 'id'),) + + @property + def ax_visible(self): + return is_ax_visible(self.pub) + + @property + def ax_visible_email(self): + return is_ax_visible(self.email_pub) + + 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 = 'profile_job_term_enum' + + 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') + rel = models.CharField(max_length=24) + computed = models.CharField(max_length=24) + + 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) + + +@python_2_unicode_compatible +class ProfileJobTermSearch(models.Model): + search = models.CharField(max_length=150) + job_term = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') + + 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) + + +@python_2_unicode_compatible +class ProfileJobTerm(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + company = models.ForeignKey(ProfileJobEnum, db_column='jid') + job_term = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') + computed = models.CharField(max_length=24) + + class Meta: + db_table = 'profile_job_term' + unique_together = (('profile', 'jid', 'jtid'),) + + 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') + + class Meta: + db_table = 'profile_job_entreprise_term' + unique_together = (('eid', 'jtid'),) + + 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) + language_en = models.CharField(max_length=765) + iso_639_2t = models.CharField(max_length=9) + iso_639_1 = models.CharField(max_length=6, blank=True) + + class Meta: + db_table = 'profile_langskill_enum' + + 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') + level = models.IntegerField(null=True, blank=True) + + class Meta: + db_table = 'profile_langskills' + unique_together = (('profile', 'lid'),) + + 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) + text_en = models.CharField(max_length=330) + flags = models.CharField(max_length=15) + axfreetext = models.TextField() + + class Meta: + db_table = 'profile_skill_enum' + + 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') + level = models.CharField(max_length=54) + + class Meta: + db_table = 'profile_skills' + unique_together = (('profile', 'cid'),) + + def __str__(self): + return "%s: %s" % (self.profile.hrpid, self.skill.text_en) + + +# Profile::medals +# --------------- + + +class ProfileMedalEnum(models.Model): + id = models.IntegerField(primary_key=True) + type = models.CharField(max_length=30) + text = models.CharField(max_length=765, blank=True) + img = models.CharField(max_length=765, blank=True) + flags = models.CharField(max_length=63) + + class Meta: + db_table = 'profile_medal_enum' + + +class ProfileMedalGradeEnum(models.Model): + medal = models.ForeignKey(ProfileMedalEnum, db_column='mid') + gid = models.IntegerField() + text = models.CharField(max_length=765, blank=True) + pos = models.IntegerField() + + class Meta: + db_table = 'profile_medal_grade_enum' + unique_together = (('medal', 'gid'),) + + +class ProfileMedal(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + medal = models.ForeignKey(ProfileMedalEnum) + gid = models.IntegerField() + level = models.CharField(max_length=18) + + class Meta: + db_table = 'profile_medals' + unique_together = (('profile', 'medal', 'gid'),) + + +# Profile::mentor +# --------------- + + +class ProfileMentor(models.Model): + profile = models.OneToOneField(Profile, primary_key=True, db_column='pid') + expertise = models.TextField() + + class Meta: + db_table = 'profile_mentor' + + +class ProfileMentorCountry(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + country = models.ForeignKey(GeolocCountry, db_column='country') + + class Meta: + db_table = 'profile_mentor_country' + unique_together = (('profile', 'country'),) + + +class ProfileMentorTerm(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + job_term = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') + + class Meta: + db_table = 'profile_mentor_term' + unique_together = (('profile', 'jtid'),) + + +# Profile::partner +# ---------------- + + +class ProfilePartnersharingEnum(models.Model): + id = models.IntegerField(primary_key=True) + api_account = models.ForeignKey(Account, null=True, db_column='api_uid', blank=True) + shortname = models.CharField(max_length=192) + name = models.CharField(max_length=765) + url = models.CharField(max_length=765) + default_sharing_level = models.CharField(max_length=21, blank=True) + has_directory = models.IntegerField() + has_bulkmail = models.IntegerField() + + class Meta: + db_table = 'profile_partnersharing_enum' + + +class ProfilePartnersharingSetting(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + partner = models.ForeignKey(ProfilePartnersharingEnum) + exposed_uid = models.CharField(max_length=765) + sharing_level = models.CharField(max_length=21, blank=True) + allow_email = models.CharField(max_length=18, blank=True) + last_connection = models.DateTimeField(null=True, blank=True) + + class Meta: + db_table = 'profile_partnersharing_settings' + unique_together = (('profile', 'partner'),) + + +class ProfilePhotoToken(models.Model): + profile = models.ForeignKey(Profile, primary_key=True, db_column='pid') + token = models.CharField(max_length=765) + expires = models.DateTimeField() + + class Meta: + db_table = 'profile_photo_tokens' + + +# Profile::misc +# ------------- + + +class ProfileMergeIssue(models.Model): + profile = models.ForeignKey(Profile, primary_key=True, db_column='pid') + issues = models.CharField(max_length=144, blank=True) + entry_year_ax = models.IntegerField(null=True, blank=True) + deathdate_ax = models.DateField(null=True, blank=True) + name = models.CharField(max_length=765, blank=True) + name_type = models.IntegerField(null=True, blank=True) + + class Meta: + db_table = 'profile_merge_issues' + + +class ProfileModification(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + account = models.ForeignKey(Account, db_column='uid') + field = models.CharField(max_length=180) + oldtext = models.TextField(db_column='oldText') + newtext = models.TextField(db_column='newText') + type = models.CharField(max_length=33) + timestamp = models.DateTimeField() + + class Meta: + db_table = 'profile_modifications' + unique_together = (('profile', 'field'),) + + +class ProfileVisibilityEnum(models.Model): + access_level = models.CharField(max_length=21, blank=True, primary_key=True) + best_display_level = models.CharField(max_length=21, blank=True) + display_levels = models.CharField(max_length=72, blank=True) + + class Meta: + db_table = 'profile_visibility_enum' + + + +class ProfileDeltaten(models.Model): + profile = models.OneToOneField(Profile, primary_key=True, db_column='pid') + message = models.TextField() + + class Meta: + db_table = 'profile_deltaten' + + +# Reminders +# ========= + + +class ReminderType(models.Model): + type_id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=255, unique=True) + weight = models.IntegerField() + remind_delay_yes = models.IntegerField() + remind_delay_no = models.IntegerField() + remind_delay_dismiss = models.IntegerField() + + class Meta: + db_table = 'reminder_type' + + +class Reminder(models.Model): + account = models.ForeignKey(Account, db_column='uid') + type = models.ForeignKey(ReminderType) + status = models.CharField(max_length=21) + remind_last = models.DateTimeField() + remind_next = models.DateTimeField(null=True, blank=True) + + class Meta: + db_table = 'reminder' + unique_together = (('account', 'type'),) + + +class ReminderTip(models.Model): + id = models.IntegerField(primary_key=True) + title = models.CharField(max_length=192) + text = models.TextField() + priority = models.IntegerField() + expiration = models.DateField() + promo_min = models.IntegerField() + promo_max = models.IntegerField() + state = models.CharField(max_length=18) + + class Meta: + db_table = 'reminder_tips' + + +# Surveys +# ======= + + +class Survey(models.Model): + id = models.IntegerField(primary_key=True) + questions = models.TextField() + title = models.CharField(max_length=765) + description = models.TextField() + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + end = models.DateField() + mode = models.IntegerField() + promos = models.CharField(max_length=765) + + class Meta: + db_table = 'surveys' + + +class SurveyVote(models.Model): + id = models.IntegerField(primary_key=True) + survey = models.ForeignKey(Survey) + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + + class Meta: + db_table = 'survey_votes' + + +class SurveyAnswer(models.Model): + id = models.IntegerField(primary_key=True) + vote = models.ForeignKey(SurveyVote) + question_id = models.IntegerField() + answer = models.TextField() + + class Meta: + db_table = 'survey_answers' + + +# GApps +# ===== + + +class GappsAccount(models.Model): + l_userid = models.ForeignKey(Account, null=True, db_column='l_userid', blank=True) + l_sync_password = models.BooleanField(default=True) + l_activate_mail_redirection = models.BooleanField(default=True) + g_account_id = models.CharField(max_length=48, blank=True) + g_account_name = models.CharField(max_length=255, primary_key=True) + g_domain = models.CharField(max_length=120, blank=True) + g_first_name = models.CharField(max_length=120) + g_last_name = models.CharField(max_length=120) + g_status = models.CharField(max_length=39, blank=True) + g_admin = models.BooleanField() + g_suspension = models.CharField(max_length=768, blank=True) + r_disk_usage = models.BigIntegerField(null=True, blank=True) + r_creation = models.DateField(null=True, blank=True) + r_last_login = models.DateField(null=True, blank=True) + r_last_webmail = models.DateField(null=True, blank=True) + + class Meta: + db_table = 'gapps_accounts' + + +class GappsNickname(models.Model): + l_userid = models.ForeignKey(Account, null=True, db_column='l_userid', blank=True) + g_account_name = models.CharField(max_length=768) + g_nickname = models.CharField(max_length=255, primary_key=True) + + class Meta: + db_table = 'gapps_nicknames' + + +class GappsQueue(models.Model): + q_id = models.AutoField(primary_key=True) + q_owner = models.ForeignKey(Account, null=True, blank=True, related_name='owned_gapps_jobs') + q_recipient = models.ForeignKey(Account, null=True, blank=True, related_name='received_gapps_jobs') + p_entry_date = models.DateTimeField() + p_notbefore_date = models.DateTimeField() + p_start_date = models.DateTimeField(null=True, blank=True) + p_end_date = models.DateTimeField(null=True, blank=True) + p_status = models.CharField(max_length=24) + p_priority = models.CharField(max_length=27) + p_admin_request = models.BooleanField() + j_type = models.CharField(max_length=30) + j_parameters = models.TextField(blank=True) + r_softfail_date = models.DateTimeField(null=True, blank=True) + r_softfail_count = models.IntegerField() + r_result = models.CharField(max_length=768, blank=True) + + class Meta: + db_table = 'gapps_queue' + + +class GappsReporting(models.Model): + date = models.DateField(primary_key=True) + num_accounts = models.IntegerField(null=True, blank=True) + count_1_day_actives = models.IntegerField(null=True, blank=True) + count_7_day_actives = models.IntegerField(null=True, blank=True) + count_14_day_actives = models.IntegerField(null=True, blank=True) + count_30_day_actives = models.IntegerField(null=True, blank=True) + count_30_day_idle = models.IntegerField(null=True, blank=True) + count_60_day_idle = models.IntegerField(null=True, blank=True) + count_90_day_idle = models.IntegerField(null=True, blank=True) + usage_in_bytes = models.BigIntegerField(null=True, blank=True) + quota_in_mb = models.IntegerField(null=True, blank=True) + + class Meta: + db_table = 'gapps_reporting' + + + +# Watch +# ===== + + +class Watch(models.Model): + account = models.ForeignKey(Account, primary_key=True, db_column='uid') + flags = models.CharField(max_length=39) + actions = models.CharField(max_length=105) + last = models.DateTimeField() + + class Meta: + db_table = 'watch' + + +class WatchGroup(models.Model): + account = models.ForeignKey(Account, db_column='uid') + group = models.ForeignKey(Group, db_column='groupid') + + class Meta: + db_table = 'watch_group' + unique_together = (('account', 'groupid'),) + + +class WatchNonins(models.Model): + account = models.ForeignKey(Account, db_column='uid', related_name='watching') + watched = models.ForeignKey(Account, db_column='ni', related_name='watched_by') + + class Meta: + db_table = 'watch_nonins' + unique_together = (('account', 'ni'),) + + +class WatchProfile(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + ts = models.DateTimeField() + field = models.CharField(max_length=36) + + class Meta: + db_table = 'watch_profile' + unique_together = (('profile', 'field'),) + + +class WatchPromo(models.Model): + account = models.ForeignKey(Account, db_column='uid') + promo = models.IntegerField() + + class Meta: + db_table = 'watch_promo' + unique_together = (('account', 'promo'),) + + +# Postfix +# ======= + + +class MxWatch(models.Model): + host = models.CharField(max_length=192, primary_key=True) + state = models.CharField(max_length=21, blank=True) + text = models.TextField() + + class Meta: + 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 = 'postfix_blacklist' + + +class PostfixMailseen(models.Model): + crc = models.CharField(max_length=24, primary_key=True) + nb = models.IntegerField() + update_time = models.DateTimeField() + create_time = models.DateTimeField() + release = models.CharField(max_length=18) + + class Meta: + db_table = 'postfix_mailseen' + + +class PostfixWhitelist(models.Model): + email = models.CharField(max_length=255, primary_key=True) + + class Meta: + db_table = 'postfix_whitelist' + + +# Register +# ======== + + +class RegisterMarketing(models.Model): + account = models.ForeignKey(Account, db_column='uid', related_name='received_marketings') + sender = models.ForeignKey(Account, null=True, db_column='sender', blank=True, related_name='sent_marketings') + email = models.CharField(max_length=765) + + date = models.DateField() + last = models.DateField() + nb = models.IntegerField() + type = models.CharField(max_length=15, blank=True) + hash = models.CharField(max_length=96) + message = models.CharField(max_length=48) + message_data = models.CharField(max_length=192, blank=True) + personal_notes = models.TextField(blank=True) + + class Meta: + db_table = 'register_marketing' + unique_together = (('account', 'email'),) + + +class RegisterMstat(models.Model): + account = models.OneToOneField(Account, primary_key=True, db_column='uid', related_name='received_marketings_stats') + sender = models.ForeignKey(Account, null=True, db_column='sender', blank=True, related_name='sent_marketings_stats') + success = models.DateField() + + class Meta: + db_table = 'register_mstats' + + +class RegisterPending(models.Model): + account = models.OneToOneField(Account, primary_key=True, db_column='uid') + forlife = models.CharField(max_length=255, unique=True) + bestalias = models.CharField(max_length=255, unique=True) + mailorg2 = models.CharField(max_length=765, blank=True) + password = models.CharField(max_length=120) + email = models.CharField(max_length=765) + date = models.DateField() + relance = models.DateField() + naissance = models.DateField() + hash = models.CharField(max_length=36) + services = models.CharField(max_length=78) + + class Meta: + db_table = 'register_pending' + + +class RegisterPendingXnet(models.Model): + account = models.ForeignKey(Account, primary_key=True, db_column='uid', related_name='pending_xnet_register') + hruid = models.ForeignKey(Account, unique=True, db_column='hruid', related_name='pending_xnet_register_by_hruid') + email = models.CharField(max_length=765) + date = models.DateField() + last_date = models.DateField(null=True, blank=True) + hash = models.CharField(max_length=36) + sender_name = models.CharField(max_length=765) + group_name = models.CharField(max_length=765) + + class Meta: + db_table = 'register_pending_xnet' + + +class RegisterSubs(models.Model): + account = models.ForeignKey(Account, db_column='uid') + type = models.CharField(max_length=15) + sub = models.CharField(max_length=96) + domain = models.CharField(max_length=192) + + class Meta: + db_table = 'register_subs' + unique_together = (('account', 'type', 'sub', 'domain'),) + + +# Search +# ====== + + +class SearchAutocomplete(models.Model): + name = models.CharField(max_length=60) + query = models.CharField(max_length=300) + result = models.TextField() + generated = models.DateTimeField() + + class Meta: + db_table = 'search_autocomplete' + unique_together = (('name', 'query'),) + + +class SearchName(models.Model): + profile = models.ForeignKey(Profile, db_column='pid') + token = models.CharField(max_length=765) + score = models.IntegerField() + soundex = models.CharField(max_length=12) + flags = models.CharField(max_length=18) + general_type = models.CharField(max_length=27) + + class Meta: + db_table = 'search_name' + unique_together = (('profile', 'token'),) + + +# Requests +# ======== + + +class Request(models.Model): + account = models.ForeignKey(Account, db_column='uid') + type = models.CharField(max_length=48) + data = models.TextField() + stamp = models.DateTimeField() + profile = models.ForeignKey(Profile, null=True, db_column='pid', blank=True) + + class Meta: + db_table = 'requests' + unique_together = (('account', 'stamp', 'type'),) + + +class RequestAnswer(models.Model): + id = models.IntegerField(primary_key=True) + category = models.CharField(max_length=45) + title = models.CharField(max_length=150) + answer = models.TextField() + + class Meta: + 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 = 'requests_hidden' + + +# Misc +# ==== + + +class AXLetter(models.Model): + id = models.IntegerField(primary_key=True) + short_name = models.CharField(max_length=48, unique=True, blank=True) + subject = models.CharField(max_length=765) + title = models.CharField(max_length=765) + body = models.TextField() + signature = models.TextField() + promo_min = models.IntegerField() + promo_max = models.IntegerField() + subset = models.TextField(blank=True) + subset_rm = models.IntegerField(null=True, blank=True) + echeance = models.DateTimeField() + date = models.DateField() + bits = models.CharField(max_length=48) + + class Meta: + 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 = 'carvas' + + +class Contact(models.Model): + account = models.ForeignKey(Account, db_column='uid') + contact = models.ForeignKey(Profile, db_column='contact') + + class Meta: + db_table = 'contacts' + unique_together = (('account', 'contact'),) + + +class Downtime(models.Model): + debut = models.DateTimeField() + duree = models.TimeField() # This field type is a guess. + resume = models.CharField(max_length=765) + description = models.TextField() + services = models.CharField(max_length=54) + + class Meta: + db_table = 'downtimes' + + +class EmailListModerate(models.Model): + ml = models.CharField(max_length=192) + domain = models.CharField(max_length=192) + mid = models.IntegerField() + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + action = models.CharField(max_length=18) + ts = models.DateTimeField() + message = models.TextField(blank=True) + handler = models.IntegerField(null=True, blank=True) + + class Meta: + db_table = 'email_list_moderate' + unique_together = (('ml', 'domain', 'mid'),) + + +class EmailSendSave(models.Model): + account = models.OneToOneField(Account, primary_key=True, db_column='uid') + data = models.TextField() + + class Meta: + db_table = 'email_send_save' + + +class EmailWatch(models.Model): + email = models.CharField(max_length=180, primary_key=True) + state = models.CharField(max_length=27) + detection = models.DateField(null=True, blank=True) + last = models.DateTimeField() + account = models.ForeignKey(Account, null=True, db_column='uid', blank=True) + description = models.TextField() + + class Meta: + db_table = 'email_watch' + + +class GeolocLanguage(models.Model): + iso_3166_1_a2 = models.ForeignKey(GeolocCountry, db_column='iso_3166_1_a2') + language = models.CharField(max_length=15) + 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 = 'geoloc_languages' + unique_together = (('iso_3166_1_a2', 'language'),) + + +class HomonymList(models.Model): + hrmid = models.CharField(max_length=765) + account = models.ForeignKey(Account, db_column='uid') + + class Meta: + db_table = 'homonyms_list' + unique_together = (('hrmid', 'uid'),) + + +class UrlShortener(models.Model): + alias = models.CharField(max_length=255, primary_key=True) + url = models.TextField() + + class Meta: + db_table = 'url_shortener' diff --git a/database/platal/models-from-inspectdb.py b/database/platal/models-from-inspectdb.py new file mode 100644 index 0000000..a666f84 --- /dev/null +++ b/database/platal/models-from-inspectdb.py @@ -0,0 +1,1902 @@ +# This is an auto-generated Django model module. +# You'll have to do the following manually to clean this up: +# * Rearrange models' order +# * Make sure each model has one field with primary_key=True +# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table +# Feel free to rename the models, but don't rename db_table values or field names. +# +# Also note: You'll have to insert the output of 'django-admin sqlcustom [app_label]' +# into your database. +from __future__ import unicode_literals + +from django.db import models + + +class AccountAuthOpenid(models.Model): + uid = models.ForeignKey('Accounts', db_column='uid', blank=True, null=True) + url = models.CharField(max_length=256) + + class Meta: + managed = False + db_table = 'account_auth_openid' + + +class AccountLostPasswords(models.Model): + certificat = models.CharField(primary_key=True, max_length=32) + uid = models.ForeignKey('Accounts', db_column='uid', blank=True, null=True) + created = models.DateTimeField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'account_lost_passwords' + + +class AccountProfiles(models.Model): + uid = models.ForeignKey('Accounts', db_column='uid') + pid = models.ForeignKey('Profiles', db_column='pid') + perms = models.CharField(max_length=5) + + class Meta: + managed = False + db_table = 'account_profiles' + + +class AccountTypes(models.Model): + type = models.CharField(primary_key=True, max_length=16) + perms = models.CharField(max_length=124) + description = models.TextField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'account_types' + + +class AccountXnetLostPasswords(models.Model): + uid = models.ForeignKey('Accounts', db_column='uid', primary_key=True) + date = models.DateTimeField(blank=True, null=True) + hash = models.CharField(max_length=32) + + class Meta: + managed = False + db_table = 'account_xnet_lost_passwords' + + +class Accounts(models.Model): + uid = models.AutoField(primary_key=True) + hruid = models.CharField(unique=True, max_length=255) + type = models.ForeignKey(AccountTypes, db_column='type', blank=True, null=True) + user_perms = models.CharField(max_length=96, blank=True, null=True) + is_admin = models.IntegerField(blank=True, null=True) + state = models.CharField(max_length=8) + password = models.CharField(max_length=40, blank=True, null=True) + token = models.CharField(max_length=32, blank=True, null=True) + weak_password = models.CharField(max_length=256, blank=True, null=True) + registration_date = models.DateTimeField() + flags = models.CharField(max_length=5) + comment = models.CharField(max_length=255, blank=True, null=True) + email = models.CharField(max_length=255, blank=True, null=True) + firstname = models.CharField(max_length=255, blank=True, null=True) + lastname = models.CharField(max_length=255, blank=True, null=True) + full_name = models.CharField(max_length=255, blank=True, null=True) + directory_name = models.CharField(max_length=255, blank=True, null=True) + sort_name = models.CharField(max_length=255, blank=True, null=True) + display_name = models.CharField(max_length=255, blank=True, null=True) + sex = models.CharField(max_length=6) + email_format = models.CharField(max_length=4) + skin = models.ForeignKey('Skins', db_column='skin', blank=True, null=True) + last_version = models.CharField(max_length=16) + best_domain = models.ForeignKey('EmailVirtualDomains', db_column='best_domain', blank=True, null=True) + from_email = models.CharField(max_length=255) + from_format = models.CharField(max_length=4) + + class Meta: + managed = False + db_table = 'accounts' + + +class AnnouncePhotos(models.Model): + eid = models.ForeignKey('Announces', db_column='eid', primary_key=True) + attachmime = models.CharField(max_length=4) + attach = models.TextField() + x = models.SmallIntegerField() + y = models.SmallIntegerField() + + class Meta: + managed = False + db_table = 'announce_photos' + + +class AnnounceRead(models.Model): + evt = models.ForeignKey('Announces') + uid = models.ForeignKey(Accounts, db_column='uid') + + class Meta: + managed = False + db_table = 'announce_read' + + +class Announces(models.Model): + id = models.SmallIntegerField(primary_key=True) + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + creation_date = models.DateTimeField() + titre = models.CharField(max_length=255) + texte = models.TextField() + expiration = models.DateField() + promo_min = models.SmallIntegerField() + promo_max = models.SmallIntegerField() + flags = models.CharField(max_length=29) + noinvite = models.IntegerField() + post_id = models.SmallIntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'announces' + + +class Axletter(models.Model): + short_name = models.CharField(unique=True, max_length=16, blank=True, null=True) + subject = models.CharField(max_length=255) + title = models.CharField(max_length=255) + body = models.TextField() + signature = models.TextField() + promo_min = models.SmallIntegerField() + promo_max = models.SmallIntegerField() + subset = models.TextField(blank=True, null=True) + subset_rm = models.IntegerField(blank=True, null=True) + echeance = models.DateTimeField() + date = models.DateField() + bits = models.CharField(max_length=16) + + class Meta: + managed = False + db_table = 'axletter' + + +class Carvas(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + url = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'carvas' + + +class Contacts(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + contact = models.ForeignKey('Profiles', db_column='contact') + + class Meta: + managed = False + db_table = 'contacts' + + +class Downtimes(models.Model): + id = models.SmallIntegerField(primary_key=True) + debut = models.DateTimeField() + duree = models.TimeField() + resume = models.CharField(max_length=255) + description = models.TextField() + services = models.CharField(max_length=18) + + class Meta: + managed = False + db_table = 'downtimes' + + +class EmailListModerate(models.Model): + ml = models.CharField(max_length=64) + domain = models.CharField(max_length=64) + mid = models.IntegerField() + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + action = models.CharField(max_length=6) + ts = models.DateTimeField() + message = models.TextField(blank=True, null=True) + handler = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'email_list_moderate' + + +class EmailRedirectAccount(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + redirect = models.CharField(max_length=255) + rewrite = models.CharField(max_length=255) + type = models.CharField(max_length=10) + action = models.CharField(max_length=18) + broken_date = models.DateField() + broken_level = models.IntegerField() + last = models.DateField() + flags = models.CharField(max_length=8) + hash = models.CharField(max_length=32, blank=True, null=True) + allow_rewrite = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'email_redirect_account' + + +class EmailRedirectOther(models.Model): + hrmid = models.ForeignKey('EmailSourceOther', db_column='hrmid') + redirect = models.CharField(max_length=255) + type = models.CharField(max_length=10) + action = models.CharField(max_length=18) + + class Meta: + managed = False + db_table = 'email_redirect_other' + + +class EmailSendSave(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + data = models.TextField() + + class Meta: + managed = False + db_table = 'email_send_save' + + +class EmailSourceAccount(models.Model): + email = models.CharField(max_length=255) + domain = models.ForeignKey('EmailVirtualDomains', db_column='domain') + uid = models.ForeignKey(Accounts, db_column='uid') + type = models.CharField(max_length=9) + flags = models.CharField(max_length=23) + expire = models.DateField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'email_source_account' + + +class EmailSourceOther(models.Model): + email = models.CharField(max_length=255) + domain = models.ForeignKey('EmailVirtualDomains', db_column='domain') + hrmid = models.CharField(max_length=255) + type = models.CharField(max_length=8, blank=True, null=True) + expire = models.DateField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'email_source_other' + + +class EmailVirtual(models.Model): + email = models.CharField(max_length=255) + domain = models.ForeignKey('EmailVirtualDomains', db_column='domain') + redirect = models.CharField(max_length=255) + type = models.CharField(max_length=7, blank=True, null=True) + expire = models.DateField() + + class Meta: + managed = False + db_table = 'email_virtual' + + +class EmailVirtualDomains(models.Model): + id = models.SmallIntegerField(primary_key=True) + name = models.CharField(max_length=255) + aliasing = models.ForeignKey('self', db_column='aliasing') + + class Meta: + managed = False + db_table = 'email_virtual_domains' + + +class EmailWatch(models.Model): + email = models.CharField(primary_key=True, max_length=60) + state = models.CharField(max_length=9) + detection = models.DateField(blank=True, null=True) + last = models.DateTimeField() + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + description = models.TextField() + + class Meta: + managed = False + db_table = 'email_watch' + + +class ForumInnd(models.Model): + id_innd = models.AutoField(primary_key=True) + ipmin = models.IntegerField(blank=True, null=True) + ipmax = models.IntegerField(blank=True, null=True) + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + read_perm = models.CharField(max_length=100, blank=True, null=True) + write_perm = models.CharField(max_length=100, blank=True, null=True) + priority = models.IntegerField(blank=True, null=True) + comment = models.TextField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'forum_innd' + + +class ForumProfiles(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + name = models.CharField(max_length=64) + mail = models.CharField(max_length=70) + sig = models.TextField() + flags = models.CharField(max_length=21) + tree_unread = models.CharField(max_length=8) + tree_read = models.CharField(max_length=8) + last_seen = models.DateTimeField() + + class Meta: + managed = False + db_table = 'forum_profiles' + + +class ForumSubs(models.Model): + fid = models.ForeignKey('Forums', db_column='fid') + uid = models.ForeignKey(Accounts, db_column='uid') + + class Meta: + managed = False + db_table = 'forum_subs' + + +class Forums(models.Model): + fid = models.AutoField(primary_key=True) + name = models.CharField(max_length=64) + + class Meta: + managed = False + db_table = 'forums' + + +class FusionaxActivites(models.Model): + ac = models.CharField(db_column='AC', max_length=2) # Field name made lowercase. + ax_id = models.CharField(max_length=8) + code_etab = models.BigIntegerField(db_column='Code_etab') # Field name made lowercase. + raison_sociale = models.CharField(db_column='Raison_sociale', max_length=255) # Field name made lowercase. + libelle_fonctio = models.CharField(db_column='Libelle_fonctio', max_length=255) # Field name made lowercase. + annuaire = models.IntegerField(db_column='Annuaire') # Field name made lowercase. + date_maj = models.DateField(db_column='Date_maj') # Field name made lowercase. + pid = models.IntegerField(blank=True, null=True) + jobid = models.IntegerField(blank=True, null=True) + description = models.CharField(max_length=255, blank=True, null=True) + + class Meta: + managed = False + db_table = 'fusionax_activites' + + +class FusionaxAdresses(models.Model): + provenance = models.CharField(max_length=2) + ax_id = models.CharField(max_length=8) + type_adr = models.CharField(db_column='Type_adr', max_length=1) # Field name made lowercase. + ligne1 = models.CharField(db_column='Ligne1', max_length=90) # Field name made lowercase. + ligne2 = models.CharField(db_column='Ligne2', max_length=90) # Field name made lowercase. + ligne3 = models.CharField(db_column='Ligne3', max_length=90) # Field name made lowercase. + code_postal = models.CharField(max_length=20) + ville = models.CharField(max_length=80) + zip_cedex = models.CharField(max_length=20) + etat_distr = models.CharField(max_length=20) + pays = models.CharField(max_length=50) + tel = models.CharField(max_length=30) + fax = models.CharField(max_length=30) + date_maj = models.DateField(db_column='Date_maj') # Field name made lowercase. + code_etab = models.BigIntegerField(db_column='Code_etab', blank=True, null=True) # Field name made lowercase. + pid = models.IntegerField(blank=True, null=True) + jobid = models.IntegerField(blank=True, null=True) + text = models.TextField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'fusionax_adresses' + + +class FusionaxAnciens(models.Model): + an = models.CharField(db_column='AN', max_length=2) # Field name made lowercase. + ax_id = models.CharField(primary_key=True, max_length=8) + promotion_etude = models.SmallIntegerField() + groupe_promo = models.CharField(max_length=1) + nom_patronymique = models.CharField(db_column='Nom_patronymique', max_length=255) # Field name made lowercase. + partic_patro = models.CharField(max_length=5) + prenom = models.CharField(max_length=30) + nom_usuel = models.CharField(db_column='Nom_usuel', max_length=255) # Field name made lowercase. + partic_nom = models.CharField(max_length=5) + nom_complet = models.CharField(db_column='Nom_complet', max_length=255) # Field name made lowercase. + civilite = models.CharField(db_column='Civilite', max_length=4) # Field name made lowercase. + code_nationalite = models.CharField(db_column='Code_nationalite', max_length=4) # Field name made lowercase. + corps_sortie = models.CharField(max_length=50) + date_deces = models.DateField(db_column='Date_deces', blank=True, null=True) # Field name made lowercase. + grade = models.CharField(max_length=50) + mel_usage = models.CharField(db_column='Mel_usage', max_length=255) # Field name made lowercase. + mel_publiable = models.IntegerField(db_column='Mel_publiable') # Field name made lowercase. + mob_publiable = models.IntegerField(db_column='Mob_publiable') # Field name made lowercase. + tel_mobile = models.CharField(max_length=30) + date_maj = models.DateField(db_column='Date_maj') # Field name made lowercase. + pid = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'fusionax_anciens' + + +class FusionaxEntreprises(models.Model): + en = models.CharField(db_column='EN', max_length=2) # Field name made lowercase. + code_etab = models.BigIntegerField(db_column='Code_etab', primary_key=True) # Field name made lowercase. + raison_sociale = models.CharField(db_column='Raison_sociale', max_length=255) # Field name made lowercase. + sigle = models.CharField(db_column='Sigle', max_length=50) # Field name made lowercase. + + class Meta: + managed = False + db_table = 'fusionax_entreprises' + + +class FusionaxFormations(models.Model): + date_maj = models.DateField(db_column='Date_maj') # Field name made lowercase. + fo = models.CharField(db_column='FO', max_length=2) # Field name made lowercase. + ax_id = models.CharField(max_length=8) + intitule_formation = models.CharField(db_column='Intitule_formation', max_length=255) # Field name made lowercase. + intitule_diplome = models.CharField(db_column='Intitule_diplome', max_length=255) # Field name made lowercase. + descr_formation = models.CharField(db_column='Descr_formation', max_length=255) # Field name made lowercase. + pid = models.IntegerField(blank=True, null=True) + eduid = models.IntegerField(blank=True, null=True) + degreeid = models.IntegerField(blank=True, null=True) + fieldid = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'fusionax_formations' + + +class FusionaxFormationsMd(models.Model): + fo = models.CharField(db_column='FO', max_length=2) # Field name made lowercase. + ax_id = models.CharField(primary_key=True, max_length=8) + field = models.CharField(max_length=255, blank=True, null=True) + pid = models.IntegerField(blank=True, null=True) + fieldid = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'fusionax_formations_md' + + +class FusionaxImport(models.Model): + ax_id = models.CharField(primary_key=True, max_length=8) + pid = models.IntegerField(blank=True, null=True) + date_match_id = models.DateTimeField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'fusionax_import' + + +class GappsAccounts(models.Model): + l_userid = models.ForeignKey(Accounts, db_column='l_userid', blank=True, null=True) + l_sync_password = models.IntegerField(blank=True, null=True) + l_activate_mail_redirection = models.IntegerField(blank=True, null=True) + g_account_id = models.CharField(max_length=16, blank=True, null=True) + g_account_name = models.CharField(primary_key=True, max_length=256) + g_domain = models.CharField(max_length=40, blank=True, null=True) + g_first_name = models.CharField(max_length=40) + g_last_name = models.CharField(max_length=40) + g_status = models.CharField(max_length=13, blank=True, null=True) + g_admin = models.IntegerField(blank=True, null=True) + g_suspension = models.CharField(max_length=256, blank=True, null=True) + r_disk_usage = models.BigIntegerField(blank=True, null=True) + r_creation = models.DateField(blank=True, null=True) + r_last_login = models.DateField(blank=True, null=True) + r_last_webmail = models.DateField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'gapps_accounts' + + +class GappsNicknames(models.Model): + l_userid = models.ForeignKey(Accounts, db_column='l_userid', blank=True, null=True) + g_account_name = models.CharField(max_length=256) + g_nickname = models.CharField(primary_key=True, max_length=256) + + class Meta: + managed = False + db_table = 'gapps_nicknames' + + +class GappsQueue(models.Model): + q_id = models.AutoField(primary_key=True) + q_owner = models.ForeignKey(Accounts, blank=True, null=True) + q_recipient = models.ForeignKey(Accounts, blank=True, null=True) + p_entry_date = models.DateTimeField() + p_notbefore_date = models.DateTimeField() + p_start_date = models.DateTimeField(blank=True, null=True) + p_end_date = models.DateTimeField(blank=True, null=True) + p_status = models.CharField(max_length=8) + p_priority = models.CharField(max_length=9) + p_admin_request = models.IntegerField() + j_type = models.CharField(max_length=10) + j_parameters = models.TextField(blank=True, null=True) + r_softfail_date = models.DateTimeField(blank=True, null=True) + r_softfail_count = models.SmallIntegerField() + r_result = models.CharField(max_length=256, blank=True, null=True) + + class Meta: + managed = False + db_table = 'gapps_queue' + + +class GappsReporting(models.Model): + date = models.DateField(primary_key=True) + num_accounts = models.IntegerField(blank=True, null=True) + count_1_day_actives = models.IntegerField(blank=True, null=True) + count_7_day_actives = models.IntegerField(blank=True, null=True) + count_14_day_actives = models.IntegerField(blank=True, null=True) + count_30_day_actives = models.IntegerField(blank=True, null=True) + count_30_day_idle = models.IntegerField(blank=True, null=True) + count_60_day_idle = models.IntegerField(blank=True, null=True) + count_90_day_idle = models.IntegerField(blank=True, null=True) + usage_in_bytes = models.BigIntegerField(blank=True, null=True) + quota_in_mb = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'gapps_reporting' + + +class GeolocCountries(models.Model): + iso_3166_1_a2 = models.CharField(primary_key=True, max_length=2) + iso_3166_1_a3 = models.CharField(unique=True, max_length=3) + iso_3166_1_num = models.SmallIntegerField(unique=True) + worldregion = models.CharField(db_column='worldRegion', max_length=2, blank=True, null=True) # Field name made lowercase. + country = models.CharField(max_length=255, blank=True, null=True) + countryen = models.CharField(db_column='countryEn', max_length=255, blank=True, null=True) # Field name made lowercase. + capital = models.CharField(max_length=255) + nationality = models.CharField(max_length=255, blank=True, null=True) + nationalityen = models.CharField(db_column='nationalityEn', max_length=255, blank=True, null=True) # Field name made lowercase. + phoneprefix = models.SmallIntegerField(db_column='phonePrefix', blank=True, null=True) # Field name made lowercase. + phoneformat = models.CharField(db_column='phoneFormat', max_length=255) # Field name made lowercase. + licenseplate = models.CharField(db_column='licensePlate', max_length=4, blank=True, null=True) # Field name made lowercase. + belongsto = models.ForeignKey('self', db_column='belongsTo', blank=True, null=True) # Field name made lowercase. + countryplain = models.CharField(db_column='countryPlain', max_length=255, blank=True, null=True) # Field name made lowercase. + + class Meta: + managed = False + db_table = 'geoloc_countries' + + +class GeolocLanguages(models.Model): + iso_3166_1_a2 = models.ForeignKey(GeolocCountries, db_column='iso_3166_1_a2') + language = models.CharField(max_length=5) + country = models.CharField(max_length=255, blank=True, null=True) + countryplain = models.CharField(db_column='countryPlain', max_length=255, blank=True, null=True) # Field name made lowercase. + + class Meta: + managed = False + db_table = 'geoloc_languages' + + +class GroupAnnounces(models.Model): + id = models.SmallIntegerField(primary_key=True) + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + asso = models.ForeignKey('Groups') + create_date = models.DateTimeField() + titre = models.CharField(max_length=255) + texte = models.TextField() + contacts = models.TextField() + expiration = models.DateField() + promo_min = models.SmallIntegerField() + promo_max = models.SmallIntegerField() + flags = models.CharField(max_length=12) + post_id = models.SmallIntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'group_announces' + + +class GroupAnnouncesPhoto(models.Model): + eid = models.ForeignKey(GroupAnnounces, db_column='eid', primary_key=True) + attachmime = models.CharField(max_length=4) + attach = models.TextField() + x = models.SmallIntegerField() + y = models.SmallIntegerField() + + class Meta: + managed = False + db_table = 'group_announces_photo' + + +class GroupAnnouncesRead(models.Model): + announce = models.ForeignKey(GroupAnnounces) + uid = models.ForeignKey(Accounts, db_column='uid') + + class Meta: + managed = False + db_table = 'group_announces_read' + + +class GroupAuth(models.Model): + id = models.SmallIntegerField(primary_key=True) + privkey = models.CharField(unique=True, max_length=40) + name = models.CharField(max_length=32) + datafields = models.CharField(max_length=255) + returnurls = models.CharField(max_length=255) + last_used = models.DateField(blank=True, null=True) + group_id = models.SmallIntegerField(blank=True, null=True) + flags = models.CharField(max_length=21, blank=True, null=True) + + class Meta: + managed = False + db_table = 'group_auth' + + +class GroupDom(models.Model): + id = models.SmallIntegerField(primary_key=True) + nom = models.TextField() + cat = models.CharField(max_length=39) + + class Meta: + managed = False + db_table = 'group_dom' + + +class GroupEventItems(models.Model): + eid = models.ForeignKey('GroupEvents', db_column='eid') + item_id = models.IntegerField() + titre = models.CharField(max_length=100) + details = models.TextField() + montant = models.DecimalField(max_digits=10, decimal_places=2) + + class Meta: + managed = False + db_table = 'group_event_items' + + +class GroupEventParticipants(models.Model): + eid = models.ForeignKey(GroupEventItems, db_column='eid') + uid = models.ForeignKey(Accounts, db_column='uid') + item = models.ForeignKey(GroupEventItems) + nb = models.IntegerField() + flags = models.CharField(max_length=14) + paid = models.FloatField() + + class Meta: + managed = False + db_table = 'group_event_participants' + + +class GroupEvents(models.Model): + eid = models.AutoField(primary_key=True) + asso = models.ForeignKey('Groups', blank=True, null=True) + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + intitule = models.CharField(max_length=100) + short_name = models.CharField(max_length=30) + paiement = models.ForeignKey('Payments', blank=True, null=True) + descriptif = models.TextField() + debut = models.DateTimeField() + fin = models.DateTimeField(blank=True, null=True) + show_participants = models.IntegerField() + deadline_inscription = models.DateField(blank=True, null=True) + noinvite = models.IntegerField() + accept_nonmembre = models.IntegerField() + archive = models.IntegerField() + subscription_notification = models.CharField(max_length=8) + + class Meta: + managed = False + db_table = 'group_events' + + +class GroupFormerMembers(models.Model): + asso = models.ForeignKey('Groups') + uid = models.ForeignKey(Accounts, db_column='uid') + remember = models.IntegerField() + unsubsciption_date = models.DateField() + + class Meta: + managed = False + db_table = 'group_former_members' + + +class GroupMemberSubRequests(models.Model): + asso = models.ForeignKey('Groups') + uid = models.ForeignKey(Accounts, db_column='uid') + ts = models.DateTimeField() + reason = models.TextField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'group_member_sub_requests' + + +class GroupMembers(models.Model): + asso = models.ForeignKey('Groups') + uid = models.ForeignKey(Accounts, db_column='uid') + 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) + + class Meta: + managed = False + db_table = 'group_members' + + +class Groups(models.Model): + id = models.SmallIntegerField(primary_key=True) + nom = models.CharField(max_length=255) + diminutif = models.CharField(unique=True, max_length=64) + cat = models.CharField(max_length=39) + dom = models.ForeignKey(GroupDom, db_column='dom', blank=True, null=True) + descr = models.TextField() + logo = models.TextField(blank=True, null=True) + logo_mime = models.TextField(blank=True, null=True) + site = models.CharField(max_length=255) + mail = models.CharField(max_length=255) + resp = models.CharField(max_length=255) + forum = models.CharField(max_length=255) + mail_domain = models.CharField(max_length=255) + ax = models.IntegerField() + pub = models.CharField(max_length=7) + sub_url = models.CharField(max_length=255) + inscriptible = models.IntegerField() + unsub_url = models.CharField(max_length=255) + flags = models.CharField(max_length=39) + axdate = models.DateField(db_column='axDate', blank=True, null=True) # Field name made lowercase. + welcome_msg = models.TextField(blank=True, null=True) + event_order = models.CharField(max_length=8) + disable_mails = models.IntegerField() + status = models.CharField(max_length=20) + + class Meta: + managed = False + db_table = 'groups' + + +class HomonymsList(models.Model): + hrmid = models.CharField(max_length=255) + uid = models.ForeignKey(Accounts, db_column='uid') + + class Meta: + managed = False + db_table = 'homonyms_list' + + +class IpWatch(models.Model): + state = models.CharField(max_length=9) + detection = models.DateField(blank=True, null=True) + last = models.DateTimeField() + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + description = models.TextField() + ip = models.IntegerField(primary_key=True) + mask = models.IntegerField() + + class Meta: + managed = False + db_table = 'ip_watch' + + +class LogActions(models.Model): + text = models.CharField(max_length=32) + description = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'log_actions' + + +class LogEvents(models.Model): + stamp = models.DateTimeField() + session = models.ForeignKey('LogSessions', db_column='session') + action = models.ForeignKey(LogActions, db_column='action') + data = models.TextField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'log_events' + + +class LogLastSessions(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + id = models.ForeignKey('LogSessions', db_column='id') + + class Meta: + managed = False + db_table = 'log_last_sessions' + + +class LogSessions(models.Model): + auth = models.CharField(max_length=6) + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + start = models.DateTimeField() + host = models.CharField(max_length=128) + sauth = models.CharField(max_length=6) + suid = models.ForeignKey(Accounts, db_column='suid', blank=True, null=True) + browser = models.CharField(max_length=255) + forward_host = models.CharField(max_length=128, blank=True, null=True) + flags = models.CharField(max_length=5) + ip = models.IntegerField() + forward_ip = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'log_sessions' + + +class MxWatch(models.Model): + host = models.CharField(primary_key=True, max_length=64) + state = models.CharField(max_length=7, blank=True, null=True) + text = models.TextField() + + class Meta: + managed = False + db_table = 'mx_watch' + + +class NewsletterArt(models.Model): + id = models.ForeignKey('NewsletterIssues', db_column='id') + aid = models.SmallIntegerField() + cid = models.ForeignKey('NewsletterCat', db_column='cid', blank=True, null=True) + pos = models.IntegerField() + title = models.TextField() + body = models.TextField() + append = models.TextField() + + class Meta: + managed = False + db_table = 'newsletter_art' + + +class NewsletterCat(models.Model): + cid = models.AutoField(primary_key=True) + nlid = models.ForeignKey('Newsletters', db_column='nlid') + pos = models.IntegerField() + title = models.CharField(max_length=128) + + class Meta: + managed = False + db_table = 'newsletter_cat' + + +class NewsletterIns(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + nlid = models.ForeignKey('Newsletters', db_column='nlid') + last = models.ForeignKey('NewsletterIssues', db_column='last', blank=True, null=True) + hash = models.CharField(max_length=32, blank=True, null=True) + + class Meta: + managed = False + db_table = 'newsletter_ins' + + +class NewsletterIssues(models.Model): + nlid = models.ForeignKey('Newsletters', db_column='nlid') + date = models.DateField() + send_before = models.DateTimeField(blank=True, null=True) + state = models.CharField(max_length=7) + sufb_json = models.TextField(blank=True, null=True) + title = models.CharField(max_length=255) + head = models.TextField() + signature = models.TextField() + short_name = models.CharField(max_length=16, blank=True, null=True) + mail_title = models.CharField(max_length=255) + unsubscribe = models.IntegerField() + reply_to = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'newsletter_issues' + + +class Newsletters(models.Model): + group = models.ForeignKey(Groups, unique=True) + name = models.CharField(max_length=255) + criteria = models.CharField(max_length=14, blank=True, null=True) + + class Meta: + managed = False + db_table = 'newsletters' + + +class PaymentBankaccounts(models.Model): + asso_id = models.IntegerField() + iban = models.CharField(max_length=33) + bic = models.CharField(max_length=11) + owner = models.CharField(max_length=100) + status = models.CharField(max_length=12) + + class Meta: + managed = False + db_table = 'payment_bankaccounts' + + +class PaymentCodec(models.Model): + id = models.SmallIntegerField(primary_key=True) + text = models.CharField(max_length=64) + + class Meta: + managed = False + db_table = 'payment_codeC' + + +class PaymentCodercb(models.Model): + id = models.SmallIntegerField(primary_key=True) + text = models.CharField(max_length=64) + codec = models.IntegerField(db_column='codeC') # Field name made lowercase. + + class Meta: + managed = False + db_table = 'payment_codeRCB' + + +class PaymentMethods(models.Model): + id = models.IntegerField() + text = models.CharField(max_length=32) + include = models.CharField(max_length=32) + short_name = models.CharField(max_length=10) + flags = models.CharField(max_length=12, blank=True, null=True) + + class Meta: + managed = False + db_table = 'payment_methods' + + +class PaymentReconcilations(models.Model): + method_id = models.IntegerField() + period_start = models.DateField() + period_end = models.DateField() + status = models.CharField(max_length=11) + payment_count = models.IntegerField() + sum_amounts = models.DecimalField(max_digits=9, decimal_places=2) + sum_commissions = models.DecimalField(max_digits=9, decimal_places=2) + comments = models.TextField() + recongroup_id = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'payment_reconcilations' + + +class PaymentTransactions(models.Model): + id = models.CharField(primary_key=True, max_length=64) + method_id = models.IntegerField(blank=True, null=True) + uid = models.IntegerField() + ref = models.IntegerField() + fullref = models.CharField(max_length=15) + ts_confirmed = models.DateTimeField(blank=True, null=True) + ts_initiated = models.DateTimeField(blank=True, null=True) + amount = models.DecimalField(max_digits=9, decimal_places=2) + commission = models.DecimalField(max_digits=9, decimal_places=2, blank=True, null=True) + pkey = models.CharField(max_length=5) + comment = models.CharField(max_length=255) + status = models.CharField(max_length=9) + recon_id = models.IntegerField(blank=True, null=True) + display = models.IntegerField() + + class Meta: + managed = False + db_table = 'payment_transactions' + + +class PaymentTransfers(models.Model): + recongroup_id = models.IntegerField() + payment_id = models.IntegerField() + amount = models.DecimalField(max_digits=9, decimal_places=2) + account_id = models.IntegerField(blank=True, null=True) + message = models.CharField(max_length=255) + date = models.DateField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'payment_transfers' + + +class Payments(models.Model): + text = models.CharField(max_length=255) + url = models.CharField(max_length=128) + flags = models.CharField(max_length=17) + amount_def = models.DecimalField(max_digits=10, decimal_places=2) + amount_min = models.DecimalField(max_digits=10, decimal_places=2) + amount_max = models.DecimalField(max_digits=10, decimal_places=2) + mail = models.CharField(max_length=64) + confirmation = models.TextField() + asso = models.ForeignKey(Groups, blank=True, null=True) + rib = models.ForeignKey(PaymentBankaccounts) + + class Meta: + managed = False + db_table = 'payments' + + +class PostfixBlacklist(models.Model): + email = models.CharField(primary_key=True, max_length=150) + reject_text = models.CharField(max_length=64) + + class Meta: + managed = False + db_table = 'postfix_blacklist' + + +class PostfixMailseen(models.Model): + crc = models.CharField(primary_key=True, max_length=8) + nb = models.SmallIntegerField() + update_time = models.DateTimeField() + create_time = models.DateTimeField() + release = models.CharField(max_length=6) + + class Meta: + managed = False + db_table = 'postfix_mailseen' + + +class PostfixWhitelist(models.Model): + email = models.CharField(primary_key=True, max_length=150) + + class Meta: + managed = False + db_table = 'postfix_whitelist' + + +class ProfileAddresses(models.Model): + pid = models.IntegerField() + jobid = models.IntegerField() + groupid = models.SmallIntegerField() + type = models.CharField(max_length=5) + id = models.IntegerField() + flags = models.CharField(max_length=65, blank=True, null=True) + text = models.TextField() + postaltext = models.TextField(db_column='postalText') # Field name made lowercase. + formatted_address = models.TextField() + 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=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=5, blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_addresses' + + +class ProfileAddressesComponents(models.Model): + pid = models.ForeignKey(ProfileAddresses, db_column='pid') + jobid = models.ForeignKey(ProfileAddresses, db_column='jobid') + groupid = models.ForeignKey(ProfileAddresses, db_column='groupid') + type = models.ForeignKey(ProfileAddresses, db_column='type') + id = models.ForeignKey(ProfileAddresses, db_column='id') + component = models.ForeignKey('ProfileAddressesComponentsEnum') + + class Meta: + managed = False + db_table = 'profile_addresses_components' + + +class ProfileAddressesComponentsEnum(models.Model): + id = models.BigIntegerField(primary_key=True) + short_name = models.CharField(max_length=255) + long_name = models.CharField(max_length=255) + types = models.CharField(max_length=297) + + class Meta: + managed = False + db_table = 'profile_addresses_components_enum' + + +class ProfileBinetEnum(models.Model): + text = models.CharField(max_length=50) + url = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'profile_binet_enum' + + +class ProfileBinets(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + binet = models.ForeignKey(ProfileBinetEnum) + + class Meta: + managed = False + db_table = 'profile_binets' + + +class ProfileCorps(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + original_corpsid = models.ForeignKey('ProfileCorpsEnum', db_column='original_corpsid') + current_corpsid = models.ForeignKey('ProfileCorpsEnum', db_column='current_corpsid') + rankid = models.ForeignKey('ProfileCorpsRankEnum', db_column='rankid') + corps_pub = models.CharField(max_length=7) + + class Meta: + managed = False + db_table = 'profile_corps' + + +class ProfileCorpsEnum(models.Model): + name = models.CharField(unique=True, max_length=255) + abbreviation = models.CharField(unique=True, max_length=5) + still_exists = models.IntegerField() + + class Meta: + managed = False + db_table = 'profile_corps_enum' + + +class ProfileCorpsRankEnum(models.Model): + name = models.CharField(unique=True, max_length=255) + abbreviation = models.CharField(unique=True, max_length=5) + + class Meta: + managed = False + db_table = 'profile_corps_rank_enum' + + +class ProfileDeltaten(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + message = models.TextField() + + class Meta: + managed = False + db_table = 'profile_deltaten' + + +class ProfileDisplay(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + yourself = models.CharField(max_length=255) + public_name = models.CharField(max_length=255) + private_name = models.CharField(max_length=255) + directory_name = models.CharField(max_length=255) + short_name = models.CharField(max_length=255) + sort_name = models.CharField(max_length=255) + promo = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'profile_display' + + +class ProfileEducation(models.Model): + id = models.IntegerField() + pid = models.ForeignKey('Profiles', db_column='pid') + eduid = models.ForeignKey('ProfileEducationEnum', db_column='eduid', blank=True, null=True) + degreeid = models.ForeignKey('ProfileEducationDegreeEnum', db_column='degreeid', blank=True, null=True) + fieldid = models.ForeignKey('ProfileEducationFieldEnum', db_column='fieldid', blank=True, null=True) + entry_year = models.IntegerField(blank=True, null=True) + grad_year = models.IntegerField(blank=True, null=True) + promo_year = models.IntegerField(blank=True, null=True) + program = models.CharField(max_length=255, blank=True, null=True) + flags = models.CharField(max_length=27) + + class Meta: + managed = False + db_table = 'profile_education' + + +class ProfileEducationDegree(models.Model): + eduid = models.ForeignKey('ProfileEducationEnum', db_column='eduid') + degreeid = models.ForeignKey('ProfileEducationDegreeEnum', db_column='degreeid') + + class Meta: + managed = False + db_table = 'profile_education_degree' + + +class ProfileEducationDegreeEnum(models.Model): + degree = models.CharField(unique=True, max_length=255, blank=True, null=True) + abbreviation = models.CharField(max_length=255) + level = models.IntegerField() + + class Meta: + managed = False + db_table = 'profile_education_degree_enum' + + +class ProfileEducationEnum(models.Model): + name = models.CharField(unique=True, max_length=255, blank=True, null=True) + abbreviation = models.CharField(max_length=255) + url = models.CharField(max_length=255, blank=True, null=True) + country = models.ForeignKey(GeolocCountries, db_column='country', blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_education_enum' + + +class ProfileEducationFieldEnum(models.Model): + field = models.CharField(unique=True, max_length=255, blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_education_field_enum' + + +class ProfileHobby(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + id = models.IntegerField() + type = models.CharField(max_length=6) + text = models.CharField(max_length=255) + pub = models.CharField(max_length=7) + + class Meta: + managed = False + db_table = 'profile_hobby' + + +class ProfileJob(models.Model): + id = models.IntegerField() + pid = models.ForeignKey('Profiles', db_column='pid') + jobid = models.ForeignKey('ProfileJobEnum', db_column='jobid', blank=True, null=True) + description = models.CharField(max_length=255) + url = models.CharField(max_length=255) + email = models.CharField(max_length=255) + pub = models.CharField(max_length=7) + email_pub = models.CharField(max_length=7) + entry_year = models.CharField(max_length=4, blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_job' + + +class ProfileJobEntrepriseTerm(models.Model): + eid = models.ForeignKey('ProfileJobEnum', db_column='eid') + jtid = models.ForeignKey('ProfileJobTermEnum', db_column='jtid') + + class Meta: + managed = False + db_table = 'profile_job_entreprise_term' + + +class ProfileJobEnum(models.Model): + name = models.CharField(unique=True, max_length=255) + acronym = models.CharField(max_length=255, blank=True, null=True) + url = models.CharField(max_length=255, blank=True, null=True) + email = models.CharField(max_length=255, blank=True, null=True) + holdingid = models.ForeignKey('self', db_column='holdingid', blank=True, null=True) + siren_code = models.CharField(db_column='SIREN_code', max_length=9, blank=True, null=True) # Field name made lowercase. + naf_code = models.CharField(db_column='NAF_code', max_length=5, blank=True, null=True) # Field name made lowercase. + ax_code = models.BigIntegerField(db_column='AX_code', blank=True, null=True) # Field name made lowercase. + + class Meta: + managed = False + db_table = 'profile_job_enum' + + +class ProfileJobTerm(models.Model): + pid = models.ForeignKey(ProfileJob, db_column='pid') + jid = models.ForeignKey(ProfileJob, db_column='jid') + jtid = models.ForeignKey('ProfileJobTermEnum', db_column='jtid') + computed = models.CharField(max_length=8) + + class Meta: + managed = False + db_table = 'profile_job_term' + + +class ProfileJobTermEnum(models.Model): + jtid = models.AutoField(primary_key=True) + name = models.CharField(max_length=255) + full_name = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'profile_job_term_enum' + + +class ProfileJobTermRelation(models.Model): + jtid_1 = models.ForeignKey(ProfileJobTermEnum, db_column='jtid_1') + jtid_2 = models.ForeignKey(ProfileJobTermEnum, db_column='jtid_2') + rel = models.CharField(max_length=8) + computed = models.CharField(max_length=8) + + class Meta: + managed = False + db_table = 'profile_job_term_relation' + + +class ProfileJobTermSearch(models.Model): + search = models.CharField(max_length=50) + jtid = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') + + class Meta: + managed = False + db_table = 'profile_job_term_search' + + +class ProfileLangskillEnum(models.Model): + iso_639_2b = models.CharField(primary_key=True, max_length=3) + language = models.CharField(max_length=255) + language_en = models.CharField(max_length=255) + iso_639_2t = models.CharField(max_length=3) + iso_639_1 = models.CharField(max_length=2, blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_langskill_enum' + + +class ProfileLangskills(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + lid = models.ForeignKey(ProfileLangskillEnum, db_column='lid') + level = models.SmallIntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_langskills' + + +class ProfileManageurs(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + title = models.CharField(max_length=255) + entry_year = models.IntegerField(blank=True, null=True) + project = models.TextField(blank=True, null=True) + anonymity = models.IntegerField() + visibility = models.CharField(max_length=18) + email = models.CharField(max_length=255) + communication = models.CharField(max_length=17) + push = models.CharField(max_length=6) + network = models.IntegerField() + + class Meta: + managed = False + db_table = 'profile_manageurs' + + +class ProfileMedalEnum(models.Model): + type = models.CharField(max_length=10) + text = models.CharField(max_length=255, blank=True, null=True) + img = models.CharField(max_length=255, blank=True, null=True) + flags = models.CharField(max_length=21) + + class Meta: + managed = False + db_table = 'profile_medal_enum' + + +class ProfileMedalGradeEnum(models.Model): + mid = models.ForeignKey(ProfileMedalEnum, db_column='mid') + gid = models.IntegerField() + text = models.CharField(max_length=255, blank=True, null=True) + pos = models.IntegerField() + + class Meta: + managed = False + db_table = 'profile_medal_grade_enum' + + +class ProfileMedals(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + mid = models.IntegerField() + gid = models.IntegerField() + level = models.CharField(max_length=6) + + class Meta: + managed = False + db_table = 'profile_medals' + + +class ProfileMentor(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + expertise = models.TextField() + + class Meta: + managed = False + db_table = 'profile_mentor' + + +class ProfileMentorCountry(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + country = models.ForeignKey(GeolocCountries, db_column='country') + + class Meta: + managed = False + db_table = 'profile_mentor_country' + + +class ProfileMentorTerm(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + jtid = models.ForeignKey(ProfileJobTermEnum, db_column='jtid') + + class Meta: + managed = False + db_table = 'profile_mentor_term' + + +class ProfileMergeIssues(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + issues = models.CharField(max_length=48, blank=True, null=True) + entry_year_ax = models.IntegerField(blank=True, null=True) + deathdate_ax = models.DateField(blank=True, null=True) + name = models.CharField(max_length=255, blank=True, null=True) + name_type = models.IntegerField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_merge_issues' + + +class ProfileModifications(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + uid = models.ForeignKey(Accounts, db_column='uid') + field = models.CharField(max_length=60) + oldtext = models.TextField(db_column='oldText') # Field name made lowercase. + newtext = models.TextField(db_column='newText') # Field name made lowercase. + type = models.CharField(max_length=11) + timestamp = models.DateTimeField() + + class Meta: + managed = False + db_table = 'profile_modifications' + + +class ProfileNetworking(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + id = models.IntegerField() + nwid = models.ForeignKey('ProfileNetworkingEnum', db_column='nwid') + address = models.CharField(max_length=255) + pub = models.CharField(max_length=7) + + class Meta: + managed = False + db_table = 'profile_networking' + + +class ProfileNetworkingEnum(models.Model): + nwid = models.IntegerField(primary_key=True) + name = models.CharField(max_length=30) + icon = models.CharField(max_length=50) + filter = models.CharField(max_length=6) + network_type = models.CharField(max_length=6) + link = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'profile_networking_enum' + + +class ProfilePartnersharingEnum(models.Model): + id = models.IntegerField(primary_key=True) + api_uid = models.ForeignKey(Accounts, db_column='api_uid', blank=True, null=True) + shortname = models.CharField(max_length=64) + name = models.CharField(max_length=255) + url = models.CharField(max_length=255) + default_sharing_level = models.CharField(max_length=7, blank=True, null=True) + has_directory = models.IntegerField() + has_bulkmail = models.IntegerField() + + class Meta: + managed = False + db_table = 'profile_partnersharing_enum' + + +class ProfilePartnersharingSettings(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + partner = models.ForeignKey(ProfilePartnersharingEnum) + exposed_uid = models.CharField(max_length=255) + sharing_level = models.CharField(max_length=7, blank=True, null=True) + allow_email = models.CharField(max_length=6, blank=True, null=True) + last_connection = models.DateTimeField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_partnersharing_settings' + + +class ProfilePhones(models.Model): + pid = models.IntegerField() + link_type = models.CharField(max_length=7) + link_id = models.IntegerField() + tel_id = models.IntegerField() + tel_type = models.CharField(max_length=6) + search_tel = models.CharField(max_length=25) + display_tel = models.CharField(max_length=30) + pub = models.CharField(max_length=7) + comment = models.CharField(max_length=80) + + class Meta: + managed = False + db_table = 'profile_phones' + + +class ProfilePhotoTokens(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + token = models.CharField(max_length=255) + expires = models.DateTimeField() + + class Meta: + managed = False + db_table = 'profile_photo_tokens' + + +class ProfilePhotos(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + attachmime = models.CharField(max_length=4) + attach = models.TextField() + x = models.SmallIntegerField() + y = models.SmallIntegerField() + pub = models.CharField(max_length=7) + last_update = models.DateTimeField() + + class Meta: + managed = False + db_table = 'profile_photos' + + +class ProfilePrivateNames(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + type = models.CharField(max_length=9) + id = models.IntegerField() + name = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'profile_private_names' + + +class ProfilePublicNames(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid', primary_key=True) + lastname_initial = models.CharField(max_length=255) + lastname_main = models.CharField(max_length=255) + lastname_marital = models.CharField(max_length=255) + lastname_ordinary = models.CharField(max_length=255) + firstname_initial = models.CharField(max_length=255) + firstname_main = models.CharField(max_length=255) + firstname_ordinary = models.CharField(max_length=255) + pseudonym = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'profile_public_names' + + +class ProfileSectionEnum(models.Model): + id = models.IntegerField(primary_key=True) + text = models.CharField(unique=True, max_length=50) + + class Meta: + managed = False + db_table = 'profile_section_enum' + + +class ProfileSkillEnum(models.Model): + id = models.CharField(primary_key=True, max_length=3) + text_fr = models.CharField(max_length=110) + text_en = models.CharField(max_length=110) + flags = models.CharField(max_length=5) + + class Meta: + managed = False + db_table = 'profile_skill_enum' + + +class ProfileSkills(models.Model): + pid = models.ForeignKey('Profiles', db_column='pid') + cid = models.ForeignKey(ProfileSkillEnum, db_column='cid') + level = models.CharField(max_length=18) + + class Meta: + managed = False + db_table = 'profile_skills' + + +class ProfileVisibilityEnum(models.Model): + access_level = models.CharField(max_length=7, blank=True, null=True) + best_display_level = models.CharField(max_length=7, blank=True, null=True) + display_levels = models.CharField(max_length=24, blank=True, null=True) + + class Meta: + managed = False + db_table = 'profile_visibility_enum' + + +class Profiles(models.Model): + pid = models.AutoField(primary_key=True) + hrpid = models.CharField(unique=True, max_length=255) + xorg_id = models.IntegerField() + ax_id = models.CharField(max_length=8, blank=True, null=True) + birthdate = models.DateField(blank=True, null=True) + birthdate_ref = models.DateField(blank=True, null=True) + next_birthday = models.DateField(blank=True, null=True) + deathdate = models.DateField(blank=True, null=True) + deathdate_rec = models.DateField(blank=True, null=True) + sex = models.CharField(max_length=6) + section = models.ForeignKey(ProfileSectionEnum, db_column='section', blank=True, null=True) + cv = models.TextField(blank=True, null=True) + freetext = models.TextField(blank=True, null=True) + freetext_pub = models.CharField(max_length=7) + axfreetext = models.TextField(blank=True, null=True) + medals_pub = models.CharField(max_length=7) + alias_pub = models.CharField(max_length=7) + nationality1 = models.ForeignKey(GeolocCountries, db_column='nationality1', blank=True, null=True) + nationality2 = models.ForeignKey(GeolocCountries, db_column='nationality2', blank=True, null=True) + nationality3 = models.ForeignKey(GeolocCountries, db_column='nationality3', blank=True, null=True) + email_directory = models.CharField(max_length=255, blank=True, null=True) + last_change = models.DateField() + title = models.CharField(max_length=4) + + class Meta: + managed = False + db_table = 'profiles' + + +class RegisterMarketing(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + sender = models.ForeignKey(Accounts, db_column='sender', blank=True, null=True) + email = models.CharField(max_length=255) + date = models.DateField() + last = models.DateField() + nb = models.IntegerField() + type = models.CharField(max_length=5, blank=True, null=True) + hash = models.CharField(max_length=32) + message = models.CharField(max_length=16) + message_data = models.CharField(max_length=64, blank=True, null=True) + personal_notes = models.TextField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'register_marketing' + + +class RegisterMstats(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + sender = models.ForeignKey(Accounts, db_column='sender', blank=True, null=True) + success = models.DateField() + + class Meta: + managed = False + db_table = 'register_mstats' + + +class RegisterPending(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + forlife = models.CharField(unique=True, max_length=255) + bestalias = models.CharField(unique=True, max_length=255) + mailorg2 = models.CharField(max_length=255, blank=True, null=True) + password = models.CharField(max_length=40) + email = models.CharField(max_length=255) + date = models.DateField() + relance = models.DateField() + naissance = models.DateField() + hash = models.CharField(max_length=12) + services = models.CharField(max_length=38) + + class Meta: + managed = False + db_table = 'register_pending' + + +class RegisterPendingXnet(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + hruid = models.ForeignKey(Accounts, db_column='hruid', unique=True) + email = models.CharField(max_length=255) + date = models.DateField() + last_date = models.DateField(blank=True, null=True) + hash = models.CharField(max_length=12) + sender_name = models.CharField(max_length=255) + group_name = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'register_pending_xnet' + + +class RegisterSubs(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + type = models.CharField(max_length=5) + sub = models.CharField(max_length=32) + domain = models.CharField(max_length=64) + + class Meta: + managed = False + db_table = 'register_subs' + + +class Reminder(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + type = models.ForeignKey('ReminderType') + status = models.CharField(max_length=7) + remind_last = models.DateTimeField() + remind_next = models.DateTimeField(blank=True, null=True) + + class Meta: + managed = False + db_table = 'reminder' + + +class ReminderTips(models.Model): + id = models.SmallIntegerField(primary_key=True) + title = models.CharField(max_length=64) + text = models.TextField() + priority = models.IntegerField() + expiration = models.DateField() + promo_min = models.SmallIntegerField() + promo_max = models.SmallIntegerField() + state = models.CharField(max_length=6) + + class Meta: + managed = False + db_table = 'reminder_tips' + + +class ReminderType(models.Model): + type_id = models.AutoField(primary_key=True) + name = models.CharField(unique=True, max_length=255) + weight = models.IntegerField() + remind_delay_yes = models.IntegerField() + remind_delay_no = models.IntegerField() + remind_delay_dismiss = models.IntegerField() + + class Meta: + managed = False + db_table = 'reminder_type' + + +class Requests(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + type = models.CharField(max_length=16) + data = models.TextField() + stamp = models.DateTimeField() + pid = models.ForeignKey(Profiles, db_column='pid', blank=True, null=True) + + class Meta: + managed = False + db_table = 'requests' + + +class RequestsAnswers(models.Model): + category = models.CharField(max_length=16) + title = models.CharField(max_length=50) + answer = models.TextField() + + class Meta: + managed = False + db_table = 'requests_answers' + + +class RequestsHidden(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + hidden_requests = models.TextField() + + class Meta: + managed = False + db_table = 'requests_hidden' + + +class SearchAutocomplete(models.Model): + name = models.CharField(max_length=20) + query = models.CharField(max_length=100) + result = models.TextField() + generated = models.DateTimeField() + + class Meta: + managed = False + db_table = 'search_autocomplete' + + +class SearchName(models.Model): + pid = models.ForeignKey(Profiles, db_column='pid') + token = models.CharField(max_length=255) + score = models.IntegerField() + soundex = models.CharField(max_length=4) + flags = models.CharField(max_length=6) + general_type = models.CharField(max_length=9) + + class Meta: + managed = False + db_table = 'search_name' + + +class Skins(models.Model): + id = models.IntegerField(primary_key=True) + name = models.CharField(max_length=32) + date = models.DateField() + comment = models.CharField(max_length=255) + auteur = models.CharField(max_length=30) + skin_tpl = models.CharField(max_length=32) + ext = models.CharField(max_length=3) + + class Meta: + managed = False + db_table = 'skins' + + +class SurveyAnswers(models.Model): + vote = models.ForeignKey('SurveyVotes') + question_id = models.SmallIntegerField() + answer = models.TextField() + + class Meta: + managed = False + db_table = 'survey_answers' + + +class SurveyVotes(models.Model): + id = models.SmallIntegerField(primary_key=True) + survey = models.ForeignKey('Surveys') + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + + class Meta: + managed = False + db_table = 'survey_votes' + + +class Surveys(models.Model): + id = models.SmallIntegerField(primary_key=True) + questions = models.TextField() + title = models.CharField(max_length=255) + description = models.TextField() + uid = models.ForeignKey(Accounts, db_column='uid', blank=True, null=True) + end = models.DateField() + mode = models.IntegerField() + promos = models.CharField(max_length=255) + + class Meta: + managed = False + db_table = 'surveys' + + +class T(models.Model): + a = models.IntegerField() + + class Meta: + managed = False + db_table = 't' + + +class UrlShortener(models.Model): + alias = models.CharField(primary_key=True, max_length=255) + url = models.TextField() + + class Meta: + managed = False + db_table = 'url_shortener' + + +class Watch(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid', primary_key=True) + flags = models.CharField(max_length=13) + actions = models.CharField(max_length=35) + last = models.DateTimeField() + + class Meta: + managed = False + db_table = 'watch' + + +class WatchGroup(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + groupid = models.ForeignKey(Groups, db_column='groupid') + + class Meta: + managed = False + db_table = 'watch_group' + + +class WatchNonins(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + ni = models.ForeignKey(Accounts) + + class Meta: + managed = False + db_table = 'watch_nonins' + + +class WatchProfile(models.Model): + pid = models.ForeignKey(Profiles, db_column='pid') + ts = models.DateTimeField() + field = models.CharField(max_length=12) + + class Meta: + managed = False + db_table = 'watch_profile' + + +class WatchPromo(models.Model): + uid = models.ForeignKey(Accounts, db_column='uid') + promo = models.IntegerField() + + class Meta: + managed = False + db_table = 'watch_promo' diff --git a/database/platal/models.py b/database/platal/models.py index 41f66a3..2339bc1 100644 --- a/database/platal/models.py +++ b/database/platal/models.py @@ -408,7 +408,7 @@ class AccountProfile(models.Model): class Meta: db_table = 'account_profiles' - unique_together = (('uid', 'pid'),) + unique_together = (('account', 'profile'),) def __str__(self): return '%s -> %s' % (self.account.hruid, self.profile.hrpid) @@ -504,7 +504,7 @@ class AnnounceRead(models.Model): class Meta: db_table = 'announce_read' - unique_together = (('evt', 'uid'),) + unique_together = (('evt', 'account'),) def __str__(self): return "%s: %s" % (self.account, self.evt) @@ -546,7 +546,7 @@ class EmailRedirectAccount(models.Model): class Meta: db_table = 'email_redirect_account' - unique_together = (('uid', 'redirect'),) + unique_together = (('account', 'redirect'),) def __str__(self): return "%s for %s (%s)" % (self.redirect, self.account.hruid, self.type) @@ -660,7 +660,7 @@ class ForumSubs(models.Model): class Meta: db_table = 'forum_subs' - unique_together = (('fid', 'uid'),) + unique_together = (('forum', 'account'),) def __str__(self): return "%s by %s" % (self.forum.name, self.account.hruid) @@ -959,7 +959,7 @@ class GroupAnnounceRead(models.Model): class Meta: db_table = 'group_announces_read' - unique_together = (('announce', 'uid'),) + unique_together = (('announce', 'account'),) def __str__(self): return "%s: %s" % (self.account.hruid, self.announce_id) @@ -1004,7 +1004,7 @@ class GroupEventItem(models.Model): class Meta: db_table = 'group_event_items' - unique_together = (('eid', 'item_id'),) + unique_together = (('event', 'item_id'),) def __str__(self): return "%s - %s" % (self.event, self.item_id) @@ -1021,7 +1021,7 @@ class GroupEventParticipant(models.Model): class Meta: db_table = 'group_event_participants' - unique_together = (('eid', 'uid', 'item_id'),) + unique_together = (('event', 'account', 'item_id'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.item) @@ -1213,7 +1213,7 @@ class NewsletterIns(models.Model): class Meta: db_table = 'newsletter_ins' - unique_together = (('uid', 'nlid'),) + unique_together = (('account', 'nlid'),) def __str__(self): return "%s to %s" % (self.account.hruid, self.nl.title) @@ -1277,7 +1277,7 @@ class ProfilePhone(models.Model): class Meta: db_table = 'profile_phones' - unique_together = (('pid', 'link_type', 'link_id', 'tel_id'),) + unique_together = (('profile', 'link_type', 'link_id', 'tel_id'),) def __str__(self): return "%s: %s (%s)" % (self.profile.hrpid, self.display_tel, self.tel_type) @@ -1321,7 +1321,7 @@ class ProfilePrivateName(models.Model): class Meta: db_table = 'profile_private_names' - unique_together = (('pid', 'type', 'id'),) + unique_together = (('profile', 'type', 'id'),) def __str__(self): return "%s: %s" % (self.profile.hrpid, self.type) @@ -1394,7 +1394,7 @@ class ProfileAddress(models.Model): class Meta: db_table = 'profile_addresses' - unique_together = (('pid', 'jobid', 'groupid', 'type', 'id'),) + unique_together = (('profile', 'jobid', 'groupid', 'type', 'id'),) def __str__(self): if self.addr_type == self.KIND_HOME: @@ -1478,7 +1478,7 @@ class ProfileAddressComponent(models.Model): class Meta: db_table = 'profile_addresses_components' - unique_together = (('pid', 'jobid', 'groupid', 'type', 'id'),) + unique_together = (('profile', 'jobid', 'groupid', 'type', 'id'),) def __str__(self): return "%s (%s) for %s" % ( @@ -1507,7 +1507,7 @@ class ProfileBinet(models.Model): class Meta: db_table = 'profile_binets' - unique_together = (('pid', 'binet'),) + unique_together = (('profile', 'binet'),) class ProfileHobby(models.Model): @@ -1519,7 +1519,7 @@ class ProfileHobby(models.Model): class Meta: db_table = 'profile_hobby' - unique_together = (('pid', 'id'),) + unique_together = (('profile', 'id'),) class ProfileNetworkingEnum(models.Model): @@ -1543,7 +1543,7 @@ class ProfileNetworking(models.Model): class Meta: db_table = 'profile_networking' - unique_together = (('pid', 'nwid'),) + unique_together = (('profile', 'nwid'),) # Profile::corps @@ -1724,7 +1724,7 @@ class ProfileJob(models.Model): class Meta: db_table = 'profile_job' - unique_together = (('pid', 'id'),) + unique_together = (('profile', 'id'),) @property def ax_visible(self): @@ -1792,7 +1792,7 @@ class ProfileJobTerm(models.Model): class Meta: db_table = 'profile_job_term' - unique_together = (('pid', 'jid', 'jtid'),) + unique_together = (('profile', 'jid', 'jtid'),) def __str__(self): return "%s at %s: %s" % (self.profile.hrpid, self.company.name, self.job_term.name) @@ -1838,7 +1838,7 @@ class ProfileLangSkill(models.Model): class Meta: db_table = 'profile_langskills' - unique_together = (('pid', 'lid'),) + unique_together = (('profile', 'lid'),) def __str__(self): return "%s: %s" % (self.profile.hrpid, self.lang.iso_639_2b) @@ -1867,7 +1867,7 @@ class ProfileSkill(models.Model): class Meta: db_table = 'profile_skills' - unique_together = (('pid', 'cid'),) + unique_together = (('profile', 'cid'),) def __str__(self): return "%s: %s" % (self.profile.hrpid, self.skill.text_en) @@ -1907,7 +1907,7 @@ class ProfileMedal(models.Model): class Meta: db_table = 'profile_medals' - unique_together = (('pid', 'medal', 'gid'),) + unique_together = (('profile', 'medal', 'gid'),) # Profile::mentor @@ -1928,7 +1928,7 @@ class ProfileMentorCountry(models.Model): class Meta: db_table = 'profile_mentor_country' - unique_together = (('pid', 'country'),) + unique_together = (('profile', 'country'),) class ProfileMentorTerm(models.Model): @@ -1937,7 +1937,7 @@ class ProfileMentorTerm(models.Model): class Meta: db_table = 'profile_mentor_term' - unique_together = (('pid', 'jtid'),) + unique_together = (('profile', 'jtid'),) # Profile::partner @@ -1968,7 +1968,7 @@ class ProfilePartnersharingSetting(models.Model): class Meta: db_table = 'profile_partnersharing_settings' - unique_together = (('pid', 'partner'),) + unique_together = (('profile', 'partner'),) class ProfilePhotoToken(models.Model): @@ -2007,7 +2007,7 @@ class ProfileModification(models.Model): class Meta: db_table = 'profile_modifications' - unique_together = (('pid', 'field'),) + unique_together = (('profile', 'field'),) class ProfileVisibilityEnum(models.Model): @@ -2053,7 +2053,7 @@ class Reminder(models.Model): class Meta: db_table = 'reminder' - unique_together = (('uid', 'type'),) + unique_together = (('account', 'type'),) class ReminderTip(models.Model): @@ -2200,7 +2200,7 @@ class WatchGroup(models.Model): class Meta: db_table = 'watch_group' - unique_together = (('uid', 'groupid'),) + unique_together = (('account', 'groupid'),) class WatchNonins(models.Model): @@ -2209,7 +2209,7 @@ class WatchNonins(models.Model): class Meta: db_table = 'watch_nonins' - unique_together = (('uid', 'ni'),) + unique_together = (('account', 'ni'),) class WatchProfile(models.Model): @@ -2219,7 +2219,7 @@ class WatchProfile(models.Model): class Meta: db_table = 'watch_profile' - unique_together = (('pid', 'field'),) + unique_together = (('profile', 'field'),) class WatchPromo(models.Model): @@ -2228,7 +2228,7 @@ class WatchPromo(models.Model): class Meta: db_table = 'watch_promo' - unique_together = (('uid', 'promo'),) + unique_together = (('account', 'promo'),) # Postfix @@ -2290,7 +2290,7 @@ class RegisterMarketing(models.Model): class Meta: db_table = 'register_marketing' - unique_together = (('uid', 'email'),) + unique_together = (('account', 'email'),) class RegisterMstat(models.Model): @@ -2341,7 +2341,7 @@ class RegisterSubs(models.Model): class Meta: db_table = 'register_subs' - unique_together = (('uid', 'type', 'sub', 'domain'),) + unique_together = (('account', 'type', 'sub', 'domain'),) # Search @@ -2369,7 +2369,7 @@ class SearchName(models.Model): class Meta: db_table = 'search_name' - unique_together = (('pid', 'token'),) + unique_together = (('profile', 'token'),) # Requests @@ -2385,7 +2385,7 @@ class Request(models.Model): class Meta: db_table = 'requests' - unique_together = (('uid', 'stamp', 'type'),) + unique_together = (('account', 'stamp', 'type'),) class RequestAnswer(models.Model): @@ -2443,7 +2443,7 @@ class Contact(models.Model): class Meta: db_table = 'contacts' - unique_together = (('uid', 'contact'),) + unique_together = (('account', 'contact'),) class Downtime(models.Model): -- 2.1.4