Skip to content

Instantly share code, notes, and snippets.

@imagescape
Created March 3, 2017 22:01
Show Gist options
  • Save imagescape/31c373263d77efd7be44a794cbb67a5d to your computer and use it in GitHub Desktop.
Save imagescape/31c373263d77efd7be44a794cbb67a5d to your computer and use it in GitHub Desktop.
## models.py
class HourRange(models.Model):
practice = models.ForeignKey(Practice)
rules = rec_fields.RecurrenceField(
help_text='recurrences for this hour range'
)
opening_time = models.TimeField(blank=True, null=True)
closing_time = models.TimeField(blank=True, null=True)
message = models.TextField(blank=True, null=True)
normal_hours = models.BooleanField(blank=True, default=False)
## admin.py
class HourRangeInline(admin.TabularInline):
model = models.HourRange
class PracticeAdmin(admin.ModelAdmin):
...
inlines = (PracticeTypeInline, ServiceInline, ManagerInline, HourRangeInline)
...
admin.site.register(models.Practice, PracticeAdmin)
admin.site.register(models.HourRange)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment