generic.Keyword duplicated as Category app = Problem!

8 views
Skip to first unread message

Robert Moggach

unread,
Feb 15, 2016, 10:34:55 PM2/15/16
to Mezzanine Users
I'm having a problem where I've essentially duplicated much of the builtin code (including javascript) for the generic.Keyword app and split it out into my own "categories" app which is an MPTT tree of categories. Everything has been duplicated throughout and renamed correctly to refer to 'categories' instead of 'keywords'. It's working... until I submit.

I think the problem is the AJAX request that returns a list of ids is just a list of numbers and has no notion of model. As a result I get double the assignment of keywords and categories or when I remove a keyword from a model the category with the same id is deleted. I'm guessing it's doing two quick AJAX requests and given it's asynchronous the data is used for both?

Any ideas? 

Thinking I'll have to adjust my 'categories_field.js' javascript to be a little more model aware than the built in 'keywords_field.js' along with removing the 'get_or_create' part in the keyword view.

Stephen McDonald

unread,
Feb 15, 2016, 10:42:26 PM2/15/16
to Mezzanine Users

On Tue, Feb 16, 2016 at 2:30 PM, Robert Moggach <r...@moggach.com> wrote:
Everything has been duplicated

Are you sure?


--
Stephen McDonald
http://jupo.org

Robert Moggach

unread,
Feb 15, 2016, 10:52:50 PM2/15/16
to Mezzanine Users, st...@jupo.org
yeah... even found the base_site.html customization below...

    window.__admin_keywords_submit_url = '{% url "admin_keywords_submit" %}';
    window.__admin_categories_submit_url = '{% url "admin_categories_submit" %}';

I think it's the button.click() that's doing it... double submit??
Reply all
Reply to author
Forward
0 new messages