Commit 10bdab18 authored by delanoe's avatar delanoe

[FIX] Account creation with default values for database (tested in docker).

parent 57db20b1
from django.contrib.auth import models from django.contrib.auth import models
from gargantext.util.db import * from gargantext.util.db import *
from datetime import datetime
__all__ = ['User'] __all__ = ['User']
class User(Base): class User(Base):
# Do not change!
# The properties below are a reflection of Django's auth module's models. # The properties below are a reflection of Django's auth module's models.
__tablename__ = models.User._meta.db_table __tablename__ = models.User._meta.db_table
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
password = Column(String(128)) password = Column(String(128))
last_login = DateTime(timezone=False)
is_superuser = Column(Boolean(), default=False) is_superuser = Column(Boolean(), default=False)
username = Column(String(30)) is_staff = Column(Boolean(), default=False)
first_name = Column(String(30)) username = Column(String(30))
last_name = Column(String(30)) first_name = Column(String(30), default="")
email = Column(String(75)) last_name = Column(String(30), default="")
is_staff = Column(Boolean()) email = Column(String(75))
is_active = Column(Boolean()) is_active = Column(Boolean(), default=True)
date_joined = DateTime(timezone=False) last_login = Column(DateTime(timezone=False))
date_joined = Column(DateTime(timezone=False), default=datetime.now)
def contacts(self): def contacts(self):
"""get all contacts in relation with the user""" """get all contacts in relation with the user"""
......
...@@ -73,7 +73,6 @@ def create_user(username, email, user=None, password=None, active=False, notify= ...@@ -73,7 +73,6 @@ def create_user(username, email, user=None, password=None, active=False, notify=
if user is None: if user is None:
user = User() user = User()
user.username = username user.username = username
user.first_name = username
user.email = email user.email = email
user.is_active = True user.is_active = True
if password is None or password == "": if password is None or password == "":
...@@ -83,7 +82,8 @@ def create_user(username, email, user=None, password=None, active=False, notify= ...@@ -83,7 +82,8 @@ def create_user(username, email, user=None, password=None, active=False, notify=
session.commit() session.commit()
if notify == True: if notify == True:
notify_user(username, email, password) pass
#notify_user(username, email, password)
return user return user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment