Browse Source

Django and Horizon deprecation fixes for Pike

This fixes a number of issues which were found during
testing (GBP UI is broken without these fixes):

1. Convert present/past action to methods

Table data_type_singular and data_type_plural attributes are
deprecated. action_present and action_past strings are also
deprecated. They are all being converted here.

Changes made per commit in the Horizon:
c393a6651f

2. Fixes to allow use of Django 1.11
There were some undocumented widgets used in Horizon, and in turn by us,
that were cut from Django 1.11. We are restoring some of the utility
methods that were dropped, but we are still using.

Changes based on the commit in Horizon:
52150749a6

3. Drop Django 1.7 vestiges
url template tag is no longer required to imported from the future template tag library.

Changes based on the commit in Horizon:
f2b2289b4a

Change-Id: I424cdaedd04ef9e887e34a09478e2c572d1ffd78
Sumit Naiksatam 1 year ago
parent
commit
99332501f0
20 changed files with 305 additions and 77 deletions
  1. 44
    0
      gbpui/fields.py
  2. 65
    16
      gbpui/panels/application_policy/tables.py
  3. 1
    1
      gbpui/panels/application_policy/templates/application_policy/_policy_rule_set_details.html
  4. 0
    1
      gbpui/panels/application_policy/templates/application_policy/_policyaction_details.html
  5. 0
    1
      gbpui/panels/application_policy/templates/application_policy/_policyclassifier_details.html
  6. 0
    1
      gbpui/panels/application_policy/templates/application_policy/_policyrules_details.html
  7. 81
    20
      gbpui/panels/network_policy/tables.py
  8. 0
    1
      gbpui/panels/network_policy/templates/network_policy/_external_connectivity_details.html
  9. 0
    1
      gbpui/panels/network_policy/templates/network_policy/_l2_policy_details.html
  10. 0
    1
      gbpui/panels/network_policy/templates/network_policy/_nat_pool_details.html
  11. 0
    1
      gbpui/panels/network_policy/templates/network_policy/_service_policy_details.html
  12. 65
    16
      gbpui/panels/network_services/tables.py
  13. 0
    1
      gbpui/panels/network_services/templates/network_services/_create_service_chain_spec.html
  14. 0
    1
      gbpui/panels/network_services/templates/network_services/_scinstance_details.html
  15. 0
    1
      gbpui/panels/network_services/templates/network_services/_scnode_details.html
  16. 0
    1
      gbpui/panels/network_services/templates/network_services/_scspec_details.html
  17. 0
    1
      gbpui/panels/network_services/templates/network_services/_serviceprofile_details.html
  18. 0
    1
      gbpui/panels/network_services/templates/network_services/_update_service_chain_spec.html
  19. 49
    10
      gbpui/panels/policytargets/tables.py
  20. 0
    1
      gbpui/panels/policytargets/templates/policytargets/_policy_target_details.html

+ 44
- 0
gbpui/fields.py View File

@@ -10,10 +10,13 @@
10 10
 # License for the specific language governing permissions and limitations
11 11
 # under the License.
12 12
 
13
+from itertools import chain
14
+
13 15
 from django.core import urlresolvers
14 16
 from django.forms import fields
15 17
 from django.forms import TextInput
16 18
 from django.forms import widgets
19
+from django.utils.encoding import force_text
17 20
 from django.utils.safestring import mark_safe
18 21
 
19 22
 from django.forms.utils import flatatt
@@ -134,6 +137,47 @@ class TransferTableWidget(widgets.SelectMultiple):
134 137
 
135 138
         return mark_safe('\n'.join(output))
136 139
 
