Giter VIP home page Giter VIP logo

django-formwizard's People

Contributors

stephrdev avatar treyhunner 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  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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-formwizard's Issues

step not passed to get_form when using NamedUrls

Hi,

I have noticed in the code of NamedUrlWizardView that you don't pass the step name to get_form.

I think it should pass it as else the only we have to know what step we are in is to use self.steps.current, which can bring some bugs. For example in my use case for the same step I need to customize get_form and get_form_initial. But in my get_form_initial I need to use get_form with data parameter to retrieve a previous form data to generate my new form. As I was using self.steps.current it would bring a recursive loop.

Would be great if it could be fixed!

Thanks

How wrap a FormWizard in a View?

How do I wrap the new Django Form Wizard in a view? I need to do this so I can access request.

Does anyone have some example code for this?

Browser's back button breaks formwizard

Hi Stephan,

I just checked version 0.6. I installed it using pip. I have to say it still has the same bug I reported long ago:
#5

I'm going to try to explain myself better this time. Last time I mixed too many things, I changed 2 different things at the same time using the wrong branch, bad idea :(

I have a form wizard done subclassing SessionFormWizard. It's got 2 different forms (2 steps). First one asks for an amount to bid on a transport, second one asks for confirmation. So if I put an amount like 25, I get to the second form, If I press browser's back button then, I return to the previous page (but no GET is addressed, so storage is not reset). So I put another amount, 23. As storage step has not been reset, it thinks I'm in the 2nd step, not true!

So two things can happen here. First the second form validates with the data I'm sending, horror! my previous bid of 25 gets accepted! Or it doesn't validate so it shows me the second form with errors (confusing for the user), but the data from the first step didn't change.

So this is why I changed the conditional flow of process_post_request as you can see here:
https://github.com/maraujop/django-formwizard/blob/f1ac719c412c17e02834840f768198b9908998e7/formwizard/forms.py#L131

I've thought this problem in great detail before and the only solution I've come up with, is having a explicit parameter in the form that tell us what step we are in (other would be blocking browser's back button, but I don't like it).

This way I use form_prev_step as a hidden input that tells the storage what step it's in, so it can work properly.

I hope this time looks clearer, regards
Miguel

Requirements

Hi,

Today I found your project and It's exactly what I needed, great work! I installed from github and I got an ImportError becauses of class_based_views.base. I'm using Django 1.2.3 and I think you should mention in your docs that latest Django 1.3 alpha is necessary to have version 0.5 working.

I would like to ask you if you are working on adding files upload support. I might have to work at it in the future and I wouldn't want to replicate work.

Thanks, regards
Miguel

Reset on get request

I can't get my head around why you would want to force reset on every process_get_request, rather than let the developer decide whether they wanted to reset or not. Consider the scenario - I override process_request to interpret some slug information in the URL. After using the slug to retrieve an object, I update_extra_context with that object so it can be embedded in the first page of the form. Except process_get_request then resets the wizard making everything above useless. I've used this project 3 times now and every time I've had to override process_get_request as well. Am I just doing it wrong?!

Unable to use an empty ModelFormset

I've been trying to use a ModelFormset in my WizardView and the ModelFormset appears in the right step. On that note, it is okay but it doesn't seem to be empty. My ModelFormset contains fields with values from my database. The documented Django method of getting any empty ModelFormSet doesn't seem to work. (https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-queryset)

