Giter VIP home page Giter VIP logo

Comments (3)

climu avatar climu commented on September 3, 2024

So we can show polls in blog posts (here for instance).

I registered machina TopicPoll as a wagtail snippet added a SnippetChooserBlock to our streamfield here and adapted machina template a bit in here.
I also had to create a template tag to fetch poll form here

Sadly machina polls views will redirect to the forum post. So after voting or asking to change vote, user will come to forum post and not the blog post.

One would have to subclass TopicPollVoteView to override get_success_url.

Changing vote should be handled too as machina just add a get param ?change_vote=true.

Anyway it's a step forward.

from openstudyroom.

climu avatar climu commented on September 3, 2024

So this has created some issue.

For some reasons the above change will refer to TopicPoll as machina.core.db.models.TopicPoll in migration file.

Running migrate will hence raise AttributeError: module 'machina.core.db.models' has no attribute 'TopicPoll'.

I tried changing the import in home.models to from machina.apps.forum_conversation.forum_polls.models import TopicPoll but still migration files will refer to machina.core.db.models.TopicPoll.

Then I tried importing abstract models as follow:
from machina.apps.forum_conversation.forum_polls.abstract_models import AbstractTopicPoll as TopicPoll

This does makes migrations files consistent since they refer to machina.apps.forum_conversation.forum_polls.abstract_models.AbstractTopicPoll but we then have error at runtime type object 'AbstractTopicPoll' has no attribute 'objects.

from openstudyroom.

climu avatar climu commented on September 3, 2024

This was fixed adding TopicPoll.__module__ = "machina.apps.forum_conversation.forum_polls.models" to home.models

from openstudyroom.

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.