New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models #11

Merged
merged 6 commits into from Jun 19, 2017

feat(models): Add admin files for each model

  • Loading branch information...
uttu357 committed Jun 15, 2017
commit 899912f8d9c5c0583ebb3f569a5ed93af21b3f21
Copy path View file
@@ -0,0 +1,5 @@
from django.contrib import admin
class TimeStampedAdmin(admin.ModelAdmin):
exclude = ('created_at', 'modified_at',)
Copy path View file
@@ -0,0 +1,10 @@
from django.contrib import admin
from .models import Demo
@admin.register(Demo)
class DemoAdmin(admin.ModelAdmin):
list_display = ("title", "tag_line", "is_disabled",)

This comment has been minimized.

@deshraj

deshraj Jun 19, 2017

Member

Minor point: Can we use single quotes instead of using double quotes everywhere in the codebase? (Just to make sure that we follow the same pattern in all the projects)

list_filter = ("is_disabled",)
search_fields = ("title",)
Copy path View file
@@ -0,0 +1,24 @@
from django.contrib import admin
from base.admin import TimeStampedAdmin
from .models import DemoLog, LogImage, LogText
@admin.register(DemoLog)
class DemoLogAdmin(TimeStampedAdmin):
list_display = ("demo", "log_type",)
list_filter = ("log_type",)
@admin.register(LogImage)
class LogImageAdmin(admin.ModelAdmin):
list_filter = ("demo_log", "image_type",)
list_display = ("demo_log", "image", "image_type",)
@admin.register(LogText)
class LogTextAdmin(admin.ModelAdmin):
list_filter = ("demo_log", "text_type",)
list_display = ("demo_log", "text", "text_type",)
search_fields = ("text",)
Copy path View file
@@ -0,0 +1,19 @@
from django.contrib import admin
from base.admin import TimeStampedAdmin
from .models import Contact, Team
@admin.register(Contact)
class ContactAdmin(TimeStampedAdmin):
list_display = ("name", "email", "message",)
list_filter = ("email",)
search_fields = ("email",)
@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
list_filter = ("team_type",)
list_display = ("name", "email", "team_type",)
search_fields = ("email", "name",)
@@ -1,4 +1,5 @@
from settings.common import * # noqa: ignore=F405
import os
from ..common import * # noqa: ignore=F405
DEBUG = True
@@ -10,7 +11,7 @@
'NAME': "postgres",
'USER': "postgres",
'PASSWORD': "postgres",
'HOST': "db",
'HOST': os.environ.get('DEV_DB_HOST', "db"),
'PORT': "5432",
}
}
ProTip! Use n and p to navigate between commits in a pull request.