Updating to Django 1.3; begin update to Gramps DB version 16
svn: r18553
This commit is contained in:
parent
62f43acaad
commit
c7e3234bad
@ -487,13 +487,26 @@ class Family(PrimaryObject):
|
|||||||
mother = self.mother.get_primary_name() if self.mother else "No mother"
|
mother = self.mother.get_primary_name() if self.mother else "No mother"
|
||||||
return str("%s and %s" % (father, mother))
|
return str("%s and %s" % (father, mother))
|
||||||
|
|
||||||
|
class Citation(PrimaryObject):
|
||||||
|
confidence = models.IntegerField(blank=True)
|
||||||
|
page = models.CharField(max_length=50, blank=True)
|
||||||
|
abbrev = models.CharField(max_length=50, blank=True)
|
||||||
|
#source = models.ForeignKey('Source')
|
||||||
|
source = generic.GenericForeignKey("object_type", "object_id")
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return "Citation to " + str(self.source)
|
||||||
|
|
||||||
|
# Other keys here:
|
||||||
|
# .datamap_set
|
||||||
|
|
||||||
class Source(PrimaryObject):
|
class Source(PrimaryObject):
|
||||||
title = models.CharField(max_length=50, blank=True)
|
title = models.CharField(max_length=50, blank=True)
|
||||||
author = models.CharField(max_length=50, blank=True)
|
author = models.CharField(max_length=50, blank=True)
|
||||||
pubinfo = models.CharField(max_length=50, blank=True)
|
pubinfo = models.CharField(max_length=50, blank=True)
|
||||||
abbrev = models.CharField(max_length=50, blank=True)
|
abbrev = models.CharField(max_length=50, blank=True)
|
||||||
#datamaps = models.ManyToManyField('Datamap', null=True, blank=True)
|
#datamaps = models.ManyToManyField('Datamap', null=True, blank=True)
|
||||||
references = generic.GenericRelation('SourceRef', related_name="refs",
|
references = generic.GenericRelation('Citation', related_name="citation",
|
||||||
content_type_field="object_type",
|
content_type_field="object_type",
|
||||||
object_id_field="object_id")
|
object_id_field="object_id")
|
||||||
# Other keys here:
|
# Other keys here:
|
||||||
@ -688,9 +701,13 @@ class Markup(models.Model):
|
|||||||
class Datamap(models.Model):
|
class Datamap(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", null=True, blank=True)
|
source = models.ForeignKey("Source", null=True, blank=True)
|
||||||
|
|
||||||
|
class CitationDatamap(models.Model):
|
||||||
|
key = models.CharField(max_length=80, blank=True)
|
||||||
|
value = models.CharField(max_length=80, blank=True)
|
||||||
|
source = models.ForeignKey("Citation", null=True, blank=True)
|
||||||
|
|
||||||
class Address(DateObject, SecondaryObject):
|
class Address(DateObject, SecondaryObject):
|
||||||
#locations = models.ManyToManyField('Location', null=True)
|
#locations = models.ManyToManyField('Location', null=True)
|
||||||
person = models.ForeignKey('Person', null=True, blank=True)
|
person = models.ForeignKey('Person', null=True, blank=True)
|
||||||
@ -765,14 +782,6 @@ class NoteRef(BaseRef):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return "NoteRef to " + str(self.ref_object)
|
return "NoteRef to " + str(self.ref_object)
|
||||||
|
|
||||||
class SourceRef(DateObject, BaseRef):
|
|
||||||
ref_object = models.ForeignKey('Source')
|
|
||||||
page = models.CharField(max_length=50)
|
|
||||||
confidence = models.IntegerField()
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return "SourceRef to " + str(self.ref_object)
|
|
||||||
|
|
||||||
class EventRef(BaseRef):
|
class EventRef(BaseRef):
|
||||||
ref_object = models.ForeignKey('Event')
|
ref_object = models.ForeignKey('Event')
|
||||||
role_type = models.ForeignKey('EventRoleType')
|
role_type = models.ForeignKey('EventRoleType')
|
||||||
@ -856,6 +865,7 @@ TABLES = [
|
|||||||
("abstract", PrimaryObject),
|
("abstract", PrimaryObject),
|
||||||
("primary", Person),
|
("primary", Person),
|
||||||
("primary", Family),
|
("primary", Family),
|
||||||
|
("primary", Citation),
|
||||||
("primary", Source),
|
("primary", Source),
|
||||||
("primary", Event),
|
("primary", Event),
|
||||||
("primary", Repository),
|
("primary", Repository),
|
||||||
@ -874,7 +884,6 @@ TABLES = [
|
|||||||
("secondary", Url),
|
("secondary", Url),
|
||||||
("abstract", BaseRef),
|
("abstract", BaseRef),
|
||||||
("ref", NoteRef),
|
("ref", NoteRef),
|
||||||
("ref", SourceRef),
|
|
||||||
("ref", EventRef),
|
("ref", EventRef),
|
||||||
("ref", RepositoryRef),
|
("ref", RepositoryRef),
|
||||||
("ref", PersonRef),
|
("ref", PersonRef),
|
||||||
|
@ -24,12 +24,14 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.template import escape, Library
|
from django.template import Library
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from webapp.utils import *
|
from webapp.utils import *
|
||||||
from webapp.grampsdb.views import VIEWS
|
from webapp.grampsdb.views import VIEWS
|
||||||
import webapp.utils
|
import webapp.utils
|
||||||
|
|
||||||
|
#escape = lambda text: text
|
||||||
|
|
||||||
register = Library()
|
register = Library()
|
||||||
|
|
||||||
def eval_template_exp(item, context):
|
def eval_template_exp(item, context):
|
||||||
@ -105,8 +107,9 @@ register.filter('person_get_events', person_get_event)
|
|||||||
|
|
||||||
def preview(text, width=40):
|
def preview(text, width=40):
|
||||||
text = text.replace("\n", " ")
|
text = text.replace("\n", " ")
|
||||||
return escape(text[:width])
|
#return escape(text[:width])
|
||||||
preview.is_safe = True
|
return text
|
||||||
|
#preview.is_safe = True
|
||||||
register.filter('preview', preview)
|
register.filter('preview', preview)
|
||||||
|
|
||||||
make_name.is_safe = True
|
make_name.is_safe = True
|
||||||
@ -124,8 +127,9 @@ register.filter('preferred', preferred)
|
|||||||
def missing(data):
|
def missing(data):
|
||||||
if data.strip() == "":
|
if data.strip() == "":
|
||||||
return "[Missing]"
|
return "[Missing]"
|
||||||
return escape(data)
|
#return escape(data)
|
||||||
missing.is_safe = True
|
return data
|
||||||
|
#missing.is_safe = True
|
||||||
register.filter('missing', missing)
|
register.filter('missing', missing)
|
||||||
|
|
||||||
def getViewName(item):
|
def getViewName(item):
|
||||||
|
@ -33,7 +33,7 @@ from django.contrib.auth.models import User
|
|||||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
||||||
from django.http import Http404, HttpResponseRedirect, HttpResponse
|
from django.http import Http404, HttpResponseRedirect, HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, render_to_response, redirect
|
from django.shortcuts import get_object_or_404, render_to_response, redirect
|
||||||
from django.template import Context, RequestContext, escape
|
from django.template import Context, RequestContext
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
@ -130,6 +130,12 @@ CACHE_BACKEND = 'locmem://'
|
|||||||
TRANSACTIONS_MANAGED = False
|
TRANSACTIONS_MANAGED = False
|
||||||
LOCALE_PATHS = tuple()
|
LOCALE_PATHS = tuple()
|
||||||
|
|
||||||
|
# Changes for Django 1.3:
|
||||||
|
CACHES = {}
|
||||||
|
USE_L10N = True
|
||||||
|
FORMAT_MODULE_PATH = ""
|
||||||
|
## End Changes for Django 1.3
|
||||||
|
|
||||||
# In versions < 2.7 python does not properly copy methods when doing a
|
# In versions < 2.7 python does not properly copy methods when doing a
|
||||||
# deepcopy. This workaround makes the copy work properly. When Gramps no longer
|
# deepcopy. This workaround makes the copy work properly. When Gramps no longer
|
||||||
# supports python 2.6, this workaround can be removed.
|
# supports python 2.6, this workaround can be removed.
|
||||||
|
@ -44,7 +44,7 @@ from webapp.grampsdb.views import (main_page, user_page, logout_page,
|
|||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
# Specific matches first:
|
# Specific matches first:
|
||||||
(r'^admin/(.*)', admin.site.root),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
|
@ -34,7 +34,6 @@ import sys
|
|||||||
# Django Modules
|
# Django Modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from django.template import escape
|
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
||||||
@ -127,7 +126,10 @@ def probably_alive(handle):
|
|||||||
def format_number(number, with_grouping=True):
|
def format_number(number, with_grouping=True):
|
||||||
# FIXME: should be user's setting
|
# FIXME: should be user's setting
|
||||||
locale.setlocale(locale.LC_ALL, "en_US.utf8")
|
locale.setlocale(locale.LC_ALL, "en_US.utf8")
|
||||||
return locale.format("%d", number, with_grouping)
|
if number != "":
|
||||||
|
return locale.format("%d", number, with_grouping)
|
||||||
|
else:
|
||||||
|
return locale.format("%d", 0, with_grouping)
|
||||||
|
|
||||||
def nbsp(string):
|
def nbsp(string):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user