コード例 #1
0
ファイル: mixins.py プロジェクト: okazdal/openwisp-radius
 def _create_org(self, **kwargs):
     options = dict(name='default', slug='default')
     options.update(kwargs)
     try:
         org = Organization.objects.get(**options)
     except Organization.DoesNotExist:
         org = Organization(**options)
         org.full_clean()
         org.save()
     return org
コード例 #2
0
 def _create_organization(self, **kwargs):
     options = dict(name='org1')
     options.update(kwargs)
     options.setdefault('slug', slugify(options['name']))
     if not Organization.objects.filter(**kwargs).count():
         org = Organization(**options)
         org.full_clean()
         org.save()
     else:
         org = Organization.objects.get(**kwargs)
     return org