--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5519BD9B.9080105%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.
Carl
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/3UR_6HtcnY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
Hi Stephanie,
The addText and deleteText variables are the hyperlink text that is displayed on the page.
You can remove them or modify accordingly. I believe the default values are Add Form and Remove Form if you do not explicitly declare them in the javascript function.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOw%3DD6XQnVp%3Dd1EdvgEPxL_N5w%3D2eKm_4nXF9KHN_zAaH1bTew%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP7uEDLKxMwiU%2BtMBuZBcjPiEjGXR-JGhn2UOKtik0ibK2NRmw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOw%3DD6V45R64%3D0o2W9miXJzy_xqBW5YLooTS7ef9DzNuPATxiQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGBeqiNdcX52OyDfmFOoF%3DC04QJki9Hg4Zm1q-sDg1F%3DFiHf-w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP7uED%2BtE1_33r4rr1RNwgBVsBGzSO8fxeQ87RwBF%3D1schU_pA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOw%3DD6Wm2hX5%2By-6OAZ9%2BhULP8G9Nmd2zO8rJvaaVor6ZnQZMA%40mail.gmail.com.
$('.authorFormset').formset({
I have this in the head of my base.html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="{{ STATIC_URL }}js/jquery.formset.js" type="text/javascript"></script>
And then my homepage.html:
{% load crispy_forms_tags %}
<script type="text/javascript">
$(function() {
$('.authorFormset').formset({
prefix: '{{ formset.prefix }}',
addText: 'Add Author',
deleteText: 'Remove Author',
})
})
</script>
<form action="{% url 'data:register' %}" method="post" enctype="multipart/form-data">
<div class="container">
<div class="row" style="margin-top: 30px">
<div class="col-md-10 col-md-offset-1">
{{ dataset_form.media }}
{% crispy dataset_form %}
{% crispy facility_form %}
{% crispy contact_form %}
<div class="authorFormset">
{% for form in formset.forms %}
<div class="formset">
<div id="{{ form.prefix }}-row">
<div class="col-md-2">
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP7uED%2BHrqnCb3s22%3DRM-1TP71KsFkj7jVaRsYEdvVi5OCUpCA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOw%3DD6U%3DwdL_5ZcEgfD8zvPjGLDzE85%3DVXe2a0LRKbB%3D1Nb%2Big%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGBeqiOS%2BDSG1G73jEL3t-GAwSCevhXRQ%3DKMRJ8WmRjqgMog2w%40mail.gmail.com.
I fought with formsets for a week when I started. Glad I could pay it forward a bit.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOw%3DD6XGiBOoaCwf%3DZQBDgowsnjFZzDf%2BHRbE4LCOVin2cpMaA%40mail.gmail.com.
[u'ManagementForm data is missing or has been tampered with']
In template /Users/stephani/git/data/data/databank_fr/templates/data/register_dataset.html
, error at line 6
1 | {% load crispy_forms_tags %} |
---|---|
2 | |
3 | <script type="text/javascript"> |
4 | $(function() { |
5 | $('.authorFormset').formset({ |
6 | prefix: '{{ formset.prefix }}', |
7 | addText: 'Add Author', |
8 | deleteText: 'Remove Author', |
9 | }) |
10 | }) |
11 | </script> |
12 | |
13 | <form action="{% url 'databank:register' %}" method="post" enctype="multipart/form-data"> |
14 | |
15 | |
16 | <div class="container"> |
/Users/stephaniesocias/.virtualenvs/databank2/lib/python2.7/site-packages/django/core/handlers/base.py
in get_response
/Users/stephan/git/data/databank_fr/databa/apps/databank/views.py
in register
/Users/stephan/.virtualenvs/data/lib/python2.7/site-packages/django/shortcuts.py
in render
/Users/stephan/.virtualenvs/data/lib/python2.7/site-packages/django/template/loader.py
in render_to_string
I read that it might be an issue with having a form and a formset next to each other? If I don't use the "add" or "remove" links, I can submit my page (which contains other forms in addition to my formset) with just one form of the formset. But, when I do 'add' or 'delete' to add another form to the formset, I get the error. The post data, though, does seem to register the additional form...
views.py
def register(request):
dataset_form = DatasetForm()
facility_form = FacilityForm()
contact_form = FacilityContactForm()
terms_form = TermsForm()
author_formset = AuthorFormset(prefix='author')
author_formset_helper = AuthorFormsetHelper()
if request.method == 'POST':
dataset_form = DatasetForm(request.POST, request.FILES)
facility_form = FacilityForm(request.POST)
author_formset = AuthorFormset(data=request.POST, prefix='author')
contact_form = FacilityContactForm(request.POST)
return render(request, 'databank/register.html', {'dataset_form': dataset_form, 'facility_form': facility_form,
'formset': author_formset, 'author_formset_helper': author_formset_helper, 'contact_form': contact_form, 'terms_form': terms_form})
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGBeqiNj4CPxTC0Y6DOokpgsX0zG1u9KYKsH1o1qAveud_wpVg%40mail.gmail.com.
...