Giter Site home page Giter Site logo

linuxsoftware / ls.joyous Goto Github PK

View Code? Open in Web Editor NEW
73.0 5.0 32.0 2.27 MB

A calendar application for Wagtail

License: BSD 3-Clause "New" or "Revised" License

Python 89.99% CSS 4.40% CoffeeScript 1.52% JavaScript 0.31% HTML 3.61% Makefile 0.18%
wagtail calendar groupware events

ls.joyous's People

Contributors

acerix avatar jornevl avatar linuxsoftware avatar lyralemos avatar pandevmonium avatar paperreduction avatar tjwalch avatar yukilab2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ls.joyous's Issues

Extending ls.joyous for writing pages

Hi, and thanks for making ls.joyous.

I need to extend Wagtail with "tasks" to manage the writing of blog posts (add deadlines to writing, reviewing and publishing, and reschedule on a monthly basis).
I'm wondering if I could extend ls.joyous "events" for that purpose.

I'm expecting a negative reply, but I'd appreciated it if you have recommendations on more suited apps to extend from.
Otherwise, I'll start building a new wagtail-tasks application from scratch for that purpose, following the wagtail-review logic.

Add Context to TemplateResponse

hey there,

with joy I found that serve functions now are returning a TemplateResponse. Nevertheless I struggle to update the context (and am afraid it is because of my inexperience). I tried to add to my model:

def serveMonth(self, request, year=None, month=None):
        cxt = self._getContext()
        cxt.update({'test': "test"})
        return TemplateResponse(request, "joyous/calendar_week.html", cxt)

But that throws me an error:
'EventCalendarPage' object has no attribute '_getContext'

I can’t even find _getContext() anywhere in the code. Am I that far off with this approach?

Just returning an empty dict cxt = {} works. But yeah …

(Btw. is it ok to ask stuff like that here? Or should I use Stack Overflow? Maybe for visibility resons?)

Cheers
Ronald

Localization

I'd like to help with the localization of Joyous. I would go like this:

  1. Update my fork
  2. run django-admin makemessages --locale=de in the module root
  3. ask for a pull request

ok?

Japanese translation

  • Japanese i18n resource
  • presentation format (such as year - month - day presentation order)

Needs documentation

Yes this project lacks documentation. Please let me know what I should cover. What questions would you like answered?

Joyous EventBase.status field clashes with Django-Model-Utils StatusModel.status field

@sam-mi reports:

Event.status fieldname clashes with Django Model Utils Model.status field making subclasses of ls.joyous EventBase incompatible with any project that already implements Model Utils StatusField in their models.

I assume https://github.com/jazzband/django-model-utils is the correct homepage for Django Model Utils?

Pull request #34

This would break backwards compatibility for Joyous so would have to go in a 2.0 release.

Rename these protected methods

Promote these methods from protected to public, i.e. remove the _.

_nextOn becomes nextOnWhen to make it clear it returns a string (like the when property). _occursOn becomes doesOccurOn to make it clear that it returns a Boolean.

Old Name New Name
Calendar._getEventsOnDay Calendar.getEventsOnDay
Calendar._getEventsByDay Calendar.getEventsByDay
Calendar._getEventsByWeek Calendar.getEventsByWeek
Calendar._getUpcomingEvents Calendar.getUpcomingEvents
Calendar._getPastEvents Calendar.getPastEvents
Calendar._getEventFromUid Calendar.getEventFromUid
Calendar._getAllEvents Calendar.getAllEvents
RecurringEventPage._nextOn RecurringEventPage.nextOnWhen
RecurringEventPage._occursOn RecurringEventPage.doesOccurOn

A few issues

These are occurring both on my site and the demo.

In case this matters, I'm in pacific time zone and the client website is in USA/Central.

Events that haven't passed are showing in the Past events.
IE an event posted for 2-2-19 @ 5pm is showing in past events at 2-2-19 @ 1 pm.

(in demo)In the admin page event entry, I enter times as 2019-02-02 Start 5:00pm - US/Central and publish. The live page shows my event at Sunday 3rd of February at 12pm

Docs on updating joyous

I was looking for information on how to update joyous in my project. I'm using it in a wagtail project. If I look at my requirements.txt file I see I am running ls.joyous==0.8.3. I see it also installed a number of other dependencies. If I change that to the current stable in requirements.txt and run pip install, will it also install/upate the dependencies?

Suggestion: Sync with google

There are a few project: Python Google Calendar API or django-google-calendar allows Python to read and write to a given Google calendar.

