From 0cce16f6357cb50209425b60a5945f98a14dafa1 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Wed, 31 Jan 2018 20:22:06 +0000
Subject: [PATCH] Move addressfield data into its own app

---
 addressfield/__init__.py                                       | 0
 addressfield/models.py                                         | 3 +++
 {opentech/apply/funds => addressfield}/static/address_form.js  | 0
 .../apply/funds => addressfield}/static/addressfield.min.json  | 0
 .../funds => addressfield}/static/jquery.addressfield.min.js   | 0
 .../templates/addressfield}/widgets/nested_with_label.html     | 0
 {opentech/apply/funds => addressfield}/widgets.py              | 2 +-
 opentech/apply/funds/blocks.py                                 | 2 +-
 opentech/settings/base.py                                      | 1 +
 9 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 addressfield/__init__.py
 create mode 100644 addressfield/models.py
 rename {opentech/apply/funds => addressfield}/static/address_form.js (100%)
 rename {opentech/apply/funds => addressfield}/static/addressfield.min.json (100%)
 rename {opentech/apply/funds => addressfield}/static/jquery.addressfield.min.js (100%)
 rename {opentech/apply/funds/templates/funds => addressfield/templates/addressfield}/widgets/nested_with_label.html (100%)
 rename {opentech/apply/funds => addressfield}/widgets.py (97%)

diff --git a/addressfield/__init__.py b/addressfield/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/addressfield/models.py b/addressfield/models.py
new file mode 100644
index 000000000..71a836239
--- /dev/null
+++ b/addressfield/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/opentech/apply/funds/static/address_form.js b/addressfield/static/address_form.js
similarity index 100%
rename from opentech/apply/funds/static/address_form.js
rename to addressfield/static/address_form.js
diff --git a/opentech/apply/funds/static/addressfield.min.json b/addressfield/static/addressfield.min.json
similarity index 100%
rename from opentech/apply/funds/static/addressfield.min.json
rename to addressfield/static/addressfield.min.json
diff --git a/opentech/apply/funds/static/jquery.addressfield.min.js b/addressfield/static/jquery.addressfield.min.js
similarity index 100%
rename from opentech/apply/funds/static/jquery.addressfield.min.js
rename to addressfield/static/jquery.addressfield.min.js
diff --git a/opentech/apply/funds/templates/funds/widgets/nested_with_label.html b/addressfield/templates/addressfield/widgets/nested_with_label.html
similarity index 100%
rename from opentech/apply/funds/templates/funds/widgets/nested_with_label.html
rename to addressfield/templates/addressfield/widgets/nested_with_label.html
diff --git a/opentech/apply/funds/widgets.py b/addressfield/widgets.py
similarity index 97%
rename from opentech/apply/funds/widgets.py
rename to addressfield/widgets.py
index 09cf7e95e..7e1edce38 100644
--- a/opentech/apply/funds/widgets.py
+++ b/addressfield/widgets.py
@@ -21,7 +21,7 @@ class KeepAttrsTextInput(KeepOwnAttrsWidget, forms.TextInput):
 
 
 class NestedMultiWidget(KeepOwnAttrsWidget, forms.MultiWidget):
-    template_name = 'funds/widgets/nested_with_label.html'
+    template_name = 'addressfield/widgets/nested_with_label.html'
 
     def __init__(self, *args, **kwargs):
         widgets = [
diff --git a/opentech/apply/funds/blocks.py b/opentech/apply/funds/blocks.py
index 48834e637..981717d57 100644
--- a/opentech/apply/funds/blocks.py
+++ b/opentech/apply/funds/blocks.py
@@ -16,7 +16,7 @@ from opentech.apply.stream_forms.blocks import (
     TextFieldBlock,
 )
 from opentech.apply.categories.blocks import CategoryQuestionBlock
-from .widgets import AddressWidget
+from addressfield.widgets import AddressWidget
 
 
 def find_duplicates(items):
diff --git a/opentech/settings/base.py b/opentech/settings/base.py
index c4b14f509..a2031e3fb 100644
--- a/opentech/settings/base.py
+++ b/opentech/settings/base.py
@@ -57,6 +57,7 @@ INSTALLED_APPS = [
     'tinymce',
     'wagtailcaptcha',
     'django_tables2',
+    'addressfield',
 
     'django.contrib.admin',
     'django.contrib.auth',
-- 
GitLab