I posted a question about this on StackOverflow and got an answer to this. (http://stackoverflow.com/questions/8316145/empty-modelformset-in-djangos-formwizard)

Do drop me a message if you need any more information

Thanks.

Documentation Request: Example Accessing Other Form's Data

Would it be possible to add an example to the docs of how to access an earlier form's data from within the init() or clean() methods of a subsequent form's data? I'm sure it's simple and I'm just missing something obvious, but I've been chasing my tail all morning trying to figure it out.

Thanks!

NamedUrlWizardView lacks support of additional keyword arguments.

I am currently working on a project which uses a subclass of NamedUrlWizardView in combination with a SingleObjectMixin. As you know, the mixin depends on a "pk" keyword argument, which currently doesn't get passed along the various redirect calls in the NamedUrlWizardView. Imo this should be implemented, as it's a major feature of the class-based generic view's concept on which the "new" formwizard is based.

What do you think of it?

Regards,
Lukas

Have multiple formset/forms in one step

Would be nice to be able to have a way to have multiple forms and formset in one step.

In the old implementation of the formwizard I was saving but not committing my formsets and stored them in my formwizard class. I was passing my formset in the context.

It seems now impossible to save the formset in the class as it seems the class is instanciated again for each step.

Add a "save and goto" function

Currently we have a "save and goto next step" function, and a "goto step" function.

If I go back to a previous step and change data and go directly to a step, the form data is not saved, I have to use the classic "Continute to next step" behaviour.

We need a additonal "save and goto step" function.

Uploaded file is lost when user navigates to previous page in Django1.4

All other fields retains the user entered data but a uploaded file in the FileField gets lost when user navigates to previous page I tried using SessionWizardView and NamedUrlSessionWizardView.The required field validation fails.If it is a saved instance (instance of FieldFile ) being edited ,then the field is populated.To me it looked like the storage.current_step is not getting updated with wizard_goto_step and hence the storage.get_step_files is not getting uploaded files for the previous step but the ones for the current step. This issue was also raised at http://stackoverflow.com/questions/10597021/formwizard-and-filefields-django-1-4

Multiple forms per-session

Accessing a single SessionFormWizard from multiple tabs; each tab will use the single state present in the session.

For example on Tab1 if I make it to Step3 and open Tab2 and visit the URL, Tab1's state is destroyed.

Issue with Firebug: GET request erease form's data

Hello,

I've been trying to make formwizard working since hours, and it doesn't work because of firefox/firebug incompatibility. Anyway this is only guess, but strong because it starts working perfectly while disabling firebug :)

Versions:

  • Firefox 5.0
  • Firebug 1.7.3
  • Django 1.3
  • django-formwizard 1.0

Error description:

