try setting up to move to postgres

This commit is contained in:
Sanjay Bhangar 2017-06-10 17:35:37 +05:30
parent 8c2c532ce7
commit c728d55216
3 changed files with 131 additions and 69 deletions

View File

@ -9,7 +9,17 @@ from models import *
class ContentParentsInline(admin.TabularInline):
model = ContentContent
fk_name = 'contentid1'
fk_name = 'contentid2'
class ImagesInline(admin.StackedInline):
model = Image
class FileInline(admin.StackedInline):
model = File
class LinkInline(admin.StackedInline):
model = Link
'''
class SubdomainInline(admin.StackedInline):
model = Subdomain
@ -26,7 +36,7 @@ class ContentAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'datestart', 'type')
list_filter = ['datestart', 'type']
search_fields = ['title', 'body', 'header']
inlines = [ContentParentsInline]
inlines = [ContentParentsInline, ImagesInline, FileInline, LinkInline]
# inlines = [SubdomainInline, DomainAliasInline]
# list_display = ('url', 'server', 'manage_nameserver', 'domain_registrar', 'email', 'is_active')

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-23 09:35
# Generated by Django 1.11.1 on 2017-06-10 11:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
@ -21,7 +22,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'acrolike',
'managed': False,
},
),
migrations.CreateModel(
@ -36,7 +36,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'acronym',
'managed': False,
},
),
migrations.CreateModel(
@ -49,7 +48,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'audios',
'managed': False,
},
),
migrations.CreateModel(
@ -68,19 +66,47 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'comments',
'managed': False,
},
),
migrations.CreateModel(
name='Content',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('shortname', models.CharField(db_column='shortName', max_length=255)),
('title', models.CharField(max_length=255)),
('header', models.TextField(blank=True, null=True)),
('body', models.TextField(blank=True, null=True)),
('schedule', models.TextField(blank=True, null=True)),
('schedulebutton', models.CharField(blank=True, db_column='scheduleButton', max_length=255, null=True)),
('optbtn2', models.CharField(blank=True, db_column='optBtn2', max_length=127, null=True)),
('opttext2', models.TextField(blank=True, db_column='optText2', null=True)),
('optbtn3', models.CharField(blank=True, db_column='optBtn3', max_length=127, null=True)),
('opttext3', models.TextField(blank=True, db_column='optText3', null=True)),
('technotes', models.TextField(blank=True, db_column='technotes', null=True)),
('image', models.CharField(blank=True, max_length=150, null=True)),
('postedby', models.CharField(blank=True, db_column='postedBy', max_length=50, null=True)),
('datestart', models.DateField(blank=True, db_column='dateStart', null=True)),
('dateend', models.DateField(blank=True, db_column='dateEnd', null=True)),
('dateadded', models.DateTimeField(db_column='dateAdded')),
('datemodified', models.DateTimeField(blank=True, db_column='dateModified', null=True)),
('published', models.IntegerField()),
('place', models.CharField(blank=True, max_length=255, null=True)),
('parentid', models.IntegerField(blank=True, db_column='parentID', null=True)),
],
options={
'db_table': 'content',
'managed': True,
},
),
migrations.CreateModel(
name='ContentContent',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('contentid1', models.IntegerField(db_column='contentID1')),
('contentid2', models.IntegerField(db_column='contentID2')),
('contentid1', models.ForeignKey(db_column='contentID1', on_delete=django.db.models.deletion.CASCADE, related_name='child', to='content.Content')),
('contentid2', models.ForeignKey(db_column='contentID2', on_delete=django.db.models.deletion.CASCADE, related_name='parent', to='content.Content')),
],
options={
'db_table': 'content_content',
'managed': False,
},
),
migrations.CreateModel(
@ -92,7 +118,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'content_keyword',
'managed': False,
},
),
migrations.CreateModel(
@ -104,7 +129,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'content_resource',
'managed': False,
},
),
migrations.CreateModel(
@ -116,9 +140,30 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'content_types',
'managed': False,
},
),
migrations.CreateModel(
name='File',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('fil', models.FileField(upload_to='files')),
('description', models.TextField(blank=True, null=True)),
('date', models.DateTimeField(auto_now_add=True)),
('order', models.IntegerField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='content.Content')),
],
),
migrations.CreateModel(
name='Image',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(upload_to='images')),
('description', models.TextField(blank=True, null=True)),
('date', models.DateTimeField(auto_now_add=True)),
('order', models.IntegerField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='content.Content')),
],
),
migrations.CreateModel(
name='Keywords',
fields=[
@ -128,9 +173,19 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'keywords',
'managed': False,
},
),
migrations.CreateModel(
name='Link',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField()),
('description', models.TextField(blank=True, null=True)),
('date', models.DateTimeField(auto_now_add=True)),
('order', models.IntegerField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='content.Content')),
],
),
migrations.CreateModel(
name='People',
fields=[
@ -146,7 +201,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'people',
'managed': False,
},
),
migrations.CreateModel(
@ -159,7 +213,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'person_content',
'managed': False,
},
),
migrations.CreateModel(
@ -171,7 +224,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'person_resource',
'managed': False,
},
),
migrations.CreateModel(
@ -185,12 +237,11 @@ class Migration(migrations.Migration):
('width', models.IntegerField(blank=True, null=True)),
('height', models.IntegerField(blank=True, null=True)),
('istech', models.IntegerField(db_column='isTech')),
('dateadded', models.DateTimeField(db_column='dateAdded')),
('dateadded', models.DateTimeField(blank=True, db_column='dateAdded', null=True)),
('orderno', models.IntegerField(blank=True, db_column='orderNo', null=True)),
],
options={
'db_table': 'resources',
'managed': False,
},
),
migrations.CreateModel(
@ -210,7 +261,6 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'videos',
'managed': False,
},
),
migrations.CreateModel(
@ -222,39 +272,21 @@ class Migration(migrations.Migration):
],
options={
'db_table': 'views',
'managed': False,
},
),
migrations.CreateModel(
name='Content',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('shortname', models.CharField(db_column='shortName', max_length=255)),
('title', models.CharField(max_length=255)),
('header', models.TextField(blank=True, null=True)),
('body', models.TextField(blank=True, null=True)),
('schedule', models.TextField(blank=True, null=True)),
('schedulebutton', models.CharField(blank=True, db_column='scheduleButton', max_length=255, null=True)),
('optbtn2', models.CharField(blank=True, db_column='optBtn2', max_length=127, null=True)),
('opttext2', models.TextField(blank=True, db_column='optText2', null=True)),
('optbtn3', models.CharField(blank=True, db_column='optBtn3', max_length=127, null=True)),
('opttext3', models.TextField(blank=True, db_column='optText3', null=True)),
('technotes', models.TextField()),
('image', models.CharField(blank=True, max_length=150, null=True)),
('postedby', models.CharField(blank=True, db_column='postedBy', max_length=50, null=True)),
('datestart', models.DateField(blank=True, db_column='dateStart', null=True)),
('dateend', models.DateField(blank=True, db_column='dateEnd', null=True)),
('dateadded', models.DateTimeField(db_column='dateAdded')),
('datemodified', models.DateTimeField(blank=True, db_column='dateModified', null=True)),
('type', models.IntegerField()),
('published', models.IntegerField()),
('view', models.IntegerField(blank=True, null=True)),
('place', models.CharField(max_length=255)),
('parentid', models.IntegerField(db_column='parentId')),
],
options={
'db_table': 'content',
'managed': True,
},
migrations.AddField(
model_name='content',
name='parents',
field=models.ManyToManyField(related_name='children', through='content.ContentContent', to='content.Content'),
),
migrations.AddField(
model_name='content',
name='type',
field=models.ForeignKey(db_column='type', on_delete=django.db.models.deletion.CASCADE, to='content.ContentTypes'),
),
migrations.AddField(
model_name='content',
name='view',
field=models.ForeignKey(blank=True, db_column='view', null=True, on_delete=django.db.models.deletion.CASCADE, to='content.Views'),
),
]

View File

@ -9,7 +9,7 @@ class Acrolike(models.Model):
title = models.CharField(max_length=255)
class Meta:
managed = False
# managed = False
db_table = 'acrolike'
@ -21,7 +21,7 @@ class Acronym(models.Model):
p = models.CharField(max_length=50, blank=True, null=True)
class Meta:
managed = False
# managed = False
db_table = 'acronym'
@ -31,7 +31,7 @@ class Audios(models.Model):
description = models.TextField(blank=True, null=True)
class Meta:
managed = False
# managed = False
db_table = 'audios'
@ -48,7 +48,7 @@ class Comments(models.Model): #not used
ip = models.CharField(db_column='IP', max_length=50, blank=True, null=True) # Field name made lowercase.
class Meta:
managed = False
# managed = False
db_table = 'comments'
@ -74,7 +74,7 @@ class Content(models.Model):
published = models.IntegerField()
view = models.ForeignKey("Views", null=True, blank=True, db_column="view")
place = models.CharField(max_length=255, null=True, blank=True)
parentid = models.ForeignKey("Content", null=True, db_column='parentID', blank=True, limit_choices_to={'type_id': 3}, related_name="please_run") # Field name made lowercase.
parentid = models.IntegerField(null=True, db_column='parentID', blank=True) # Field name made lowercase.
parents = models.ManyToManyField('Content', through='ContentContent', related_name= "children")
def __unicode__(self):
@ -94,7 +94,7 @@ class ContentContent(models.Model):
return "%s is child of %s" % (self.contentid1.title, self.contentid2.title,)
class Meta:
managed = False
# managed = False
db_table = 'content_content'
@ -103,7 +103,7 @@ class ContentKeyword(models.Model):
keywordid = models.IntegerField(db_column='keywordID') # Field name made lowercase.
class Meta:
managed = False
# managed = False
db_table = 'content_keyword'
@ -112,7 +112,7 @@ class ContentResource(models.Model):
resourceid = models.IntegerField(db_column='resourceID') # Field name made lowercase.
class Meta:
managed = False
# managed = False
db_table = 'content_resource'
@ -125,7 +125,7 @@ class ContentTypes(models.Model):
return self.name
class Meta:
managed = False
# managed = False
db_table = 'content_types'
@ -134,7 +134,7 @@ class Keywords(models.Model):
description = models.TextField(blank=True, null=True)
class Meta:
managed = False
# managed = False
db_table = 'keywords'
@ -149,7 +149,7 @@ class People(models.Model): #not used
type = models.IntegerField()
class Meta:
managed = False
# managed = False
db_table = 'people'
@ -159,7 +159,7 @@ class PersonContent(models.Model):
level = models.IntegerField()
class Meta:
managed = False
# managed = False
db_table = 'person_content'
@ -168,7 +168,7 @@ class PersonResource(models.Model):
resourceid = models.IntegerField(db_column='resourceID') # Field name made lowercase.
class Meta:
managed = False
# managed = False
db_table = 'person_resource'
@ -180,13 +180,33 @@ class Resources(models.Model):
width = models.IntegerField(blank=True, null=True)
height = models.IntegerField(blank=True, null=True)
istech = models.IntegerField(db_column='isTech') # Field name made lowercase.
dateadded = models.DateTimeField(db_column='dateAdded') # Field name made lowercase.
dateadded = models.DateTimeField(db_column='dateAdded', null=True, blank=True) # Field name made lowercase.
orderno = models.IntegerField(db_column='orderNo', blank=True, null=True) # Field name made lowercase.
class Meta:
managed = False
# managed = False
db_table = 'resources'
class File(models.Model):
content = models.ForeignKey('Content')
fil = models.FileField(upload_to='files')
description = models.TextField(blank=True, null=True)
date = models.DateTimeField(auto_now_add=True)
order = models.IntegerField(blank=True, null=True)
class Image(models.Model):
content = models.ForeignKey('Content', related_name='images')
image = models.ImageField(upload_to='images')
description = models.TextField(blank=True, null=True)
date = models.DateTimeField(auto_now_add=True)
order = models.IntegerField(blank=True, null=True)
class Link(models.Model):
content = models.ForeignKey('Content')
url = models.URLField()
description = models.TextField(blank=True, null=True)
date = models.DateTimeField(auto_now_add=True)
order = models.IntegerField(blank=True, null=True)
class Videos(models.Model): # not used
sha1 = models.CharField(max_length=50)
@ -201,7 +221,7 @@ class Videos(models.Model): # not used
contentid = models.IntegerField(blank=True, null=True)
class Meta:
managed = False
# managed = False
db_table = 'videos'
@ -213,6 +233,6 @@ class Views(models.Model):
return self.name
class Meta:
managed = False
# managed = False
db_table = 'views'