summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar/furnitures/context_processors.py3
-rw-r--r--ishtar/furnitures/forms.py2
-rw-r--r--ishtar/furnitures/models.py6
-rw-r--r--ishtar/templates/base.html18
4 files changed, 20 insertions, 9 deletions
diff --git a/ishtar/furnitures/context_processors.py b/ishtar/furnitures/context_processors.py
index ed6fb1252..f81b6f7c3 100644
--- a/ishtar/furnitures/context_processors.py
+++ b/ishtar/furnitures/context_processors.py
@@ -39,7 +39,8 @@ def get_base_context(request):
dct['JQUERY_URL'] = settings.JQUERY_URL
dct['JQUERY_UI_URL'] = settings.JQUERY_UI_URL
dct['current_menu'] = []
- for lbl, model in ((_(u"Archaelogical file"), models.File),):
+ for lbl, model in ((_(u"Archaelogical file"), models.File),
+ (_(u"Operation"), models.Operation)):
model_name = model.__name__.lower()
current = model_name in request.session and request.session[model_name]
items = []
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py
index 376287d68..5bb1af6a9 100644
--- a/ishtar/furnitures/forms.py
+++ b/ishtar/furnitures/forms.py
@@ -703,7 +703,7 @@ class OperationFormGeneral(forms.Form):
operation_type = forms.ChoiceField(label=_("Operation type"),
choices=models.OperationType.get_types())
start_date = forms.DateField(label=_(u"Start date"), required=False,
- initial=get_now, widget=widgets.JQueryDate)
+ widget=widgets.JQueryDate)
end_date = forms.DateField(label=_(u"End date"), required=False,
widget=widgets.JQueryDate)
year = forms.IntegerField(label=_("Year"),
diff --git a/ishtar/furnitures/models.py b/ishtar/furnitures/models.py
index e3c434f7a..01296c109 100644
--- a/ishtar/furnitures/models.py
+++ b/ishtar/furnitures/models.py
@@ -334,6 +334,12 @@ class Operation(BaseHistorizedItem, OwnPerms):
if getattr(self, k)]
return u" - ".join(items)
+ @classmethod
+ def get_owns(cls, user, order_by=['-year', '-operation_code']):
+ if user.is_anonymous():
+ return []
+ return cls.objects.filter(history_modifier=user).order_by(*order_by
+ ).all()
class Parcel(LightHistorizedItem):
associated_file = models.ForeignKey(File, related_name='parcels',
diff --git a/ishtar/templates/base.html b/ishtar/templates/base.html
index 2b2b440c8..e726cf782 100644
--- a/ishtar/templates/base.html
+++ b/ishtar/templates/base.html
@@ -37,15 +37,19 @@
<form method="post" action="{% url update-current-item %}">
<fieldset>
<legend>{% trans "Default items"%}</legend>
- <ul id='current_items'>
+ <table id='current_items'>
{% for lbl, model_name, items in current_menu %}
- <li><label for="current_{{model_name}}">{{lbl}}</label>
- <select id='current_{{model_name}}'>
- <option value=''>--</option>
- {% for val, label, selected in items %}<option value='{{val}}'{%if selected%} selected="selected"{%endif%}>{{label}}</option>
- {% endfor %}</select></li>
+ <tr>
+ <td><label for="current_{{model_name}}">{{lbl}}</label></td>
+ <td>
+ <select id='current_{{model_name}}'>
+ <option value=''>--</option>
+ {% for val, label, selected in items %}<option value='{{val}}'{%if selected%} selected="selected"{%endif%}>{{label}}</option>
+ {% endfor %}</select>
+ </td>
+ </tr>
{% endfor %}
- </ul>
+ </table>
</fieldset>
</form>
{% endif %}{% endblock %}