140
+    def build_attrs(self, extra_attrs=None, **kwargs):
141
+        "Helper function for building an attribute dictionary."
142
+        attrs = dict(self.attrs, **kwargs)
143
+        if extra_attrs:
144
+            attrs.update(extra_attrs)
145
+        return attrs
146
+
147
+    def render_option(self, selected_choices, option_value, option_label):
148
+        if option_value is None:
149
+            option_value = ''
150
+        option_value = force_text(option_value)
151
+        if option_value in selected_choices:
152
+            selected_html = mark_safe(' selected="selected"')
153
+            if not self.allow_multiple_selected:
154
+                # Only allow for a single selection.
155
+                selected_choices.remove(option_value)
156
+        else:
157
+            selected_html = ''
158
+        return format_html('<option value="{}"{}>{}</option>',
159
+                           option_value,
160
+                           selected_html,
161
+                           force_text(option_label))
162
+
163
+    def render_options(self, choices, selected_choices):
164
+        # Normalize to strings.
165
+        selected_choices = set(force_text(v) for v in selected_choices)
166
+        output = []
167
+        for option_value, option_label in chain(self.choices, choices):
168
+            if isinstance(option_label, (list, tuple)):
169
+                output.append(format_html('<optgroup label="{}">',
170
+                              force_text(option_value)))
171
+                for option in option_label:
172
+                    output.append(self.render_option(selected_choices,
173
+                                                     *option))
174
+                output.append('</optgroup>')
175
+            else:
176
+                output.append(self.render_option(selected_choices,
177
+                                                 option_value,
178
+                                                 option_label))
179
+        return '\n'.join(output)
180
+
137 181
     # ...this adds the 'add item button' just by existing and returning a
138 182
     # true-y value
139 183
     def get_add_item_url(self):

+ 65
- 16
gbpui/panels/application_policy/tables.py View File

@@ -12,6 +12,7 @@
12 12
 
13 13
 from django.core.urlresolvers import reverse
14 14
 from django.utils.translation import ugettext_lazy as _
15
+from django.utils.translation import ungettext_lazy
15 16
 
16 17
 from horizon import tables
17 18
 
@@ -39,14 +40,26 @@ class UpdateAppPolicyLink(tables.LinkAction):
39 40
 
40 41
 class DeletePolicyRuleSetLink(tables.DeleteAction):
41 42
     name = "deletepolicyruleset"
42
-    action_present = _("Delete")
43
-    action_past = _("Scheduled deletion of %(data_type)s")
44
-    data_type_singular = _("Policy Rule Set")
45
-    data_type_plural = _("Policy Rule Sets")
46 43
 
47 44
     def action(self, request, object_id):
48 45
         client.policy_rule_set_delete(request, object_id)
49 46
 
47
+    @staticmethod
48
+    def action_present(count):
49
+        return ungettext_lazy(
50
+            u"Delete Policy Rule Set",
51
+            u"Delete Policy Rule Sets",
52
+            count
53
+        )
54
+
55
+    @staticmethod
56
+    def action_past(count):
57
+        return ungettext_lazy(
58
+            u"Scheduled deletion of Policy Rule Set",
59
+            u"Scheduled deletion of Policy Rule Sets",
60
+            count
61
+        )
62
+
50 63
 
51 64
 class AddPolicyRuleLink(tables.LinkAction):
52 65
     name = "addpolicyrules"
@@ -69,14 +82,26 @@ class UpdatePolicyRuleLink(tables.LinkAction):
69 82
 
70 83
 class DeletePolicyRuleLink(tables.DeleteAction):
71 84
     name = "deletepolicyrule"
72
-    action_present = _("Delete")
73
-    action_past = _("Scheduled deletion of %(data_type)s")
74
-    data_type_singular = _("Policy Rule")
75
-    data_type_plural = _("Policy Rules")
76 85
 
77 86
     def action(self, request, object_id):
78 87
         client.policyrule_delete(request, object_id)
79 88
 
89
+    @staticmethod
90
+    def action_present(count):
91
+        return ungettext_lazy(
92
+            u"Delete Policy Rule",
93
+            u"Delete Policy Rules",
94
+            count
95
+        )
96
+
97
+    @staticmethod
98
+    def action_past(count):
99
+        return ungettext_lazy(
100
+            u"Scheduled deletion of Policy Rule",
101
+            u"Scheduled deletion of Policy Rules",
102
+            count
103
+        )
104
+
80 105
 
81 106
 class AddPolicyClassifierLink(tables.LinkAction):
82 107
     name = "addpolicyclassifiers"
