Commit 178eeb2a authored by Giannis Tsapelas's avatar Giannis Tsapelas
Browse files

added django admin

parent 95e2239d
......@@ -5,26 +5,22 @@ from django.contrib import admin
from aggregator.models import *
class DimensionAdmin(admin.ModelAdmin):
list_display = ('title', 'source', 'description', 'stored_at')
list_filter = ('stored_at', )
class DatasetAdmin(admin.ModelAdmin):
pass
admin.site.register(Dataset, DimensionAdmin)
admin.site.register(Dataset, DatasetAdmin)
class DimensionAdmin(admin.ModelAdmin):
list_display = ('title', 'name', 'unit', 'min', 'max', 'step', 'variable', 'dataset', )
def dataset(self, obj):
return obj.variable.dataset
pass
admin.site.register(Dimension, DimensionAdmin)
class VariableAdmin(admin.ModelAdmin):
list_display = ('title', 'name', 'unit', 'dataset', )
pass
admin.site.register(Variable, VariableAdmin)
......@@ -25,6 +25,7 @@ python manage.py loaddata datasets.json
echo "Setting up Keycloak"
python manage.py setup_keycloak
python manage.py initadmin
echo "Starting the server..."
......
......@@ -53,7 +53,7 @@ python manage.py loaddata datasets.json
echo "Setting up Keycloak"
python manage.py setup_keycloak
python manage.py initadmin
echo "Starting the server..."
gunicorn cybele_advanced_query_builder.wsgi:application --bind 0.0.0.0:80 --workers=${WEB_CONCURRENCY}
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Register your models here.
from django.contrib import admin
from query_designer.models import *
#
# class TempQueryAdmin(admin.ModelAdmin):
# list_display = [field.name for field in TempQuery._meta.get_fields()]
class AbstractQueryAdmin(admin.ModelAdmin):
pass
admin.site.register(AbstractQuery, AbstractQueryAdmin)
class QueryAdmin(admin.ModelAdmin):
pass
admin.site.register(Query, QueryAdmin)
class TempQueryAdmin(admin.ModelAdmin):
pass
# admin.site.register(TempQuery, TempQueryAdmin)
admin.site.register(TempQuery, TempQueryAdmin)
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.contrib.auth.models import User
class Command(BaseCommand):
def handle(self, *args, **options):
if User.objects.filter(username='admin').count() == 0:
username = 'admin'
password = 'admin'
email = 'admin@cybele.eu'
admin = User.objects.create_superuser(email=email, username=username, password=password)
admin.is_active = True
admin.is_admin = True
admin.save()
else:
pass
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