How about adding hooks to your code so that when events are created, assuming the client_secret.json file is present, then new calendar events (pages) would also populate Google calendar. Also some sort of hook (perhaps a cron) to merge events from Google calendar into Joyous.

Update Out of the box tutorial images

Redo the screen shots with the plain calendars given with just joyous.css.

TODO later, create a tutorial on basic configuration, including the JOYOUS_THEME_CSS setting.

Wagtail 4.0 compatibility

I notice Wagtail 3.0 has been added to master but not in the latest release. We're now at Wagtail 4. Any plans on making it compatible?

Joyous raises error with Django 3.2.17 Wagtail 2.16.3 and Python 3.9

Installation works but raises error at runtime. Traceback below
File "/Users/dreed/Documents/pycharm/paleocore-lite/venv/lib/python3.9/site-packages/ls/joyous/models/init.py", line 12, in
from .recurring_events import RecurringEventPage
File "/Users/dreed/Documents/pycharm/paleocore-lite/venv/lib/python3.9/site-packages/ls/joyous/models/recurring_events.py", line 40, in
from ..holidays import Holidays
File "/Users/dreed/Documents/pycharm/paleocore-lite/venv/lib/python3.9/site-packages/ls/joyous/holidays/init.py", line 8, in
from .parser import parseHolidays
File "/Users/dreed/Documents/pycharm/paleocore-lite/venv/lib/python3.9/site-packages/ls/joyous/holidays/parser.py", line 21, in
_PYTHON_HOLIDAYS_MAP = _createMap(list(python_holidays.dict.items()))
File "/Users/dreed/Documents/pycharm/paleocore-lite/venv/lib/python3.9/site-packages/ls/joyous/holidays/parser.py", line 17, in _createMap
obj = cls()
TypeError: init() missing 2 required positional arguments: 'h1' and 'h2'
make: *** [migrate] Error 1

This error may stem from a revision to the Python holiday library. The error arises because the base class HolidaySum is not removed from holidayMap list, and HolidaySum takes two required arguments on initialization. The error arises in ls.joyous.holidays.parser, specifically line 17 in the _createMap function where there is an attempt to create an instance of a class with the call obj = cls(). This works for most of the classes that are iterated in the function except for the base class and some other exceptions. A fix is to add in one additional condition to the if clause. Revising the function like this works.

def _createMap(symbols):
    holidayMap = {}
    for (name, cls) in symbols:
        if (type(cls) is type(object) and
            issubclass(cls, python_holidays.HolidayBase) and
            cls is not python_holidays.HolidayBase and cls is not python_holidays.HolidaySum):
            holidayMap[name] = cls
            obj = cls()
            if hasattr(obj, "country"):
                holidayMap.setdefault(obj.country, cls)
    return holidayMap 

Upgrade - no calendar

I tried upgrading our website with the new calendar. All of my events disapeared and I don't have any css. I'm trying to figure out what went wrong. Here is the calendar:

https://lafayetteumc.com/calendar/

I had a previous version installed. Those events are still in the backend, but nothing is showing on the website. This is how I installed:

  1. Run pip install --upgrade --upgrade-strategy eager -r requirements.txt
  2. Run ./manage.py migrate
  3. Run ./manage.py collectstatic --no-input
  4. Add any desired settings. For maximum consistency consider adding the following settings:
    JOYOUS_THEME_CSS = "/static/joyous/css/joyous_coast_theme.css"
    JOYOUS_DATE_FORMAT = "l jS \o\f F X"
    JOYOUS_DATE_SHORT_FORMAT = "j F Y"
    JOYOUS_TIME_FORMAT = "fq"

Customizing calendar templates

Hey there,

first a big thank your for work in this code. I am a Python newbie and it is the first time I explore Django/Wagtail (and related apps like this) beyond the bare basics. Reading through your documentation and the source code I manged to implement two (seperated) calendars and even make my event models inherit from the joyous ones. But now I am stuck. My question:

Is there a way to alter the HTML used for the rendering of the calendar views such as the list of the upcoming events (calendar_list_upcoming.html)? I know the files live in the modules template folder, but it seems a bit odd to me to change them there.

I managed to set custom templates for the inherited event models by setting the template attribute but can't make it happen for the calendars since they take multiple HTML-files.

cheers.

'WSGIRequest' object has no attribute 'site'

Hello,

I'm running into a 'WSGIRequest' object has no attribute 'site' error when trying to access a CalendarPage on my app (python 3.7.6, django 3.1, wagtail 2.10.1, wagtail_modeltranslation 0.10.14).