@@ -99,14 +124,26 @@ class UpdatePolicyClassifierLink(tables.LinkAction):
99 124
 
100 125
 class DeletePolicyClassifierLink(tables.DeleteAction):
101 126
     name = "deletepolicyclassifier"
102
-    action_present = _("Delete")
103
-    action_past = _("Scheduled deletion of %(data_type)s")
104
-    data_type_singular = _("Policy Classifier")
105
-    data_type_plural = _("Policy Classifiers")
106 127
 
107 128
     def action(self, request, object_id):
108 129
         client.policyclassifier_delete(request, object_id)
109 130
 
131
+    @staticmethod
132
+    def action_present(count):
133
+        return ungettext_lazy(
134
+            u"Delete Policy Classifier",
135
+            u"Delete Policy Classifiers",
136
+            count
137
+        )
138
+
139
+    @staticmethod
140
+    def action_past(count):
141
+        return ungettext_lazy(
142
+            u"Scheduled deletion of Policy Classifier",
143
+            u"Scheduled deletion of Policy Classifiers",
144
+            count
145
+        )
146
+
110 147
 
111 148
 class AddPolicyActionLink(tables.LinkAction):
112 149
     name = "addpolicyactions"
@@ -129,14 +166,26 @@ class UpdatePolicyActionLink(tables.LinkAction):
129 166
 
130 167
 class DeletePolicyActionLink(tables.DeleteAction):
131 168
     name = "deletepolicyaction"
132
-    action_present = _("Delete")
133
-    action_past = _("Scheduled deletion of %(data_type)s")
134
-    data_type_singular = _("Policy Action")
135
-    data_type_plural = _("Policy Actions")
136 169
 
137 170
     def action(self, request, object_id):
138 171
         client.policyaction_delete(request, object_id)
139 172
 
173
+    @staticmethod
174
+    def action_present(count):
175
+        return ungettext_lazy(
176
+            u"Delete Policy Action",
177
+            u"Delete Policy Actions",
178
+            count
179
+        )
180
+
181
+    @staticmethod
182
+    def action_past(count):
183
+        return ungettext_lazy(
184
+            u"Scheduled deletion of Policy Action",
185
+            u"Scheduled deletion of Policy Actions",
186
+            count
187
+        )
188
+
140 189
 
141 190
 class ApplicationPoliciesTable(tables.DataTable):
