Comments (14)
The full source code for my test case is at https://github.com/linuxsoftware/joyous-issue33-mysite
from ls.joyous.
For a proper fix install ls.joyous 1.3.0 and add the setting JOYOUS_DEFEND_FORMS=True
When this setting is set to True then the Joyous page models will not allow their base_form_class to be replaced. Instead they will assimilate the newly assigned form class. The purpose of this setting is to make Joyous compatible with the wagtail-modeltranslations app. (Users who do not use wagtail-modeltranslations probably do not need to enable this option.)
I have also raised the issue with the maintainers of wagtail-modeltranslations, for better documentation if nothing else.
from ls.joyous.
As a temporary work-around I suggest adding the following code to your translation.py before you register CalendarPage for translation.
from ls.joyous.models.calendar import CalendarPageForm
CalendarPageForm.registerImportHandler = lambda *args: None
This will disable the iCal import functionality. I will continue to investigate a better solution, but this will probably require a new release of Joyous.
My most minimal translation.py file looks like this (below). I do not know why those 5 Joyous pages require registering, but others like CancellationPage, ExtraInfoPage, PostponementPage etc do not?!
from wagtail_modeltranslation.translation import TranslationOptions
from modeltranslation.decorators import register
from .models import HomePage
from ls.joyous.models import GroupPage, CalendarPage, SimpleEventPage, MultidayEventPage, RecurringEventPage
@register(HomePage)
class HomeTR(TranslationOptions):
fields = (
)
from ls.joyous.models.calendar import CalendarPageForm
CalendarPageForm.registerImportHandler = lambda *args: None
@register(CalendarPage)
class CalendarTR(TranslationOptions):
fields = (
)
@register(GroupPage)
class GroupTR(TranslationOptions):
fields = (
)
@register(SimpleEventPage)
class SimpleEventTR(TranslationOptions):
fields = (
)
@register(MultidayEventPage)
class MultidayTR(TranslationOptions):
fields = (
)
@register(RecurringEventPage)
class RecurringEventTR(TranslationOptions):
fields = (
)
from ls.joyous.
Works great, thanks for all the help @linuxsoftware !
from ls.joyous.
Another problem with this work-around is that the validation that the start-time of the event is before its end-time is now broken.
This is because wagtail-modeltranslation replaces the page's base_form_class attribute with no regard to its previous value. I intend to raise an issue for this once I have a nice simple test case for it.
from ls.joyous.
Ooops. Sorry. Looks like there is still a problem. :-( I need to test further.
from ls.joyous.
There is a new version of wagtail-modeltranslations v0.10.14, which fixes the form overwriting bug. And a new version of ls.joyous v1.3.1 which works around a problem with modeltranslation patch_constructor breaking initialization of pages which have multiple inheritance. I recommend upgrading both apps to these versions.
NB: The JOYOUS_DEFEND_FORMS
setting mentioned above is still there in ls.joyous v1.3.1, but is not needed with wagtail-modeltranslations v0.10.14.
from ls.joyous.
Also note that all pages (CancellationPage, ExtraInfoPage, PostponementPage etc) do need to be registered with modeltranslations. It may not give an error on startup, but it will error during runtime if these page types are accessed. See https://github.com/linuxsoftware/joyous-issue33-mysite/blob/master/home/translation.py for my translations file.
from ls.joyous.
Hello, Thanks for making an example site.
Although I cannot get your solution working. I keep getting this, I've the same as you on a fresh install.
Do you have a hint on what It might be?
from ls.joyous.
Can you confirm you have wagtail-modeltranslations v0.10.14 and ls.joyous v1.3.1 installed?
And, which version of Django and Wagtail are you using?
from ls.joyous.
Can you confirm you have wagtail-modeltranslations v0.10.14 and ls.joyous v1.3.1 installed?
And, which version of Django and Wagtail are you using?
I can confirm I'm using those versions.
Django: 2.2.X STABLE (LTS)
Wagtail: 2.10.1
PD: I'm using Divio and using their packages for both apps.
https://github.com/divio/aldryn-wagtail
https://github.com/divio/aldryn-django
from ls.joyous.
I suspect the problem is with trying to add an extra migration to an installed package like Joyous in this environment. Try copying the migrations from Joyous to you own app and then add a MIGRATION_MODULES entry for it to your settings.
e.g.
MIGRATION_MODULES = {
'joyous': 'home.migratejoyous'
}
Then, when you run makemigrations, the new migration should be created in this directory under your app.
I have updated https://github.com/linuxsoftware/joyous-issue33-mysite with this change.
from ls.joyous.
I suspect the problem is with trying to add an extra migration to an installed package like Joyous in this environment. Try copying the migrations from Joyous to you own app and then add a MIGRATION_MODULES entry for it to your settings.
e.g.MIGRATION_MODULES = { 'joyous': 'home.migratejoyous' }
Then, when you run makemigrations, the new migration should be created in this directory under your app.
I have updated https://github.com/linuxsoftware/joyous-issue33-mysite with this change.
Hi, I've replicated what you did on issue-33 site but I cannot even run the migrations because the same exception appears... It's quite strange. I think it has to do with Page TranslationOption, The fields that raise the error come because the page hierarchy
from ls.joyous.
I have no further suggestions. This is working for me on Divio with Aldryn-Wagtail and Aldryn-Django.
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
- 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.