I'm currently working on a project to implement a Django interface to an existing calendar application. The calendar application has MySQL as the backend DB.
In our custom application we would like to modify/extend the data in one of the tables used by the existing calendar application e.g.
# Auto-generated by inspectdb - table used by calendar application
class CalendarEvent(models.Model:)
name = models.CharField(max_length=80)
start_time = models.DateTimeField()
end_time = models.DateTimeField()
# Manually created table
class CustomCalendarEvent(models.Model:)
code = models.CharField(max_length=80) # Mapped from name
length = models.DateTimeField() # start_time - stop_time
.... additional data ....
We would also like our representation of the data to remain in sync with the existing calendar table i.e. when new entries are made in the calendar application these would automatically propagate to our custom table.
I can think of a couple of obvious ways in which to do this (e.g. a synchronisation script initiated by cron or maybe MySQL triggers) but I don't feel that these solutions are particular elegant.
One possibility is to use a Custom Manager for the CustomCalendarEvent and override the *get_query_set* functionality to also trigger a synchronisation function.
Is this a legitimate use of Django CustomManagers? If not can anybody recommend an alternative approach to this problem?