add upload MARC link to work page

pull/1/head
eric 2013-07-29 16:35:50 -04:00
parent 8576a7fb7b
commit 1872180c22
2 changed files with 13 additions and 0 deletions

View File

@ -383,6 +383,9 @@
{% for record in edition.MARCrecords.all %}
Download {{record.link_target}} MARC record for this edition: (<a href="{% url marc_concatenate %}?record_{{ record.id }}=on&amp;format=xml">XML</a>) (<a href="{% url marc_concatenate %}?record_{{ record.id }}=on&amp;format=mrc">mrc</a>)<br />
{% endfor %}
{% if user.is_staff and edition.ebooks %}
<a href="{% url MARCUngluify %}?edition={{ edition.id }}">Upload</a> a MARC record for this edition. <br />
{% endif %}
</div>
</div>

View File

@ -2630,6 +2630,16 @@ class MARCUngluifyView(FormView):
template_name = 'marcungluify.html'
form_class = MARCUngluifyForm
success_url = reverse_lazy('MARCUngluify')
# allow a get param to specify the edition
def get_initial(self):
if self.request.method == 'GET':
edition = self.request.GET.get('edition',None)
if models.Edition.objects.filter(id=edition).count():
edition = models.Edition.objects.filter(id=edition)[0]
if edition.ebooks.count():
return {'edition':edition.id}
return {}
def form_valid(self, form):
edition = form.cleaned_data['edition']