@@ -340,10 +340,49 @@ Create typical FormView
340
340
</form>
341
341
342
342
343
+ callback_data attribute
344
+ ------------------------
345
+ If you want pass extra parameters to your popup view, you should use `callback_data `
346
+ attribute for PopupViewField. This argument should be dictionary or OrderedDict.
347
+ This dictionary containing yours parameters will be encoded to ASCII text string and
348
+ added to url address. In your popup view You can take this parameters from `request.GET `.
349
+
350
+ *popups.py * ::
351
+
352
+ from django.views.generic import View
353
+ from django_popup_view_field.registry import registry_popup_view
354
+
355
+ class FooPopupView(View):
356
+ def get(self, request):
357
+ print(request.GET['extra_param']) # --> will be "Foo Bar"
358
+ print(request.GET['my_pk']) # --> will be 666
359
+ ....
360
+
361
+ # REGISTER IS IMPORTANT
362
+ registry_popup_view.register(FooPopupView)
363
+
364
+ *forms.py * ::
365
+
366
+ from django import forms
367
+ from django_popup_view_field.fields import PopupViewField
368
+
369
+ class FooForm(forms.Form):
370
+
371
+ some_field = PopupViewField(
372
+ view_class=FooPopupView,
373
+ callback_data={
374
+ 'extra_param': 'Foo Bar',
375
+ 'my_pk': 666
376
+ }
377
+ )
378
+
379
+
380
+
343
381
Advanced Example
344
382
------------------------
345
383
346
- Advanced Example use django-bootstrap3. Dialog is interactive, all links and forms will be send via Ajax and response will be loaded in dialog.
384
+ Advanced Example use django-bootstrap3.
385
+ Dialog is interactive, all links and forms will be send via Ajax and response will be loaded in dialog.
347
386
348
387
.. image :: https://raw.githubusercontent.com/djk2/django-popup-view-field/master/doc/static/advanced_example.png
349
388
:alt: Advanced Example - screenshot
@@ -371,7 +410,7 @@ PopupView
371
410
Reverse order
372
411
</a>
373
412
374
- *popups.py * ::
413
+ ** popups.py* ::
375
414
376
415
from django.views.generic import TemplateView
377
416
from django_popup_view_field.registry import registry_popup_view
0 commit comments