Giter Club home page Giter Club logo

Comments (14)

batiste avatar batiste commented on June 10, 2024

If you need hierarchical categories, what's wrong with using the natural hierarchies for the categories? Eg. all the pages under the root page "products" are in the category "products". But yes I agree that if you need an empty page for it it's a bit it's hackish.

But why not using taggit field should fit this need instead? It seems it could "fix" exactly your problem here? The only issue I see is that tags are not strict and you can tag a pages with both categories.

There is no category on a roadmap right now because tags are just the same but more flexible. It might be too flexible depending of your needs. That I can understand.

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

If I had like an h4 tag in the footer or something, that approach might be a bit hackish.

I'll look into tags, that might actually work... Either that or see if it's a hard pull request to do, because of course
something more integrated into the excellent CMS admin would be easier for other users too :)

Thanks!

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

You could also make a category placeholder... It would be very simple with a select widget.

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

That's something that would be ready to integrate into the CMS

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

How do you mean? With CMS models somehow?

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

I'm thinking a new model, in a dropdown, and settable only for parent pages, ie. pages without parents, and a method to get the menu of only that one category. That would make a lot of sense imo.

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

Pseudo code:

class CategoryPlaceholderNode(PlaceholderNode):
    def get_widget(self, page, language, fallback=Textarea):
        categories = ... # get the categories from settings or another model?
        return CategorieWidget(choices=categories)

You can then controle which page has this placeholder depending of the template.

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

http://pythonhosted.org/django-page-cms/placeholders.html#create-your-own-placeholder

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

Aah, yes of course, that kind of placeholder. Didn't even think of that :) Seems like a sweet idea.

I investigated django-taggit and though it seems like a fine project, it doesn't really offer the UX we need here so some work will be required. Let's see where this ends up :)

Thanks!

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

You don't even need to create a placeholder node. You can just create the proper widget and use "with":

http://pythonhosted.org/django-page-cms/placeholders.html#the-widget-option

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

Oh whoah, the placeholders can be used outside rendered blocks. I was about to comment that this is a nice mechanism for it, with the exception that the category would get rendered.

Now if it was a new model and a selection widget, the users could decide on whether or not they want to render it on the page. That's good flexibility.

Would you be opposed to a pull request that introduces a Category model, a bit like the Alias stuff there?

This would end up looking a bit like something of a foreign key. There might be a slug identifier for urls. Some
template tags for getting menu trees and pages by category.

All that would make it an official feature of the CMS :)

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

What do you think about languages for category slugs?

I added them just now to have everything fit in, as it might make sense to have localized names for these.

What I don't really see here is the template designer's point of view. For example the get_page template tag takes a slug or id, and that's dependent on the language anyway. Like if I have a page with the language 'fi-fi' and the slug 'joo' and another page with the language 'en-us' and the slug 'yes', I can't get to 'yes' in any way if my language setting is 'fi-fi'. I think idea is that templates should somehow be parsed based on the language even before calling get_page?

Pseudocode in view:

context['page_slug'] = get_page_slug_for('default-language-slug', user_lang)

Pseudocode in template:

{{ get_page page_slug as page }}

This would be the same for categories.

For us this is not an issue, as we're doing Finnish only for the moment.

Therefore I think the language setting for a slug could go in and there could be a template tag for
retrieving top-level pages for that category, so menus can be constructed based on those.

There might be a need for some caching, as the db hammering can easily go crazy with this.

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

You completely lost me I don't know what you are doing :-) I will need to read you code carefully to understand. It seems like such a simple problem and you came with such a complex solution that I probably don't understand properly what you are doing.

To answer you if I am opposed to add a model like PageAlias: Not fundamentally but it has to be useful for more than one person.
I am not sure anybody has ever used the PageAlias other than the guy that inserted in the CMS in the first place. I see that it can be useful but not for everybody.

So I would be careful before adding non optional addition to the CMS. But I am thinking having a "plugins" directory in the CMS with pluggable django apps could make a lot of sense.

from django-page-cms.

mjtorn avatar mjtorn commented on June 10, 2024

I didn't intend any complexity, though in my defense I'll say it's not that complicated. It's just a bunch of commits. And we may want to revert some of the commits where I experimented with breaking things out into mixins. They seemed like a test-worthy approach but don't necessarily serve any purpose anymore...

Anyway, now that the code is out there in PR #80 we can discuss it there to keep things cleaner here :)

from django-page-cms.

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.