Commit f90d447a1ce943b1716139ff310097d8681a32a1

Authored by Matheus Fernandes
1 parent d8862cb9

Created model to community associations

Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com>
Showing 1 changed file with 21 additions and 1 deletions   Show diff stats
colab_spb/models.py
1   -# from django.db import models
  1 +from colab.super_archives import models as mailman
  2 +from django.conf import settings
  3 +from django.db import models
  4 +import importlib
  5 +from sys import modules
2 6  
3 7 # Create your models here.
  8 +# Import plugins models
  9 +for app in settings.COLAB_APPS:
  10 + if app != 'colab_spb':
  11 + plugin_name = app.split('.')[-1]
  12 + # Create alias to plugins
  13 + exec "%s = importlib.import_module('%s.models')" % (plugin_name, app)
  14 +
  15 +
  16 +class CommunityAssociations(models.Model):
  17 + community = models.ForeignKey(noosfero.NoosferoCommunity) \
  18 + if 'noosfero' in modules else None
  19 +
  20 + repository = models.ForeignKey(gitlab.GitlabProject) \
  21 + if 'gitlab' in modules else None
  22 +
  23 + mail_list = models.ForeignKey(mailman.MailingList, null=True)
... ...