Coder Social home page Coder Social logo

Comments (8)

dimkoug avatar dimkoug commented on May 18, 2024

In the class based view for example in the CreateView in the form_valid method you can add a message for example "the object saved". Read the django documentation about messages framework on how to do it.

from tododjangoccb.

infosrabah avatar infosrabah commented on May 18, 2024

Hi dimkoug thatnk's for the answer,

Actually it does work, I used :

class TodoCreateView(SuccessMessageMixin, AjaxCreateView, CmsCreateView):
...
	success_url = reverse_lazy('todo:todoList')
	success_message = _("<strong>ToDo</strong> added successfully.")
...

But after you refresh the page with is not very great to be step ahead of a message, I mean when you create the "Todo" it refresh the list (not the page), and if you go to somewhere or another page you got the message. !!

is there a way to overide the refresh list to refresh the page, I mean let the Create Class View handle the redirection to success_url ??? not just refrech the table list. but the whole page redirection.

Please Help

Thank you.

from tododjangoccb.

dimkoug avatar dimkoug commented on May 18, 2024

Hello infosrabah, the class based view by default redirects to the success_url. You can read more about the classed based views in the django documentation. The purpose of this application i wrote is to override the default django behaviour and to give ajax, modal popup functionallity to the class based views. If you want full page reload use the default class based views of the django framework.

from tododjangoccb.

infosrabah avatar infosrabah commented on May 18, 2024

I know that class based view redirect by default, that the behaviour that I want it, and I was so amazed about the functionnality of this project like Modals (Amazing), but I'm knida into the middle : Modal for the ajax form and success_url redirection for the django message framework, I need to see the message if a CRUD happend.

And I already read about it in doc, my question is how to override your Ajax refresh list to get it back to django success_url once the form is valid ?

is there some kind of code , can you tell me what should I do, what code should I change,

My knowledge in Ajax and jQuery are very limited I'm sorry (almost None). and the fact that this is your project you certenly now how to make it work that way .!

I need that functionnality (Modal Ajax + Django message), there's a project in github also, but there's a problem with Django message, but your project alreasy shows the message , but the problem is to refresh the page (a real get http) not the table.

Please.

from tododjangoccb.

dimkoug avatar dimkoug commented on May 18, 2024

Remove the AjaxCreateView and try again. Read the django documentation the class based views section.

from tododjangoccb.

infosrabah avatar infosrabah commented on May 18, 2024

I did, the request went well :

31/Aug/2018 14:48:42] "GET /todo/todo/todo/add/ HTTP/1.1" 200 4293

But the Moldal won't show up !! ??

Any idea ?

from tododjangoccb.

dimkoug avatar dimkoug commented on May 18, 2024

The modal shows when you Have the ajaxCreateView. So if you want both you have to show or hide the messages via ajax. I don't have that functionallity in my project.

from tododjangoccb.

infosrabah avatar infosrabah commented on May 18, 2024

Is that hard to implement, can you point me to how you do it ?

If it is hard, thank you, I will drop it.

thank you dimkoug.

from tododjangoccb.

Related Issues (8)

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.