Messages; fixes throughout
svn: r18333
This commit is contained in:
parent
7b4b4136bf
commit
9e6bd3c4ba
@ -952,9 +952,9 @@ class SimpleAccess(object):
|
|||||||
elif isinstance(obj, gen.lib.Place):
|
elif isinstance(obj, gen.lib.Place):
|
||||||
return place_name(self.dbase, obj.handle)
|
return place_name(self.dbase, obj.handle)
|
||||||
elif isinstance(obj, gen.lib.Repository):
|
elif isinstance(obj, gen.lib.Repository):
|
||||||
return obj.type
|
return obj.gramps_id
|
||||||
elif isinstance(obj, gen.lib.Note):
|
elif isinstance(obj, gen.lib.Note):
|
||||||
return obj.type
|
return obj.gramps_id
|
||||||
elif obj is None:
|
elif obj is None:
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
<li {{tview|currentSection:view.1 }}><a href="/{{view.1}}/">{{view.0}}</a></li>
|
<li {{tview|currentSection:view.1 }}><a href="/{{view.1}}/">{{view.0}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<li><a href="/report">Reports</a></li>
|
|
||||||
{% if next %}
|
{% if next %}
|
||||||
<li><a href="/logout/?next={{next}}">Logout</a></li>
|
<li><a href="/logout/?next={{next}}">Logout</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -52,16 +51,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
|
||||||
{% if error %}
|
|
||||||
<font color="red">{{error}}</font>
|
|
||||||
{% endif %}
|
|
||||||
{% if message %}
|
|
||||||
<font color="blue">{{message}}</font>
|
|
||||||
{% endif %}
|
|
||||||
<div class="grampsweb">
|
<div class="grampsweb">
|
||||||
|
{% for message in messages %}
|
||||||
|
<font color="red">{{message}}</font>
|
||||||
|
{% endfor %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
<div class="content">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
|
@ -91,7 +91,8 @@ class mGrampsType(models.Model):
|
|||||||
|
|
||||||
name = models.CharField(max_length=40)
|
name = models.CharField(max_length=40)
|
||||||
|
|
||||||
def __unicode__(self): return self.name
|
def __unicode__(self):
|
||||||
|
return str(self.name)
|
||||||
|
|
||||||
def get_default_type(self):
|
def get_default_type(self):
|
||||||
""" return a tuple default (val,name) """
|
""" return a tuple default (val,name) """
|
||||||
@ -418,7 +419,8 @@ class PrimaryObject(models.Model):
|
|||||||
#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)
|
||||||
|
|
||||||
def __unicode__(self): return "%s: %s" % (self.__class__.__name__,
|
def __unicode__(self):
|
||||||
|
return "%s: %s" % (self.__class__.__name__,
|
||||||
self.gramps_id)
|
self.gramps_id)
|
||||||
|
|
||||||
class Person(PrimaryObject):
|
class Person(PrimaryObject):
|
||||||
@ -480,6 +482,11 @@ class Family(PrimaryObject):
|
|||||||
# Others keys here:
|
# Others keys here:
|
||||||
# .lds_set
|
# .lds_set
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
father = self.father.get_primary_name() if self.father else "No father"
|
||||||
|
mother = self.mother.get_primary_name() if self.mother else "No mother"
|
||||||
|
return str("%s and %s" % (father, mother))
|
||||||
|
|
||||||
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)
|
||||||
@ -814,6 +821,9 @@ class Report(models.Model):
|
|||||||
report_type = models.TextField(blank=True, null=True)
|
report_type = models.TextField(blank=True, null=True)
|
||||||
options = models.TextField(blank=True, null=True)
|
options = models.TextField(blank=True, null=True)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return str(self.name)
|
||||||
|
|
||||||
class Result(models.Model):
|
class Result(models.Model):
|
||||||
name = models.TextField(blank=True, null=True)
|
name = models.TextField(blank=True, null=True)
|
||||||
filename = models.TextField(blank=True, null=True)
|
filename = models.TextField(blank=True, null=True)
|
||||||
@ -821,6 +831,9 @@ class Result(models.Model):
|
|||||||
run_by = models.TextField('run by', blank=True, null=True)
|
run_by = models.TextField('run by', blank=True, null=True)
|
||||||
status = models.TextField(blank=True, null=True)
|
status = models.TextField(blank=True, null=True)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return str(self.name)
|
||||||
|
|
||||||
TABLES = [
|
TABLES = [
|
||||||
("abstract", mGrampsType),
|
("abstract", mGrampsType),
|
||||||
("type", NameType),
|
("type", NameType),
|
||||||
|
@ -62,6 +62,7 @@ VIEWS = [(_('People'), 'person', Name),
|
|||||||
(_('Places'), 'place', Place),
|
(_('Places'), 'place', Place),
|
||||||
(_('Repositories'), 'repository', Repository),
|
(_('Repositories'), 'repository', Repository),
|
||||||
(_('Tags'), 'tag', Tag),
|
(_('Tags'), 'tag', Tag),
|
||||||
|
(_('Reports'), 'report', Report),
|
||||||
]
|
]
|
||||||
|
|
||||||
def context_processor(request):
|
def context_processor(request):
|
||||||
@ -96,7 +97,7 @@ def logout_page(request):
|
|||||||
logout(request)
|
logout(request)
|
||||||
# TODO: allow this once we have an error page
|
# TODO: allow this once we have an error page
|
||||||
#if request.GET.has_key("next"):
|
#if request.GET.has_key("next"):
|
||||||
# return redirect(request.GET.get("next"), context)
|
# return redirect(request.GET.get("next"))
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/')
|
||||||
|
|
||||||
def user_page(request, username):
|
def user_page(request, username):
|
||||||
@ -132,7 +133,7 @@ def fix_person(request, person):
|
|||||||
name.save()
|
name.save()
|
||||||
order += 1
|
order += 1
|
||||||
if request:
|
if request:
|
||||||
return redirect("/person/%s" % person.handle, request)
|
return redirect("/person/%s" % person.handle)
|
||||||
|
|
||||||
def set_date(obj):
|
def set_date(obj):
|
||||||
obj.calendar = 0
|
obj.calendar = 0
|
||||||
@ -225,11 +226,9 @@ def view_name_detail(request, handle, order, action="view"):
|
|||||||
view_template = "view_name_detail.html"
|
view_template = "view_name_detail.html"
|
||||||
if action == "save":
|
if action == "save":
|
||||||
context["action"] = "view"
|
context["action"] = "view"
|
||||||
return redirect("/person/%s/name/%d" %
|
return redirect("/person/%s/name/%d" % (person.handle, name.order))
|
||||||
(person.handle, name.order), context)
|
|
||||||
elif action == "back":
|
elif action == "back":
|
||||||
return redirect("/person/%s/" %
|
return redirect("/person/%s/" % (person.handle))
|
||||||
(person.handle), context)
|
|
||||||
else:
|
else:
|
||||||
return render_to_response(view_template, context)
|
return render_to_response(view_template, context)
|
||||||
|
|
||||||
@ -280,23 +279,34 @@ def process_action(request, view, handle, action):
|
|||||||
export_file(db, filename, lambda n: n) # callback
|
export_file(db, filename, lambda n: n) # callback
|
||||||
mimetype = 'text/plain'
|
mimetype = 'text/plain'
|
||||||
elif report.report_type == "import":
|
elif report.report_type == "import":
|
||||||
context = RequestContext(request)
|
|
||||||
filename = download(args["i"], "/tmp/%s-%s.ged" % (str(profile.user.username), str(handle)))
|
filename = download(args["i"], "/tmp/%s-%s.ged" % (str(profile.user.username), str(handle)))
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
import threading
|
import threading
|
||||||
def background():
|
def background():
|
||||||
|
try:
|
||||||
import_file(db, filename, lambda n: n) # callback
|
import_file(db, filename, lambda n: n) # callback
|
||||||
|
except:
|
||||||
|
message = "import_file failed."
|
||||||
|
request.user.message_set.create(message = message)
|
||||||
threading.Thread(target=background).start()
|
threading.Thread(target=background).start()
|
||||||
context["message"] = "Your data is now being imported..."
|
message = "Your data is now being imported..."
|
||||||
return redirect("/report/", context)
|
request.user.message_set.create(message = message)
|
||||||
|
return redirect("/report/")
|
||||||
else:
|
else:
|
||||||
context["error"] = "No filename was provided or found."
|
message = "No filename was provided or found."
|
||||||
return redirect("/report/", context)
|
request.user.message_set.create(message = message)
|
||||||
|
return redirect("/report/")
|
||||||
|
else:
|
||||||
|
message = "Invalid report type '%s'" % report.report_type
|
||||||
|
request.user.message_set.create(message = message)
|
||||||
|
return redirect("/report/")
|
||||||
|
if os.path.exists(filename):
|
||||||
|
return send_file(request, filename, mimetype)
|
||||||
else:
|
else:
|
||||||
context = RequestContext(request)
|
context = RequestContext(request)
|
||||||
context["error"] = "Invalid report type '%s'" % report.report_type
|
message = "Failed: '%s' is not found" % filename
|
||||||
return redirect("/report/", context)
|
request.user.message_set.create(message=message)
|
||||||
return send_file(request, filename, mimetype)
|
return redirect("/report/")
|
||||||
# If failure, just fail for now:
|
# If failure, just fail for now:
|
||||||
context = RequestContext(request)
|
context = RequestContext(request)
|
||||||
context["tview"] = "Results"
|
context["tview"] = "Results"
|
||||||
@ -462,8 +472,7 @@ def view_person_detail(request, view, handle, action="view"):
|
|||||||
nf.model = name
|
nf.model = name
|
||||||
# END NON-AUTHENTICATED ACCESS
|
# END NON-AUTHENTICATED ACCESS
|
||||||
if action == "save":
|
if action == "save":
|
||||||
context["action"] = "view"
|
return redirect("/person/%s" % person.handle)
|
||||||
return redirect("/person/%s" % person.handle, context)
|
|
||||||
context["action"] = action
|
context["action"] = action
|
||||||
context["view"] = view
|
context["view"] = view
|
||||||
context["tview"] = _("Person")
|
context["tview"] = _("Person")
|
||||||
|
Loading…
Reference in New Issue
Block a user