While going from one step to another, a POST request AND a GET request is done. I really don't know why.
But side effect is GET request erease the stored data of the previous form, as described here (https://github.com/stephrdev/django-formwizard/blob/master/formwizard/views.py#L224)

As we could expect, the final re-validation do not work (see https://github.com/stephrdev/django-formwizard/blob/master/formwizard/views.py#L316), since previous data are not found.

From the user point of view, all steps passes, but then he's redirected to the first step without any futher information or error description.

Error logs:

[13/Jul/2011 07:01:41] "GET /wizard/ HTTP/1.1" 200 96922
[13/Jul/2011 07:01:42] "GET /wizard/ HTTP/1.1" 200 96870
# --> Step 1 is displayed
[13/Jul/2011 07:01:45] "POST /wizard/ HTTP/1.1" 200 119399
[13/Jul/2011 07:01:47] "GET /wizard/ HTTP/1.1" 200 97464
# --> Step 2 is displayed
[13/Jul/2011 07:01:52] "POST /wizard/ HTTP/1.1" 200 98267
[13/Jul/2011 07:01:54] "GET /wizard/ HTTP/1.1" 200 97499
# --> Step 3 is displayed
[13/Jul/2011 07:01:55] "POST /wizard/ HTTP/1.1" 200 97844
[13/Jul/2011 07:01:57] "GET /wizard/ HTTP/1.1" 200 97774
# --> Step 1 is displayed without any error message

When there is a POST request, GET request should not occur ...

I didn't found any useful information in firebug ...

Solution:

Disable Firebug ?

inline_formsetfactory and initial parameter

inline_formsetfactory return a formset that does not recognize the initial parameter. It seems that this is a know limitation from current Django version.

I had to use this custom class and pass the parameter formset to inline_formsetfactory.

class BaseStockFormSet(BaseInlineFormSet):
    def __init__(self, *args, **kwargs):
        """
        Grabs the curried initial values and stores them into a 'private'
        variable. Note: the use of self.__initial is important, using
        self.initial or self._initial will be erased by a parent class
        """
        self.__initial = kwargs.pop('initial', [])
        super(BaseStockFormSet, self).__init__(*args, **kwargs)

#    def total_form_count(self):
#        return len(self.__initial) + self.extra

    def _construct_forms(self):
        return super(BaseStockFormSet, self)._construct_forms()
        #return formsets.BaseFormSet._construct_forms(self)

    def _construct_form(self, i, **kwargs):
        if self.__initial:
            try:
                kwargs['initial'] = self.__initial[i]
            except IndexError:
                pass
        return super(BaseStockFormSet, self)._construct_form(i, **kwargs)
        #return formsets.BaseFormSet._construct_form(self, i, **kwargs)

I know it's not really an issue in formwizard but might be useful to get addressed in a way or in another.

Thanks!

Error when using conditional skipping

I have 3 checkboxes on page 1 of my formwizard, one each representing pages 2, 3 and 4. If I write a generic conditional function to skip any of those pages if the checkbox on 1 is not ticked, and I also have "{% if wizard.steps.prev %}" or "{{ wizard.steps.step1 }}" in my template, I get the error "Caught ValueError while rendering: u'X' is not in list" where X is the index of the page that has been skipped.

Example conditional function:

def check_types(wizard):
current_step = wizard.steps.current
cleaned_data = wizard.get_cleaned_data_for_step('1') or {}
if current_step == '2' and 'option1' not in cleaned_data:
return False
if current_step == '3' and 'option2' not in cleaned_data:
return False
if current_step == '4' and 'option3' not in cleaned_data:
return False
return True

Add ability to set extra context upon init

So we can add extra context to each step when the wizard is called within the urls.py:

url(r'^buy/$',
    MyWizard([
        ('plan', PlanForm),
        ('billing', BuyForm),
    ], extra_context={'hello': 'world'}),
),

Uploaded file in the previous page form is not displayed when previous button is clicked in Django 1.4

All the other form fileds are displayed correctly with values but a FileField is not populated when user navigates to previous page .User has to upload the file again if he navigates to previous page.When a saved instance(instance of FieldFile instead of FileField) is edited the same file upload field is displayed correctly in the previous page.So I am confused if this is an issue with ClearableFileInput widget or FormWizard not updating the .storage.current_step to w izard_goto_step.This has been raised in http://stackoverflow.com/questions/10597021/formwizard-and-filefields-django-1-4 also

IOError when installing from PyPI

Attempted to install django-formwizard 1.0 from PyPi using pip. This gives the error:

C:\Python26\Scripts>pip install django-formwizard
Downloading/unpacking django-formwizard
  Downloading django-formwizard-1.0.tar.gz
  Running setup.py egg_info for package django-formwizard
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "C:\Python26\Scripts\build\django-formwizard\setup.py", line 11, in <module>
        long_description=read("README.rst"),
      File "C:\Python26\Scripts\build\django-formwizard\setup.py", line 5, in read
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
    IOError: [Errno 2] No such file or directory: 'C:\\Python26\\Scripts\\build\\django-formwizard\\README.rst'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "C:\Python26\Scripts\build\django-formwizard\setup.py", line 11, in <module>

    long_description=read("README.rst"),

  File "C:\Python26\Scripts\build\django-formwizard\setup.py", line 5, in read

    return open(os.path.join(os.path.dirname(__file__), fname)).read()

IOError: [Errno 2] No such file or directory: 'C:\\Python26\\Scripts\\build\\django-formwizard\\README.rst'

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in C:\Documents and Settings\msanders\Application Data\pip\pip.log

The 'README.rst' file is indeed missing from the build directory. Same error obtained when run on OS X.

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.