Skip to content

Commit a1facdb

Browse files
committed
Added django-dynamic-formsets as a dependency; added it to INSTALLED_APPS, added missing STATIC_ROOT for quickier setup; added basic installation step to make testing of the code swifter
1 parent bd82b74 commit a1facdb

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# Example MyCollections app
2-
### Using Django inline formsets with Class-based Views and crispy-forms
2+
Using Django inline formsets with Class-based Views and crispy-forms
33

4+
## Installation
5+
6+
```bash
7+
pip install -r requirements.txt
8+
python manage.py collectstatic
9+
python manage.py runserver
10+
```

example/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
example/settings.py
12
"""
23
Django settings for example project.
34
@@ -15,6 +16,8 @@
1516
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1617
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1718

19+
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
20+
1821

1922
# Quick-start development settings - unsuitable for production
2023
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
@@ -39,6 +42,7 @@
3942
'django.contrib.messages',
4043
'django.contrib.staticfiles',
4144
'crispy_forms',
45+
'dynamic_formsets',
4246
]
4347

4448
CRISPY_TEMPLATE_PACK = "bootstrap3"

mycollections/templates/mycollections/formset.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
</table>
2424
<br>
2525
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
26-
<script src="{% static 'mycollections/libraries/django-dynamic-formset/jquery.formset.js' %}"></script>
26+
<script src='{% static "dynamic_formsets/jquery.formset.js" %}'></script>
2727
<script type="text/javascript">
2828
$('.formset_row-{{ formset.prefix }}').formset({
2929
addText: 'add another',
3030
deleteText: 'remove',
3131
prefix: '{{ formset.prefix }}',
3232
});
33-
</script>
33+
</script>

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Django==2.1.7
33
django-crispy-forms==1.7.2
44
pytz==2018.9
55
wincertstore==0.2
6+
django-dynamic-formsets==0.0.8

0 commit comments

Comments
 (0)