Blame view

ponto/__init__.py 1.05 KB
d236378cd   Denis Ricardo da Silva Medeiros   Mesclando arquivo...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  from django.contrib.auth.management import create_superuser
  from django.db.models import signals
  from django.contrib.auth import models as auth_models
  from django.conf import settings
  
  from django.contrib.auth import get_user_model
  from models import *
  
  from datetime import datetime
  
  User = Funcionario
  
  
  signals.post_syncdb.disconnect(
      create_superuser,
      sender=auth_models,
      dispatch_uid='django.contrib.auth.management.create_superuser'
  )
  
  def create_admin(app, created_models, verbosity, **kwargs):
      
      usuario = 'admin'
      email = 'admin@museuvirtual.info'
      senha = '123'
      
      try:
          User.objects.get(username='admin')
      except User.DoesNotExist:
          print ""
          print '#' * 80
          print 'Creating admin user -- login: %s, password: %s' %(usuario, senha)
          print '#' * 80
          print ""
          assert User.objects.create_superuser(usuario, 'yyyyy', email, datetime.now(), datetime.now(), senha)
  
  
  signals.post_syncdb.connect(
      create_admin,
      sender=auth_models,
      dispatch_uid='apps.auth.models.create_admin'
  )