Comments (11)
You could also check if evod.date >= today
from ls.joyous.
Just answered my own question. Copying Joyous' template files into my Wagtail site's template folder made them editable. Am I breaking things with this approach?
from ls.joyous.
Hi @Jean-Zombie
Thanks for your feedback. Good to hear Joyous is useful to you.
Yes, you've got it. Copying the templates and changing them in your project is the way to alter the HTML. You only need to copy the templates that require changes. Django will look for a template first in your project and if it doesn't find it there, then look in the ls.joyous app directory.
See https://docs.djangoproject.com/en/2.1/howto/overriding-templates/
ls.joyous hasn't reached 1.0 yet, so the template structure might still change, but I think it is pretty stable, so that is not likely.
Django template inheritance is worth knowing about too. Rather than changing the whole template. It is possible in Django to create a template that extends another. And then only change specific blocks as needed within the template. However looking at calendar_list_upcoming.html
I see I've only defined blocks around the calendar options, nothing for the events list. Is that what you wish to change? I will aim to adding some more block definitions there and throughout my templates to make them easier to inherit from.
See https://docs.djangoproject.com/en/2.1/ref/templates/language/#template-inheritance
Hope this helps.
Best wishes for your project.
David.
from ls.joyous.
Please note also that as I said in Issue #5 that I am planning on changing the CSS and the HTML classes in version 0.9. You might have to change your customisations if you want to upgrade when that happens. I hope that doesn't inconvenience you too much.
from ls.joyous.
Hey David
thank you very much for taking the time to answer and explain. I played around with template inheritance before but looking at your code helps a lot.
I am all good with changes to the CSS. I'll adapt ;-)
Regarding the list view of a calendar-page and calendar_list_upcoming.html
: I switched to the monthly view now, since I need every occurrence of an event – not only the event itself. But it can't hurt to have more block definitions.
I came across another issue/problem though. How can I pass extra context to a template? I tried to overwrite the get_context
method of my calendar page models as described in Wagtail's documentation. But I can't get extra context in.
I tried to write a custom template tag by copying the template tags folder from the Joyous module into my project. But unlike the templates themselves overwriting does not seem to work.
If you find the time to nudge me in the right direction I`d be very thankful.
Ronald
from ls.joyous.
Hi Ronald,
Adding extra context in to the calendar page templates is, right now, pretty difficult. It just wasn't coded with that in mind. I've been thinking for a while about changing from using render to returning a TemplateResponse (you might have seen the comment). Your situation makes it clear why I should do that. Then you'd be able to grab the context and change it.
If you can wait a few days I can make the change. But right now, I think your only option is a cut-n-paste of the Calendar.serveMonth code in to your own class and add your extra variables there.
For the template tags (that is joyous_tags right?) - most of them use there own little templates which are in templates/joyous/tags. Maybe a change there would work for you? Or maybe define your own template tags and use those?
Best wishes,
David.
from ls.joyous.
Hey David,
much appreciated. But don't stress it. I realized that the context was already there. I just needed to access page.get_children
for what I had in mind (get all events for a specific calendar unlike all_upcoming_events
). A bit embarrassing to bother you with it.
Nevertheless, I bet at one point down the road having a TemplateResponse for extra context will be very useful. As I see myself using Joyous way more often. And I strongly believe more people will do so ;-). I looked around and for Wagtail it is by far the best calendar solution. F.e. I tried to implement django-recurrence
myself but failed miserably.
Thx again
Ronald
from ls.joyous.
I'm glad you found a solution. Thanks for your feedback, it is very helpful for me.
from ls.joyous.
I am facing another issue. And I believe it might be useful to others.
Basically I am trying to combine serveUpcoming
and serveMonth
. I need all occurrences of an event but only those in the future. With serveMonth
I get all occurrences but also ones in the past (of that month). With serveUpcoming
I get only upcoming events, but not all occurrences.
I am looking for something like
{% for title, event in evod.days_events %}
{% if event.is_upcoming %} # this would be the missing link
{% include "events/event.html" %}
{% endif %}
{% endwith %}
Do I make sense?
from ls.joyous.
Two possible ideas
In your serve function use getAllEventsByDay(request, today, endOfMonth, home=self)
to get all the events from today until the end of the month that are children of this calendar. (You did only want ones that were children right?).
or,
Use if event._upcoming_datetime_from
as the "missing link" in your example code to check if an event is upcoming or not.
from ls.joyous.
Damn. I did not think about simply reducing the evod
's of a month. I was fixated on the event
. Check {% if evod.date >= today %}
totally did it.
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.