Bringing webapp up to date with python3 and django 1.6

This commit is contained in:
Doug Blank 2015-05-09 17:52:11 -04:00
parent dfe88deeda
commit 0360a5987e
4 changed files with 9 additions and 6 deletions

View File

@ -34,7 +34,7 @@ class Profile(models.Model):
Used to save additional information of a user, such as
themes, bookmarks, etc.
"""
user = models.ForeignKey(User, unique=True)
user = models.OneToOneField(User, related_name="profile")
theme_type = models.ForeignKey("ThemeType", default=1) # The default is a pk?
def __unicode__(self):

View File

@ -91,7 +91,7 @@ def context_processor(request):
global SITENAME
context = {}
if request.user.is_authenticated():
profile = request.user.get_profile()
profile = request.user.profile
context["css_theme"] = profile.theme_type.name
else:
context["css_theme"] = "Web_Mainz.css"
@ -153,7 +153,7 @@ def user_page(request, username=None):
"""
if request.user.is_authenticated():
if username is None:
profile = request.user.get_profile()
profile = request.user.profile
username = profile.user.username
try:
user = User.objects.get(username=username)
@ -198,7 +198,7 @@ def process_report_run(request, handle):
import traceback
db = DbDjango()
if request.user.is_authenticated():
profile = request.user.get_profile()
profile = request.user.profile
report = Report.objects.get(handle=handle)
args = {"off": "html"} # basic defaults
# override from given defaults in table:

View File

@ -53,7 +53,10 @@ atexit.register(save_history)
del atexit, readline, rlcompleter, save_history, historyPath""")
fp.close()
execfile(pystartup)
with open(pystartup) as f:
code = compile(f.read(), pystartup, 'exec')
exec(code, globals(), locals())
from django.conf import settings
import gramps.webapp.settings as default_settings
try:

View File

@ -1 +1 @@
PYTHONPATH=../.. python -i shell.py
PYTHONPATH=../.. python3 -i shell.py