142 191
     name = tables.Column("name",

+ 1
- 1
gbpui/panels/application_policy/templates/application_policy/_policy_rule_set_details.html View File

@@ -1,5 +1,5 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
2
+
3 3
 <div class="info row detail">
4 4
 	<hr class="header_rule">
5 5
 	<dl>

+ 0
- 1
gbpui/panels/application_policy/templates/application_policy/_policyaction_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
   <hr class="header_rule">

+ 0
- 1
gbpui/panels/application_policy/templates/application_policy/_policyclassifier_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
   <hr class="header_rule">

+ 0
- 1
gbpui/panels/application_policy/templates/application_policy/_policyrules_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
   <hr class="header_rule">

+ 81
- 20
gbpui/panels/network_policy/tables.py View File

@@ -12,6 +12,7 @@
12 12
 
13 13
 from django.core.urlresolvers import reverse
14 14
 from django.utils.translation import ugettext_lazy as _
15
+from django.utils.translation import ungettext_lazy
15 16
 
16 17
 from horizon import tables
17 18
 
@@ -38,14 +39,26 @@ class EditL2PolicyLink(tables.LinkAction):
38 39
 
39 40
 class DeleteL2PolicyLink(tables.DeleteAction):
40 41
     name = "deletel2policy"
41
-    action_present = _("Delete")
42
-    action_past = _("Scheduled deletion of %(data_type)s")
43
-    data_type_singular = _("L2Policy")
44
-    data_type_plural = _("L2Policies")
45 42
 
46 43
     def action(self, request, object_id):
47 44
         client.l2policy_delete(request, object_id)
48 45
 
46
+    @staticmethod
47
+    def action_present(count):
48
+        return ungettext_lazy(
49
+            u"Delete L2 Policy",
50
+            u"Delete L2 Policies",
51
+            count
52
+        )
53
+
54
+    @staticmethod
55
+    def action_past(count):
56
+        return ungettext_lazy(
57
+            u"Scheduled deletion of L2 Policy",
58
+            u"Scheduled deletion of L2 Policies",
59
+            count
60
+        )
61
+
49 62
 
50 63
 class L2PolicyTable(tables.DataTable):
51 64
     name = tables.Column(
@@ -87,14 +100,26 @@ class EditL3PolicyLink(tables.LinkAction):
87 100
 
88 101
 class DeleteL3PolicyLink(tables.DeleteAction):
89 102
     name = "deletel3policy"
90
-    action_present = _("Delete")
91
-    action_past = _("Scheduled deletion of %(data_type)s")
92
-    data_type_singular = _("L3 Policy")
93
-    data_type_plural = _("L3 Policies")
94 103
 
95 104
     def action(self, request, object_id):
96 105
         client.l3policy_delete(request, object_id)
97 106
 
107
+    @staticmethod
108
+    def action_present(count):
109
+        return ungettext_lazy(
110
+            u"Delete L3 Policy",
111
+            u"Delete L3 Policies",
112
+            count
113
+        )
114
+
115
+    @staticmethod
116
+    def action_past(count):
117
+        return ungettext_lazy(
118
+            u"Scheduled deletion of L3 Policy",
119
+            u"Scheduled deletion of L3 Policies",
120
+            count
121
+        )
122
+
98 123
 
99 124
 class L3PolicyTable(tables.DataTable):
100 125
     name = tables.Column(
@@ -138,14 +163,26 @@ class EditServicePolicyLink(tables.LinkAction):
138 163
 
139 164
 class DeleteServicePolicyLink(tables.DeleteAction):
140 165
     name = "deletespolicy"
141
-    action_present = _("Delete")
142
-    action_past = _("Scheduled deletion of %(data_type)s")
143
-    data_type_singular = _("ServicePolicy")
144
-    data_type_plural = _("ServicePolicies")
145 166
 
146 167
     def action(self, request, object_id):
147 168
         client.delete_networkservice_policy(request, object_id)
148 169
 
170
+    @staticmethod
171
+    def action_present(count):
172
+        return ungettext_lazy(
173
+            u"Delete Network Service Policy",
174
+            u"Delete Network ServiceL3 Policies",
175
+            count
176
+        )
177
+
178
+    @staticmethod
179
+    def action_past(count):
180
+        return ungettext_lazy(
181
+            u"Scheduled deletion of Network Service Policy",
182
+            u"Scheduled deletion of Network Service Policies",
183
+            count
184
+        )
185
+
149 186
 
150 187
 class ServicePolicyTable(tables.DataTable):
151 188
     name = tables.Column(
@@ -191,14 +228,26 @@ class EditExternalConnectivityLink(tables.LinkAction):
191 228
 
192 229
 class DeleteExternalConnectivityLink(tables.DeleteAction):
193 230
     name = "deleteexternalconnectivity"
194
-    action_present = _("Delete")
195
-    action_past = _("Scheduled deletion of %(data_type)s")
196
-    data_type_singular = _("ExternalConnectivity")
197
-    data_type_plural = _("ExternalConnectivities")
198 231
 
199 232
     def action(self, request, object_id):
200 233
         client.delete_externalconnectivity(request, object_id)
201 234
 
235
+    @staticmethod
236
+    def action_present(count):
237
+        return ungettext_lazy(
238
+            u"Delete External Connectivity Policy",
239
+            u"Delete External Connectivity Policies",
240
+            count
241
+        )
242
+
243
+    @staticmethod
244
+    def action_past(count):
245
+        return ungettext_lazy(
246
+            u"Scheduled deletion of External Connectivity Policy",
247
+            u"Scheduled deletion of External Connectivity Policies",
248
+            count
249
+        )
250
+
202 251
 
203 252
 class ExternalConnectivityTable(tables.DataTable):
204 253
     name = tables.Column(
@@ -228,14 +277,26 @@ class CreateNATPoolLink(tables.LinkAction):
228 277
 
229 278
 class DeleteNATPoolLink(tables.DeleteAction):
230 279
     name = "deletenatpool"
231
-    action_present = _("Delete")
232
-    action_past = _("Scheduled deletion of %(data_type)s")
233
-    data_type_singular = _("NAT Pool")
234
-    data_type_plural = _("NAT Pools")
235 280
 
236 281
     def action(self, request, object_id):
237 282
         client.delete_natpool(request, object_id)
238 283
 
284
+    @staticmethod
285
+    def action_present(count):
286
+        return ungettext_lazy(
287
+            u"Delete NAT Pool",
288
+            u"Delete NAT Pools",
289
+            count
290
+        )
291
+
292
+    @staticmethod
293
+    def action_past(count):
294
+        return ungettext_lazy(
295
+            u"Scheduled deletion of NAT Pool",
296
+            u"Scheduled deletion of NAT Pools",
297
+            count
298
+        )
299
+
239 300
 
240 301
 class EditNATPoolLink(tables.LinkAction):
241 302
     name = "update_nat_pool"

+ 0
- 1
gbpui/panels/network_policy/templates/network_policy/_external_connectivity_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
         <hr class="header_rule">

+ 0
- 1
gbpui/panels/network_policy/templates/network_policy/_l2_policy_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
 	<hr class="header_rule">

+ 0
- 1
gbpui/panels/network_policy/templates/network_policy/_nat_pool_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
         <hr class="header_rule">

+ 0
- 1
gbpui/panels/network_policy/templates/network_policy/_service_policy_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
 	<hr class="header_rule">

+ 65
- 16
gbpui/panels/network_services/tables.py View File

@@ -12,6 +12,7 @@
12 12
 
13 13
 from django.core.urlresolvers import reverse
14 14
 from django.utils.translation import ugettext_lazy as _
15
+from django.utils.translation import ungettext_lazy
15 16
 
16 17
 from gbpui import client
17 18
 from horizon import tables
@@ -37,14 +38,26 @@ class EditServiceChainSpecLink(tables.LinkAction):
37 38
 
38 39
 class DeleteServiceChainSpecLink(tables.DeleteAction):
39 40
     name = "deletescspec"
40
-    action_present = _("Delete")
41
-    action_past = _("Scheduled deletion of %(data_type)s")
42
-    data_type_singular = _("Service Chain Spec")
43
-    data_type_plural = _("Service Chain Specs")
44 41
 
45 42
     def action(self, request, object_id):
46 43
         client.delete_servicechain_spec(request, object_id)
47 44
 
45
+    @staticmethod
46
+    def action_present(count):
47
+        return ungettext_lazy(
48
+            u"Delete Service Chain Spec",
49
+            u"Delete Service Chain Specs",
50
+            count
51
+        )
52
+
53
+    @staticmethod
54
+    def action_past(count):
55
+        return ungettext_lazy(
56
+            u"Scheduled deletion of Service Chain Spec",
57
+            u"Scheduled deletion of Service Chain Specs",
58
+            count
59
+        )
60
+
48 61
 
49 62
 class ServiceChainSpecTable(tables.DataTable):
50 63
     name = tables.Column(
@@ -85,14 +98,26 @@ class EditServiceChainNodeLink(tables.LinkAction):
85 98
 
86 99
 class DeleteServiceChainNodeLink(tables.DeleteAction):
87 100
     name = "deletescnode"
88
-    action_present = _("Delete")
89
-    action_past = _("Scheduled deletion of %(data_type)s")
90
-    data_type_singular = _("Service Chain Node")
91
-    data_type_plural = _("Service Chain Nodes")
92 101
 
93 102
     def action(self, request, object_id):
94 103
         client.delete_servicechain_node(request, object_id)
95 104
 
105
+    @staticmethod
106
+    def action_present(count):
107
+        return ungettext_lazy(
108
+            u"Delete Service Chain Node",
109
+            u"Delete Service Chain Nodes",
110
+            count
111
+        )
112
+
113
+    @staticmethod
114
+    def action_past(count):
115
+        return ungettext_lazy(
116
+            u"Scheduled deletion of Service Chain Node",
117
+            u"Scheduled deletion of Service Chain Nodes",
118
+            count
119
+        )
120
+
96 121
 
97 122
 class ServiceChainNodeTable(tables.DataTable):
98 123
     name = tables.Column(
@@ -134,14 +159,26 @@ class EditServiceChainInstanceLink(tables.LinkAction):
134 159
 
135 160
 class DeleteServiceChainInstanceLink(tables.DeleteAction):
136 161
     name = "deletescinstance"
137
-    action_present = _("Delete")
138
-    action_past = _("Scheduled deletion of %(data_type)s")
139
-    data_type_singular = _("ServiceChainInstance")
140
-    data_type_plural = _("ServiceChainInstances")
141 162
 
142 163
     def action(self, request, object_id):
143 164
         client.delete_servicechain_instance(request, object_id)
144 165
 
166
+    @staticmethod
167
+    def action_present(count):
168
+        return ungettext_lazy(
169
+            u"Delete Service Chain Instance",
170
+            u"Delete Service Chain Instances",
171
+            count
172
+        )
173
+
174
+    @staticmethod
175
+    def action_past(count):
176
+        return ungettext_lazy(
177
+            u"Scheduled deletion of Service Chain Instance",
178
+            u"Scheduled deletion of Service Chain Instances",
179
+            count
180
+        )
181
+
145 182
 
146 183
 class ServiceChainInstanceTable(tables.DataTable):
147 184
     name = tables.Column(
@@ -175,14 +212,26 @@ class CreateServiceProfileLink(tables.LinkAction):
175 212
 
176 213
 class DeleteServiceProfileLink(tables.DeleteAction):
177 214
     name = "deleteserviceprofile"
178
-    action_present = _("Delete")
179
-    action_past = _("Scheduled deletion of %(data_type)s")
180
-    data_type_singular = _("ServiceProfile")
181
-    data_type_plural = _("ServiceProfiles")
182 215
 
183 216
     def action(self, request, object_id):
184 217
         client.delete_service_profile(request, object_id)
185 218
 
219
+    @staticmethod
220
+    def action_present(count):
221
+        return ungettext_lazy(
222
+            u"Delete Service Chain Profile",
223
+            u"Delete Service Chain Profiles",
224
+            count
225
+        )
226
+
227
+    @staticmethod
228
+    def action_past(count):
229
+        return ungettext_lazy(
230
+            u"Scheduled deletion of Service Chain Profile",
231
+            u"Scheduled deletion of Service Chain Profiles",
232
+            count
233
+        )
234
+
186 235
 
187 236
 class ServiceProfileTable(tables.DataTable):
188 237
     name = tables.Column(

+ 0
- 1
gbpui/panels/network_services/templates/network_services/_create_service_chain_spec.html View File

@@ -1,6 +1,5 @@
1 1
 {% extends "horizon/common/_modal_form.html" %}
2 2
 {% load i18n %}
3
-{% load url from future %}
4 3
 
5 4
 {% block form_id %}create_service_chain_spec{% endblock %}
6 5
 {% block form_action %}{% url 'horizon:project:network_services:create_sc_spec' %}{% endblock %}

+ 0
- 1
gbpui/panels/network_services/templates/network_services/_scinstance_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info detail">
5 4
 	<hr class="header_rule">

+ 0
- 1
gbpui/panels/network_services/templates/network_services/_scnode_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 {% load staticfiles %}
4 3
 
5 4
 {% block css %}

+ 0
- 1
gbpui/panels/network_services/templates/network_services/_scspec_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
 	<hr class="header_rule">

+ 0
- 1
gbpui/panels/network_services/templates/network_services/_serviceprofile_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
     <hr class="header_rule">

+ 0
- 1
gbpui/panels/network_services/templates/network_services/_update_service_chain_spec.html View File

@@ -1,6 +1,5 @@
1 1
 {% extends "horizon/common/_modal_form.html" %}
2 2
 {% load i18n %}
3
-{% load url from future %}
4 3
 
5 4
 {% block form_id %}update_service_chain_spec{% endblock %}
6 5
 {% block form_action %}{% url 'horizon:project:network_services:update_sc_spec' scspec_id %}{% endblock %}

+ 49
- 10
gbpui/panels/policytargets/tables.py View File

@@ -15,6 +15,7 @@ from django.core.urlresolvers import reverse
15 15
 from django import http
16 16
 from django import shortcuts
17 17
 from django.utils.translation import ugettext_lazy as _
18
+from django.utils.translation import ungettext_lazy
18 19
 
19 20
 from horizon import exceptions
20 21
 from horizon import tables
@@ -41,14 +42,26 @@ class UpdatePTGLink(tables.LinkAction):
41 42
 
42 43
 class DeletePTGLink(tables.DeleteAction):
43 44
     name = "deletepolicytarget"
44
-    action_present = _("Delete")
45
-    action_past = _("Scheduled deletion of %(data_type)s")
46
-    data_type_singular = _("Group")
47
-    data_type_plural = _("Groups")
48 45
 
49 46
     def action(self, request, object_id):
50 47
         client.policy_target_delete(request, object_id)
51 48
 
49
+    @staticmethod
50
+    def action_present(count):
51
+        return ungettext_lazy(
52
+            u"Delete Group",
53
+            u"Delete Groups",
54
+            count
55
+        )
56
+
57
+    @staticmethod
58
+    def action_past(count):
59
+        return ungettext_lazy(
60
+            u"Scheduled deletion of Group",
61
+            u"Scheduled deletion of Groups",
62
+            count
63
+        )
64
+
52 65
 
53 66
 class AddPTGLink(tables.LinkAction):
54 67
     name = "addpolicy_target"
@@ -102,14 +115,26 @@ class AddExternalPTGLink(tables.LinkAction):
102 115
 
103 116
 class DeleteExternalPTGLink(tables.DeleteAction):
104 117
     name = "deleteexternalpolicytarget"
105
-    action_present = _("Delete")
106
-    action_past = _("Scheduled deletion of %(data_type)s")
107
-    data_type_singular = _("Group")
108
-    data_type_plural = _("Groups")
109 118
 
110 119
     def action(self, request, object_id):
111 120
         client.ext_policy_target_delete(request, object_id)
112 121
 
122
+    @staticmethod
123
+    def action_present(count):
124
+        return ungettext_lazy(
125
+            u"Delete External Group",
126
+            u"Delete External Groups",
127
+            count
128
+        )
129
+
130
+    @staticmethod
131
+    def action_past(count):
132
+        return ungettext_lazy(
133
+            u"Scheduled deletion of External Group",
134
+            u"Scheduled deletion of External Groups",
135
+            count
136
+        )
137
+
113 138
 
114 139
 class ExternalPTGsTable(tables.DataTable):
115 140
     name = tables.Column(
@@ -163,8 +188,22 @@ class LaunchVMLink(tables.LinkAction):
163 188
 
164 189
 
165 190
 class RemoveVMLink(tables.DeleteAction):
166
-    data_type_singular = _("Member")
167
-    data_type_plural = _("Members")
191
+
192
+    @staticmethod
193
+    def action_present(count):
194
+        return ungettext_lazy(
195
+            u"Delete Member",
196
+            u"Delete Members",
197
+            count
198
+        )
199
+
200
+    @staticmethod
201
+    def action_past(count):
202
+        return ungettext_lazy(
203
+            u"Deleted Member",
204
+            u"Deleted Members",
205
+            count
206
+        )
168 207
 
169 208
     def delete(self, request, instance_id):
170 209
         url = reverse("horizon:project:policytargets:policy_targetdetails",

+ 0
- 1
gbpui/panels/policytargets/templates/policytargets/_policy_target_details.html View File

@@ -1,5 +1,4 @@
1 1
 {% load i18n sizeformat parse_date %}
2
-{% load url from future %}
3 2
 
4 3
 <div class="info row detail">
5 4
 	<hr class="header_rule">

Loading…
Cancel
Save