linuxsoftware / ls.joyful

An alternative front-end for the Joyous Wagtail Calendar.
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Joyful calendar "Today" #1

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi, How can the "Today" button be enabled on the calendar ? It appears to be disabled by default. My bad, its disabled in the current month view.

ghost commented 3 years ago

I was looking for a listing of today's events

linuxsoftware commented 3 years ago

Try the following to get a 'Day view'. Sorry, I have not tested this code, so it might not be quite right.

from ls.joyful.models import FullCalendarPage
FullCalendarPage._meta.get_field('view_choices').choices = [
                       ('L', "List View"),
                       ('W', "Weekly View"),
                       ('M', "Monthly View"),
                       ('D', "Daily View")]

I think this will add a Daily View option under the Settings tab of your calendar, which can then be enabled.

Let me know if you have trouble and I'll take a closer look.

ghost commented 3 years ago

Hi David,

Thanks for the reply, I am a complete beginner when it comes to code.
I could not find where to insert your solution. However after searching through the plugin I modified joyous/models/calendar.py

EVENTS_VIEWCHOICES = [('L', ("List View")), ('W', ("Weekly View")), ('M', ("Monthly View")), ('D', _("Daily View")), ] viewchoices = MultipleSelectField(("view choices"), blank=True, default=["L","W","M","D"], choices=EVENTS_VIEW_CHOICES)

To my complete surprise this worked !! I have the option of selecting the “day” in the calendar settings.

If I have done something wrong could you point me to the file that I should of modified with your solution.

Thanks

Terence Desborough

38 Narcamus Crescent Shailer Park Q 4128 Ph: 0409 059 461 email: @.***

On 31 Jul 2021, at 7:27 am, David Moore @.***> wrote:

FullCalendarPage._meta.get_field('view_choices').choices = [ ('L', "List View"), ('W', "Weekly View"), ('M', "Monthly View"), ('D', "Daily View")]

linuxsoftware commented 3 years ago

Hi Terence,

Glad that worked for you. The problem with directly changing the ls.joyous source files is those files will be overwritten if you upgrade or re-install Joyous and then you'll have to make the changes again. If you're happy with that, then no problem, go with that.

Otherwise, the code I suggested was meant to go in one of your own applications. Either in a models.py or wagtail_hooks.py file. Sorry I didn't make that clear. And, if your Wagtail project has multiple applications then any one of them will do, just pick the application that makes the most sense (e.g. if you have an events application it could go there.)

Hope that helps.

ghost commented 3 years ago

Hi David, Thanks for that, I would rather not touch the source files and I’ll try your method. I am attempting to build a client booking app for a home cleaning service and joyous was the only plug-in I could find with recurring events. The others weren’t very well documented for beginner’s but I am enjoying myself. My personal challenge is to build the client model that can save the data to the calendar. I would prefer to use a web based form instead of going into wagtail admin to add events. I really appreciate your help.

Thanks Terry

Sent from my iPad

On 31 Jul 2021, at 6:26 pm, David Moore @.***> wrote:

 Hi Terence,

Glad that worked for you. The problem with directly changing the ls.joyous source files is those files will be overwritten if you upgrade or re-install Joyous and then you'll have to make the changes again. If you're happy with that, then no problem, go with that.

Otherwise, the code I suggested was meant to go in one of your own applications. Either in a models.py or wagtail_hooks.py file. Sorry I didn't make that clear. And, if your Wagtail project has multiple applications then any one of them will do, just pick the application that makes the most sense (e.g. if you have an events application it could go there.)

Hope that helps.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.