Coder Social home page Coder Social logo

timbest / django-multi-form-view Goto Github PK

View Code? Open in Web Editor NEW
75.0 75.0 31.0 82 KB

Django class based views for using more than one form in a single view

License: GNU General Public License v3.0

Python 87.02% Gherkin 12.98%
django django-forms django-formsets

django-multi-form-view's People

Contributors

dorkmasterflek avatar jacobwegner avatar jmcvetta avatar martinsvoboda avatar moas avatar stewartpark avatar timbest avatar timothybest 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

Watchers

 avatar  avatar  avatar  avatar  avatar

django-multi-form-view's Issues

listar los forms en el template

Cuando listo el forms me trae los form existentes, pero cuando trato de acceder a los labels y errors del un form especifico no me funciona.

Deberia funcionar asi:

{% for form in forms %}
     {% if form.errors %}
          {% for field in form %}
                {% for error in field.errors %}
                    {{ field.label }}
                    {{ error|escape }}
                {% endfor %}
          {% endfor %}
     {% endif %}
{% endfor %}

Pero lo pruebo manualmente utilizando solo un form y si funciona :

{% if forms.myform.errors %}
        {% for field in forms.myform %}
            {% for error in field.errors %}
                {{ field.label }} 
                {{ error|escape }}
            {% endfor %}
        {% endfor %}
{% endif %}

How can i filter form based on the current user?

How can i filter form based on the current login user?

ex doen't work

def __init__(self,  **kwargs):
    super().__init__(**kwargs)
    self.form.fields["field"].queryset = model.objects.filter(owner=self.request.user)

Does not work with forms of the same type

I want to implement the following structure:

  1. 1 x MasterModel (masterModelType)
  2. 2 x DetailModel (detailModelType)

The issue seems that as the fields are named exactly identically, the second form overwrites the first one.

form_classes['master_form'] = myApp_forms.SectionForm
form_classes['detail_form1'] = myApp_forms.EntryForm
form_classes['detail_form2'] = myApp_forms.EntryForm

def get_objects(self):
   return {
          'master_form': myApp_models.Section(),
          'detail_form1': myApp_models.Entry(),
          'detail_form2': myApp_models.Entry(),
        }

In this case, the data entried in the "last displayed form" is saved twice in the database.

Any ideas how to solve this?

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.