Bring webapp in master up to Django, version 1.6.1

This commit is contained in:
Doug Blank 2015-05-08 10:54:35 -04:00 committed by Ross Gammon
parent a566be07a5
commit 53a00dd2d2
5 changed files with 33 additions and 22 deletions

View File

@ -1,6 +1,6 @@
# Initialize GRAMPS Django site # Initialize GRAMPS Django site
PYTHON=GRAMPS_RESOURCES=../.. PYTHONPATH=../.. python2.7 PYTHON=GRAMPS_RESOURCES=../.. PYTHONPATH=../.. python3
update: grampsdb/fixtures/initial_data.json update: grampsdb/fixtures/initial_data.json
$(PYTHON) manage.py syncdb --noinput $(PYTHON) manage.py syncdb --noinput

View File

@ -484,7 +484,7 @@ class PrimaryObject(models.Model):
blank=True) # user edits blank=True) # user edits
last_changed_by = models.TextField(blank=True, null=True) last_changed_by = models.TextField(blank=True, null=True)
private = models.BooleanField('private') private = models.BooleanField('private', default=True)
public = models.BooleanField('public', default=True) public = models.BooleanField('public', default=True)
#attributes = models.ManyToManyField("Attribute", blank=True, null=True) #attributes = models.ManyToManyField("Attribute", blank=True, null=True)
cache = models.TextField(blank=True, null=True) cache = models.TextField(blank=True, null=True)
@ -566,7 +566,7 @@ class Person(PrimaryObject):
The model for the person object The model for the person object
""" """
gender_type = models.ForeignKey('GenderType', verbose_name="Gender") gender_type = models.ForeignKey('GenderType', verbose_name="Gender")
probably_alive = models.BooleanField("Probably alive") probably_alive = models.BooleanField("Probably alive", default=True)
families = models.ManyToManyField('Family', blank=True, null=True, through="MyFamilies") families = models.ManyToManyField('Family', blank=True, null=True, through="MyFamilies")
parent_families = models.ManyToManyField('Family', parent_families = models.ManyToManyField('Family',
related_name="parent_families", related_name="parent_families",
@ -738,7 +738,7 @@ class Media(DateObject, PrimaryObject):
class Note(PrimaryObject): class Note(PrimaryObject):
note_type = models.ForeignKey('NoteType', verbose_name="Type") note_type = models.ForeignKey('NoteType', verbose_name="Type")
text = models.TextField(blank=True) text = models.TextField(blank=True)
preformatted = models.BooleanField('preformatted') preformatted = models.BooleanField('preformatted', default=True)
references = generic.GenericRelation('NoteRef', #related_name="refs", references = generic.GenericRelation('NoteRef', #related_name="refs",
content_type_field="object_type", content_type_field="object_type",
object_id_field="object_id") object_id_field="object_id")
@ -759,7 +759,7 @@ class SecondaryObject(models.Model):
""" """
class Meta: abstract = True class Meta: abstract = True
private = models.BooleanField() private = models.BooleanField(default=True)
last_saved = models.DateTimeField('last changed', auto_now=True) last_saved = models.DateTimeField('last changed', auto_now=True)
last_changed = models.DateTimeField('last changed', null=True, last_changed = models.DateTimeField('last changed', null=True,
blank=True) # user edits blank=True) # user edits
@ -776,7 +776,7 @@ class Surname(models.Model):
default=2) default=2)
surname = models.TextField(blank=True) surname = models.TextField(blank=True)
prefix = models.TextField(blank=True) prefix = models.TextField(blank=True)
primary = models.BooleanField('Primary surname?') primary = models.BooleanField('Primary surname?', default=True)
connector = models.TextField(blank=True) connector = models.TextField(blank=True)
name = models.ForeignKey("Name") name = models.ForeignKey("Name")
order = models.PositiveIntegerField() order = models.PositiveIntegerField()
@ -794,7 +794,7 @@ class Name(DateObject, SecondaryObject):
name_type = models.ForeignKey('NameType', verbose_name="Type", name_type = models.ForeignKey('NameType', verbose_name="Type",
related_name="name_code", related_name="name_code",
default=2) default=2)
preferred = models.BooleanField('Preferred name?') preferred = models.BooleanField('Preferred name?', default=True)
first_name = models.TextField(blank=True) first_name = models.TextField(blank=True)
suffix = models.TextField(blank=True) suffix = models.TextField(blank=True)
title = models.TextField(blank=True) title = models.TextField(blank=True)
@ -898,14 +898,14 @@ class SourceAttribute(models.Model):
key = models.CharField(max_length=80, blank=True) key = models.CharField(max_length=80, blank=True)
value = models.CharField(max_length=80, blank=True) value = models.CharField(max_length=80, blank=True)
source = models.ForeignKey("Source") source = models.ForeignKey("Source")
private = models.BooleanField() private = models.BooleanField(default=True)
order = models.PositiveIntegerField() order = models.PositiveIntegerField()
class CitationAttribute(models.Model): class CitationAttribute(models.Model):
key = models.CharField(max_length=80, blank=True) key = models.CharField(max_length=80, blank=True)
value = models.CharField(max_length=80, blank=True) value = models.CharField(max_length=80, blank=True)
citation = models.ForeignKey("Citation") citation = models.ForeignKey("Citation")
private = models.BooleanField() private = models.BooleanField(default=True)
order = models.PositiveIntegerField() order = models.PositiveIntegerField()
class Address(DateObject, SecondaryObject): class Address(DateObject, SecondaryObject):
@ -933,7 +933,7 @@ class Location(models.Model):
address = models.ForeignKey("Address", null=True, blank=True) address = models.ForeignKey("Address", null=True, blank=True)
class Url(models.Model): class Url(models.Model):
private = models.BooleanField('private url?') private = models.BooleanField('private url?', default=True)
path = models.TextField(blank=True, null=True) path = models.TextField(blank=True, null=True)
desc = models.TextField(blank=True, null=True) desc = models.TextField(blank=True, null=True)
url_type = models.ForeignKey('UrlType') url_type = models.ForeignKey('UrlType')
@ -944,7 +944,7 @@ class Url(models.Model):
repository = models.ForeignKey("Repository", null=True, blank=True) repository = models.ForeignKey("Repository", null=True, blank=True)
class Attribute(models.Model): class Attribute(models.Model):
private = models.BooleanField('private attribute?') private = models.BooleanField('private attribute?', default=True)
attribute_type = models.ForeignKey('AttributeType') attribute_type = models.ForeignKey('AttributeType')
value = models.TextField(blank=True, null=True) value = models.TextField(blank=True, null=True)
@ -974,7 +974,7 @@ class BaseRef(models.Model):
last_changed_by = models.TextField(blank=True, null=True) last_changed_by = models.TextField(blank=True, null=True)
#attributes = models.ManyToManyField("Attribute", null=True) #attributes = models.ManyToManyField("Attribute", null=True)
private = models.BooleanField() private = models.BooleanField(default=True)
def get_url(self): def get_url(self):
# /person/3536453463/reference/event/2 # /person/3536453463/reference/event/2

View File

@ -46,7 +46,7 @@ from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.template import Context, RequestContext from django.template import Context, RequestContext
from django.db.models import Q from django.db.models import Q
from django.forms.models import modelformset_factory from django.forms.models import modelformset_factory
from django.utils import simplejson import simplejson
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -26,13 +26,24 @@
# Django Modules # Django Modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from django.core.management import execute_manager
try: # from django.core.management import execute_manager
import settings # Assumed to be in the same directory. # try:
except ImportError: # import settings # Assumed to be in the same directory.
import sys # except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) # import sys
sys.exit(1) # sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
# sys.exit(1)
# if __name__ == "__main__":
# execute_manager(settings)
import os, sys
if __name__ == "__main__": if __name__ == "__main__":
execute_manager(settings) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gramps.webapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

View File

@ -32,7 +32,7 @@ import os
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gramps.gen.const import IMAGE_DIR, ROOT_DIR, DATA_DIR from gramps.gen.const import IMAGE_DIR, ROOT_DIR, DATA_DIR
from django.conf.urls.defaults import * from django.conf.urls import patterns, url, include
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()