GithubHelp home page GithubHelp logo

Comments (6)

brutasse avatar brutasse commented on May 27, 2024

Yes, templates!

In my projects, I just don't use the as_* methods. I have a template that iterates over the form and renders it using

tags, or divs, or whatever. For instance: https://gist.github.com/789448

This way, you can create several templates with several rendering strategies, all you need is to include the correct template.

So, I'm not sure any sort of modification of the form class is required... What do you think? Maybe the docs should encourage the use of templates instead of Form.as_*, but this technique is already explained in the Django documentation.

from django-floppyforms.

poswald avatar poswald commented on May 27, 2024

Yes, Django has this pretty well documented in the forms section. I assume you call your form from the template with that include statement:

 {% include "form_snippet.html" with form=comment_form %}

I was thinking of making the as_* method override as a way to ensure existing code could be ported with a simple import change and make sure everything is using the same templates. I suppose it's not strictly necessary.

from django-floppyforms.

brutasse avatar brutasse commented on May 27, 2024

Oh I see, you want to replace every bit of Django code that generates HTML with string interpolation :)

I understand your point though, providing a way to define / customize Form.as_something would be nice. I'll put that in the "nice to have" features, when all fields and widgets from Django have a floppyforms replacement.

from django-floppyforms.

Natim avatar Natim commented on May 27, 2024

That's it, all fields and widgets from Django have now a floppyforms replacement :)

from django-floppyforms.

maraujop avatar maraujop commented on May 27, 2024

I believe this problem is widely solved by django-uni-form and you can use it in conjuction with floppyforms without problems.

from django-floppyforms.

brutasse avatar brutasse commented on May 27, 2024

#35 has been merged, as_* now use templates :)

from django-floppyforms.

Related Issues (20)

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.