Comments (2)
Hi,
I've only just pushed the change that added _getContext to the CalendarPage model. But sorry I think I have confused you with the name. It does not give all the context you need. It only returns the common fields: self, page, version, themeCSS and today, that all the serve functions use. I should probably rename it _getCommonContext or something like that.
Possibly _getExtraContext would work for you? e.g.
def _getExtraContext(self, route):
if route == "month": # if you only want this for the month view
return {'test': "test"}
else:
return {}
Or, modifying the TemplateResponse is possible. [NB: If you want this code to be called via an URL like /calendar/2019/05/ then your EventCalendarPage class must be concrete not a proxy and the derived serveMonth method must be registered as a RoutablePageMixin. I guess you have already worked this out, but I hadn't tried it before.]
@route(r"^month/$")
@route(r"^{YYYY}/{MM}/$".format(**DatePictures))
def serveMonth(self, request, year=None, month=None):
response = super().serveMonth(request, year, month)
response.context_data.update({'test': "test"})
return response
Yes, this is a good way of raising questions. It's good to get the feedback, thanks. And I'd rather keep on using GitHub issues for this. I will see questions here quicker than on Stack Overflow. Are you able to share the full code for your Wagtail project? No worries if you can't, but if you can it might make it clearer to me what you are trying to do.
Best wishes, David.
from ls.joyous.
Hey David,
thanks again for your suggestions. I needed the weekend to read up on the concept of the super()
-class; but the solution with RouteablePageMixin
totally does it.
What I am actually trying to do (now) is to make a route for categories; i.e. query all events of category "Party" or "Concert". I am pretty confident your code snippet will lead me there. I can share code, so I might be back if I get stuck ;-)
Cheers
Ronald
from ls.joyous.
Related Issues (20)
- Suggestion: Sync with google HOT 2
- Make the Export functionality optional HOT 1
- FIRST_DAY_OF_WEEK doesn't work for monthly views HOT 3
- Ongoing events HOT 3
- Docs on updating joyous HOT 3
- Upgrade - no calendar HOT 6
- Japanese translation HOT 3
- Issues trying to use Modeltranslation HOT 14
- Joyous EventBase.status field clashes with Django-Model-Utils StatusModel.status field HOT 5
- 'WSGIRequest' object has no attribute 'site' HOT 2
- Feature for setting multi time-ranges in same day HOT 4
- Not working properly with codredcms? HOT 2
- New Day view
- Merging events from two calendars... HOT 4
- Release 1.5.0 with default_auto_field set in JoyousAppConfig HOT 2
- Version 1.4.0 incompatible with holidays v0.13 HOT 7
- Saving events with same title fails
- Incompatible with Wagtail 3
- Joyous raises error with Django 3.2.17 Wagtail 2.16.3 and Python 3.9 HOT 1
- Wagtail 4.0 compatibility
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 ls.joyous.