I was able to reproduce it with the orange-wagtail-site.
After installing wagtail_modeltranslation, I create a new CalendarDemo. On preview/live view, I get the error.
If I create a FullCalendar instead, I don't get the error.

Environment:


Request Method: GET
Request URL: http://localhost/calendardemo/

Django Version: 3.1
Python Version: 3.7.6
Wagtail Version: 2.10.1
WagtailModelTranslation Version: 0.10.14
Installed Applications:
['wagtail_modeltranslation',
 'wagtail_modeltranslation.makemigrations',
 'wagtail_modeltranslation.migrate',
 'home',
 'events',
 'website',
 'dashboard',
 'ls.joyous',
 'ls.joyful',
 'wagtail.contrib.modeladmin',
 'wagtail.contrib.forms',
 'wagtail.contrib.redirects',
 'wagtail.embeds',
 'wagtail.sites',
 'wagtail.users',
 'wagtail.snippets',
 'wagtail.documents',
 'wagtail.images',
 'wagtail.search',
 'wagtail.admin',
 'wagtail.core',
 'modelcluster',
 'taggit',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'wagtail.contrib.redirects.middleware.RedirectMiddleware',
 'ls.joyous.middleware.UserTimeZoneMiddleware']


Traceback (most recent call last):
  File "/Users/pierregm/Work/workspace/sandbox/wagtail/orange-wagtail-site/.venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/pierregm/Work/workspace/sandbox/wagtail/orange-wagtail-site/.venv/lib/python3.7/site-packages/wagtail/core/models.py", line 1590, in _get_response
    response = page.serve_preview(request, preview_mode)
  File "/Users/pierregm/Work/workspace/sandbox/wagtail/orange-wagtail-site/.venv/lib/python3.7/site-packages/wagtail/contrib/routable_page/models.py", line 126, in serve_preview
    return view(request, *args, **kwargs)
  File "/Users/pierregm/Work/workspace/sandbox/wagtail/orange-wagtail-site/.venv/lib/python3.7/site-packages/ls/joyous/models/calendar.py", line 156, in routeDefault
    return self.serveMonth(request, year)
  File "/Users/pierregm/Work/workspace/sandbox/wagtail/orange-wagtail-site/.venv/lib/python3.7/site-packages/ls/joyous/models/calendar.py", line 215, in serveMonth
    'events':       self._getEventsByWeek(request, year, month)})
  File "/Users/pierregm/Work/workspace/sandbox/wagtail/orange-wagtail-site/.venv/lib/python3.7/site-packages/ls/joyous/models/calendar.py", line 457, in _getEventsByWeek
    home = request.site.root_page

Exception Type: AttributeError at /calendardemo/
Exception Value: 'WSGIRequest' object has no attribute 'site'

getAllUpcomingEvents

Hi!
I was using getAllUpcomingEvents in a tag to create a list of upcoming events. I just updated to 0.9.0 and the only thing not working is pulling the upcoming event date information. I was using 'when' 'title' 'url' but when isn't working. Has this been changed/retitled? I'm new to this...

Thx

Issues trying to use Modeltranslation

Report from @vbroskas :

