llazzaro / django-scheduler

A calendaring app for Django.
BSD 3-Clause "New" or "Revised" License
1.3k stars 393 forks source link

Unpersisted occurrences don't work #554

Open h3x4git opened 1 year ago

h3x4git commented 1 year ago

301

This is still an issue. Unpersisted occurrences, whether their event has a frequency rule declared or not, they still give you this error. I haven't been able to see this working yet. Persisted occurrences work fine.

Schermata del 2023-03-26 16-19-50

I'm using version 0.10.1 on test, development and production environment. Versions of Django tested: 4.1.7 (test), 3.2.16 (dev and production)

Maybe there is some bug?

The class-based view that fails is OccurrencePreview , I also tried to add a DetailView mixin. I couldn't get it to create an "object" attribute, not even by using super().get_object()

h3x4git commented 1 year ago

May I kindly ask anyone if this feature works for them and under which versions of this package and Django?

I'm running out of ideas

fatboystring commented 1 year ago

@h3x4git I've just opened a pull request that should fix this issue here:

https://github.com/llazzaro/django-scheduler/pull/555

Would appreciate it if you would be able to check out that branch to see if it fixes your issue. Many thanks

h3x4git commented 1 year ago

Hello, I tried your fix and I don't get the AttributeError anymore. I get a Not Found error now, but I'm customizing django-scheduler URLs in this project so I don't think this is related to your fix. I tried your code both in production and in the development environment: no AttributeError at all, I think you solved the problem! Thank you for your work and for the heads-up

h3x4git commented 1 year ago

I checked and it seems I get the IndexError exception of line 183 inside get_object of OccurrencePreview. The URL path calling the view is the same as the original, it just comes after one further string for a more meaningful URL structure (I added "calendar/"). The path in this example is /calendario/occurrence/2/2023/7/11/2/2/15/

llazzaro commented 1 year ago

The branch is ready to merge. @fatboystring, what do you think about @h3x4git comments?

h3x4git commented 1 year ago

The issue is with another PR I had already applied https://github.com/llazzaro/django-scheduler/pull/488. That URL path I mentioned seems to work fine on a test project, where the only difference with the one giving errors is I didn't use neither django-polymorph onto the Event table nor the Abstract model base setting. I started anew with the abstract version to make sure there was no contamination between environments. With the original Event model it works.

h3x4git commented 1 year ago

Any news, anyone? I looked into it but I don't see how the event = get_object_or_404(Event, pk=self.kwargs["event_id"]) inside the OccurrencePreview class view would not be compatible with and Abstract model base.. what will the course of action be? Will you only merge one of the two PRs?