Comments (11)
Yeah, It can be done without many problems. However, you have to consider that you will need to modify the default templates and the entries filters in routes.py
from puput.
Thanks for your prompt reply!
So, in order leave the snippet category as in puput, but pointing to "my" category, I only need to modify:
- routes.py (where?)
- default templates (which one?)
- models.CategoryEntryPage?
Best,
Fabio
from puput.
routes.py (where?)
@route(r'^category/(?P<category>[-\w]+)/$')
def entries_by_category(self, request, category, *args, **kwargs):
self.search_type = _('category')
self.search_term = category
self.entries = self.get_entries().filter(entry_categories__category__slug=category)
return Page.serve(self, request, *args, **kwargs)
default templates (which one?)
templates/puput/tags/categories_list.html
models.CategoryEntryPage?
class CategoryEntryPage(models.Model):
category = models.ForeignKey(Category, related_name="+", verbose_name=_('Category'))
from puput.
Thank you very much Marc!
Do you plan to make the category customizable by the developers without edit your core code?
Fabio
from puput.
Yeah, why not? I have to study this feature and implement it in the cleaner way.
from puput.
Great! I stay tuned then :-)
from puput.
Hi Marc,
I made the following patches and anything seems to work:
- I create an entry for the setings.py file PUPUT_CATEGORY_MODEL;
- I commented the statement @register_snippet over the "Category" definition;
- I changed the name of Category in CategoryDefault
- I added this code under CategoryDefault definition
CategoryModel = import_model(getattr(settings, 'PUPUT_CATEGORY_MODEL', CategoryDefault))
@register_snippet
class Category(CategoryModel):
objects = CategoryManager()
class Meta:
proxy = True
- I made the following change the categories_list inclusion_tag (because I don't need nested Categories)
if hasattr(Category, 'parent'):
categories = Category.objects.with_uses(blog_page).filter(parent=None)
else:
categories = Category.objects.with_uses(blog_page).all()
Do you have any kind of suggestions?
Fabio
from puput.
I create an entry for the setings.py file PUPUT_CATEGORY_MODEL;
👍
I made the following patches and anything seems to work:
- I create an entry for the setings.py file PUPUT_CATEGORY_MODEL;
- I commented the statement @register_snippet over the "Category" definition;
- I changed the name of Category in CategoryDefault
- I added this code under CategoryDefault definition
Nice approach, but I think it will be better a pattern like EntryAbstract
. You can define the default Category model in abstracts and define the actual Category in models.py like EntryPage.
- I made the following change the categories_list inclusion_tag (because I don't need nested Categories)
👍
from puput.
Thanks Mark!
I'm going to try to follow the approach suggested by you.
from puput.
@fab10m any news regarding this issue?
from puput.
Hi, @marctc I've no news. I'm stiill in the same situation of 5 months ago. Allora works fine, so I decided not to touch anything :-)
from puput.
Related Issues (20)
- Upload 1.1.2 on PyPI HOT 4
- Fix broken test suite HOT 1
- Fix broken 1.1.2 package HOT 1
- Unable to relate entry between blogs
- No CSS Styling at all after fresh deployment HOT 2
- Partially working '/blog_admin' page HOT 2
- Is markdown supported ? HOT 2
- Internal Server Error: /admin/snippets/puput/category/add/
- Expected UI issues with Wagtail 3.0 release HOT 1
- How to uninstall puput and use plain wagtail without loosing content HOT 2
- Search is only working for one tree and not searching globaly
- Any update comming for v4.1 LTS HOT 7
- New release? HOT 9
- Imports from wagtail generate deprecation warnings HOT 5
- Do not publish to RSS feed if Blog post is "Private"
- Template overrides HOT 1
- Setup instructions suggest use of deprecated wagtail middleware
- ModuleNotFoundError: No module named 'wagtail.core' on a fresh install of puput HOT 1
- wagtail 5.1 compatibility HOT 2
- Django 5 compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puput.