I'm running into some issues trying to use Modeltranslation with the joyous calendar. When I add the translation options as you have above I get this error:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/checks.py", line 63, in get_form_class_check
    if not issubclass(edit_handler.get_form_class(), WagtailAdminPageForm):
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 369, in get_form_class
    widgets=self.widget_overrides())
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py", line 64, in get_form_for_model
    return metaclass(class_name, (form_class,), form_class_attrs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/wagtail/admin/forms/models.py", line 66, in __new__
    new_class = super(WagtailAdminModelFormMetaclass, cls).__new__(cls, name, bases, attrs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/modelcluster/forms.py", line 245, in __new__
    new_class = super(ClusterFormMetaclass, cls).__new__(cls, name, bases, attrs)
  File "/home/lo/Code/clients/nmafc/venv/lib/python3.6/site-packages/django/forms/models.py", line 266, in __new__
    raise FieldError(message)
django.core.exceptions.FieldError: Unknown field(s) (utc2local, upload) specified for CalendarPage

If I take the calendar page out of my translation.py file, i then run into an error where I can't publish a calendar page. I get a validation error saying that the title field can't be empty, even though I have it filled in.

Any ideas? Thanks for any help you can provide!

Originally posted by @vbroskas in #2 (comment)

Version 1.4.0 incompatible with holidays v0.13

When updating a project I ran into the below error. It seems to come from a compatibility issue with holidays v0.13. When holding holidays to 0.12 or 0.11the error went away.

File "/usr/local/lib/python3.8/site-packages/ls/joyous/models/init.py", line 12, in
from .recurring_events import RecurringEventPage
File "/usr/local/lib/python3.8/site-packages/ls/joyous/models/recurring_events.py", line 40, in
from ..holidays import Holidays
File "/usr/local/lib/python3.8/site-packages/ls/joyous/holidays/init.py", line 8, in
from .parser import parseHolidays
File "/usr/local/lib/python3.8/site-packages/ls/joyous/holidays/parser.py", line 21, in
_PYTHON_HOLIDAYS_MAP = _createMap(list(python_holidays.dict.items()))
File "/usr/local/lib/python3.8/site-packages/ls/joyous/holidays/parser.py", line 17, in _createMap
obj = cls()
TypeError: init() missing 2 required positional arguments: 'h1' and 'h2'

Python 3.8
Django 3.1
ls.joyous 1.4.0
wagtail 2.12

Feature for setting multi time-ranges in same day

Hi there, thanks for this great app, it looks quite promising.

We have been working in several projects with Agendas and there is a real need to have same event running in several times of same day, kind of Guided Tours or Talks in a Museum or so.

Do you have in mind this improvement, I think an approach could be to switching to use an InlinePanel for the time range, allowing user to add more than once.

Thanks in advance,

Simplify CSS

joyous.css is complicated and carries a lot of style that the user may not want. I want to strip it down to the bare structural basics that will display elements in appropriate places, but without pushing colour or font choices. The stripped out presentation styles can go into new theme CSS files which the user can optionally choose to import if they wish.

This change will change/break the appearance of old sites! Please comment if that is a problem for you. It needs to be done before 1.0.

Ongoing events

Hi! quick question. I have multi-day events that disappear from my events list calendar while they are ongoing. Example "Ice Fest" runs from 1/10 to 1/12 but on 1/11 is not listed on my events list view or my Upcoming Events snippet. The event does show up on my calendar view.

Is there a way around this behavior that I can add to my code for list/upcoming views? maybe a future checkbox on the event that "Show until event past"?

This would also be nice for visitors to the site to see what time the event goes till even after it has started.

API Access

I do not see any API access as part of the project.

We can easily update the views for Month, week and list view, but we would like to have in-page views of the Event and Day views, using some javascript/React.

I don't see any API to get the list of events for a day (or anything else). That might be a nice addition.

Saving events with same title fails

Hi, and many thanks for this cool project! I want to use it as a workout tracker, so I'll have repeating events that are not recurrent events, e.g. Deadlifts.
Wagtail refuses to save EventPages with the same slug. It's not a big deal to update the slug manually, but it would be nice if jouyous would take care of that automatically. I can imagine several use cases where it can happen over time that someone tries to create a new event with a title that already has been used at some point before.
I have created a small WIP PR with an approach based on https://stackoverflow.com/a/43803611

If you think that's a good idea, I'm happy to add tests, or maybe even a settings flag if you think it would be better to make this optional.

Merging events from two calendars...

I've been loving Joyous Calendar and Wagtail so much. It's just great software.

I have a main CalendarPage at the root of my site where I'd like to keep events that should display on all other calendars on the site. How would I reach back up to that calendar to display those events on a calendar that exists down the page tree? I'm using a custom class based on CalendarPage as my sub-calendars, so I tried to get the top-level CalendarPage and the merge the events, but I get a "Models aren't loaded yet." error.

Any ideas on this problem?

Problems with rendering

Trying to install Joyous into a site based on the Backery Demo.

The calender seems to render without any formatting.

I create a new simple site and I get a similar result.
new virtualenv
pip3 install wagtail
wagtail start caltest
cd caltest
pip3 install -r requirements.txt
./manage.py migrate
add ls.joyous to the settings/base.py
New page -> calender.

looks like this (crammed into one corner of browser window).

Working site: https://pasteboard.co/IuDxQio.png
New simple site: https://pasteboard.co/IuDwuNd.png

New Day view

Make day view more like weekly and monthly views

Add Daily View to EVENTS_VIEW_CHOICES.

Do not redirect to the event when there is only one event for that day.

  • If D is in view_choices
  • If default_view == D
  • If ?view=day

Unless ?view=event, then redirect to the event when there is only one event

Add navigation prev day/near by days/next day

Rename PageCalendar._getContext

It is confusing because it only returns the common part of the context. Especially confusing as Page.get_context returns all the context.

Maybe rename it _getCommonContext?

custom formatting of dateFormat

Is it possible to reformat the output of dateFormat(when) without editing telltime.py?

I have been trying via templatetags but I have had no luck so far.

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.