Code Monkey home page Code Monkey logo

django-merlin's People

Contributors

cgallemore avatar supercodepoet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-merlin's Issues

Merlin loosing session data

Merlin was loosing session data between steps. We are seeing this when running in a multi-threaded environment.

Full example?

Would be really good if there was a full example, I.E. a simple django app, with:

Simple 3 step wizard, outcome of 1st step changes subsequent steps.

Merlin not handling errors in done

Merlin will automatically check for form errors, but if there are problems in the done method where you need to show errors, merlin does not handle the redirect properly. A good example of this is an issue we had. We were processing credit card data in our done method, if there was a problem, I was redirecting back to the last step. The problem here was Merlin was calling self.clear which was clearing all of my session data.

Exception Value: Caught AttributeError while rendering: 'BlockWizard' object has no attribute '__name__'

I'm getting an error from the Django Debug Toolbar with my wizard. I'm not saying that Django Merlin is at fault; but is my wizard missing something? I can avoid the problem if I add this to my wizard:

    def __name__(self):
        return self.__class__.__name__

Re: http://jeffbaier.com/blog/problem-with-django-form-wizards-and-django-debug-toolbar/

Thanks

File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/core/handlers/base.py" in get_response
  178.                 response = middleware_method(request, response)
File "/usr/lib/python2.7/site-packages/django_debug_toolbar-0.8.5-py2.7.egg/debug_toolbar/middleware.py" in process_response
  110.                     smart_unicode(self.debug_toolbars[request].render_toolbar() + self.tag))
File "/usr/lib/python2.7/site-packages/django_debug_toolbar-0.8.5-py2.7.egg/debug_toolbar/toolbar/loader.py" in render_toolbar
  78.         return render_to_string('debug_toolbar/base.html', context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/loader.py" in render_to_string
  183.         return t.render(Context(dictionary))
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/base.py" in render
  123.             return self._render(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/test/utils.py" in instrumented_test_render
  57.     return self.nodelist.render(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/defaulttags.py" in render
  227.                 nodelist.append(node.render(context))
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/defaulttags.py" in render
  311.             return self.nodelist_true.render(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/base.py" in render
  744.                 bits.append(self.render_node(node, context))
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/debug.py" in render_node
  73.             result = node.render(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/debug.py" in render
  90.             output = self.filter_expression.resolve(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/base.py" in resolve
  510.                 obj = self.var.resolve(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/base.py" in resolve
  653.             value = self._resolve_lookup(context)
File "/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/template/base.py" in _resolve_lookup
  698.                             current = current()
File "/usr/lib/python2.7/site-packages/django_debug_toolbar-0.8.5-py2.7.egg/debug_toolbar/panels/request_vars.py" in content
  35.             'view_func': '%s.%s' % (self.view_func.__module__, self.view_func.__name__),

Exception Type: TemplateSyntaxError at /block/create-block
Exception Value: Caught AttributeError while rendering: 'BlockWizard' object has no attribute '__name__'

django-merlin eats exceptions and returns a 404?

Why does django-merlin seem to eat exceptions and return a 404?

If I have any errors in my code that uses django-merlin, I get a 404 with no output from django's dev server? Is there something I'm doing wrong? For example currently I'm getting a 404 after initialize() is called on my subclassed wizard:

Initialise {'form_data': {}, 'current_step': create-portlet, 'steps': [create-portlet]}

    def initialize(self, request, wizard_state):
        print('Initialise %s' % wizard_state)

My urls.py contains:

(r'^portlets/(?P[A-Za-z0-9_-]+)$', PortletWizard([Step('create-portlet', CreatePortletForm)])),

Thanks

Would like a way to cancel and wizard

It would be great to provide a default slug that could be used to cancel a wizard and clear the session information in the SessionWizard. This slug could be "cancel" and if someone wanted a step that would override this they could.

_get_url_base fails if url string contains same name as the slug

If the url string contains the same name as the slug in the request path _get_url_base fails and returns only part of the base URL.

For example, I had the url /registration/business/buy-referral/referral and _get_url_base only returned /registration/business/buy-

This issue is that _get_url_base uses:

index = request.path.find(step.slug)

which returns the first instance of the slug found (in my case referral). If _get_url_base instead used:

index = request.path.rindex(step.slug)

This would have returned the proper path, since it's starts searching from the right first, where the slug would be.

slug = '/registration/business/buy-referral/referral'
slug[:slug.find('referral')]
'/registration/business/buy-'
slug[:slug.rindex('referral')]
'/registration/business/buy-referral/'

How to set a dynamically added form's initial data based on a previously submitted form?

I created a wizard with one form. When the user submits that form, I add another step dynamically based on the user's submitted data. When the user submits this new form I want to add another step, which I can do. But how do I set initial data in that third form based on the user's data submitted in the second form? I realise this sounds complicated, so here's a simple example:

class SelectTypeForm(forms.Form):
    content_type = forms.ChoiceField(choices=build_content_types(), label='Select content type')

class EnterTitleForm(forms.Form):
    title = forms.CharField(max_length=128)

class EnterDescriptionForm(forms.Form):
    description = forms.CharField(max_length=128)

When the user submits the EnterTitleForm I want to set an initial value for the description field in the last form based on the user's input. For example, if the user enters a title of 'hello' I want to set the description to 'welcome'.

It's a trivial nonsensical example but hopefully it clarifies my question.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.