from django.utils import timezone | from django.utils import timezone | ||||
from taggit.managers import TaggableManager | from taggit.managers import TaggableManager | ||||
class CustomUser(models.Model): | class CustomUser(models.Model): | ||||
user = models.OneToOneField('auth.User', null = True, on_delete=models.CASCADE) | |||||
user = models.OneToOneField( | |||||
'auth.User', null=True, on_delete=models.CASCADE) | |||||
tags = TaggableManager() | tags = TaggableManager() | ||||
self.save() | self.save() | ||||
def __str__(self): | def __str__(self): | ||||
return self.title | |||||
return self.title |
import operator | import operator | ||||
# Create your views here. | |||||
def navlogin(request): | def navlogin(request): | ||||
log = logging.getLogger('medinf') | |||||
log = logging.getLogger('mysite') | |||||
logout(request) | logout(request) | ||||
error = "" | error = "" | ||||
if request.POST: | if request.POST: | ||||
@login_required | @login_required | ||||
def tag_list(request): | def tag_list(request): | ||||
log = logging.getLogger('mysite') | |||||
u = CustomUser.objects.get(user=request.user) | u = CustomUser.objects.get(user=request.user) | ||||
tags= Tag.objects.filter(customuser=u) | tags= Tag.objects.filter(customuser=u) | ||||
arr=[] | arr=[] | ||||
arr.append(tags) | arr.append(tags) | ||||
log.info("test".format(arr)) | |||||
""" | """ | ||||
for tag in tags: | for tag in tags: | ||||
arr.append(str(tag)) | arr.append(str(tag)) | ||||
""" | """ | ||||
listing = list(arr) | listing = list(arr) | ||||
return render(request, 'tag_list.html', {'tags':tags}) | |||||
return render(request, 'tag_list.html', locals()) | |||||
class TagSearch(TagCanvasListView): | class TagSearch(TagCanvasListView): |
[16/Oct/2018 19:58:49] INFO [mysite:150] test | |||||
[16/Oct/2018 20:00:13] INFO [mysite:150] test | |||||
[16/Oct/2018 20:00:44] INFO [mysite:150] test |
'django.contrib.auth.backends.ModelBackend', | 'django.contrib.auth.backends.ModelBackend', | ||||
'mysite.ldap_backend.LdapBackend', | 'mysite.ldap_backend.LdapBackend', | ||||
] | ] | ||||
print(" --- Live stage --- ") | |||||
print(" --- Live stage --- ") | |||||
#Log Configuration | |||||
LOGGING = { | |||||
'version': 1, | |||||
'disable_existing_loggers': True, | |||||
'formatters': { | |||||
'standard': { | |||||
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", | |||||
'datefmt' : "%d/%b/%Y %H:%M:%S" | |||||
}, | |||||
}, | |||||
'handlers': { | |||||
'null': { | |||||
'level':'DEBUG', | |||||
'class':'logging.NullHandler', | |||||
}, | |||||
'logfile': { | |||||
'level':'DEBUG', | |||||
'class':'logging.handlers.RotatingFileHandler', | |||||
'filename': os.path.join(BASE_DIR, 'log.txt'), | |||||
'maxBytes': 50000, | |||||
'backupCount': 2, | |||||
'formatter': 'standard', | |||||
}, | |||||
'console':{ | |||||
'level':'INFO', | |||||
'class':'logging.StreamHandler', | |||||
'formatter': 'standard' | |||||
}, | |||||
}, | |||||
'loggers': { | |||||
'django': { | |||||
'handlers':['console'], | |||||
'propagate': True, | |||||
'level':'WARN', | |||||
}, | |||||
'django.db.backends': { | |||||
'handlers': ['console'], | |||||
'level': 'DEBUG', | |||||
'propagate': False, | |||||
}, | |||||
'mysite': { | |||||
'handlers': ['console', 'logfile'], | |||||
'level': 'DEBUG', | |||||
}, | |||||
} | |||||
} |