Package: django-timelines
This provides a back-end forTimelines JS 3. You can use external links to media
or link to internal objects.Initial SetupInstall it viapip:pip install django-timelinesModifyINSTALLED_APPS:INSTALLED_APPS = [
    ...
    "contentrelations",
    "timelines",
]SetTIMELINES_BACKGROUND_IMAGE_MODELsetting before you migrate the app. This model should be a photo management application that you use. This setting allowsswapperto set up the relationship between that model and thetimelinesmodels:TIMELINES_BACKGROUND_IMAGE_MODEL = "media.Photo"SetTIMELINES_SETTINGS. TheBACKGROUND_IMAGE_RELATED_FIELDis the actualFileFieldorImageFieldon theTIMELINES_BACKGROUND_IMAGE_MODEL:TIMELINES_SETTINGS = {
    'BACKGROUND_IMAGE_RELATED_FIELD': 'photo',
}Creating AdaptersIn order to use an existing model in your timelines, you need to create an adapter for it. The adapter allows you to customize or map the information required by Django Timelines to your model. A couple of notes about adapters:The adapter for a modeldoes notneed to be in the same application as the model. This allows you to adapt models installed viapipand which you have no control.Django Timelines will import theadaptersmodule for every installed application at startup. That’s a good place to put your adapters.Adapter Examplefrom timelines.registration import registry, TimelineAdapter
from .models import Photo


class PhotoAdapter(TimelineAdapter):
    def get_headline(self):
        return self.instance.title

    def get_clickthrough_url(self):
        return self.instance.get_absolute_url()

    def get_credit(self):
        return self.instance.taken_by

    def get_text(self):
        return self.instance.description

    def get_media_url(self):
        return self.instance.photo.url

    def get_thumbnail(self):
        return self.instance.photo.url

registry.register(Photo, PhotoAdapter)Using adaptersAdapters define several attributes and their accessor methods.clickthrough_urlandget_clickthrough_url(): a URL that, if provided, adds a “READ MORE” link to the description. ReturnNoneto omit link.creditandget_credit(): the credit information for the media provided.headlineandget_headline(): the headline for the slide.media_urlandget_media_url(): the URL to the media for the slide.textandget_text(): the text of the slide.thumbnailandget_thumbnail(): a thumbnail for the timelineTo minimize the amount of work you have to do, the adapter is smart enough to look for the attribute name on the model instance. Instead ofadapter.get_headline()you should just useadapter.headlineso the adapter can use its internal logic to get the correct value.When you access one of the required attributes, the adapter first tries theget_FOO()method. If the value returned is “falsey”_, then the adapter looks for the attribute on the model instance. So if your model already has atextattribute, you do not need to define aget_textmethod unless you wish to modify the value.Defining media for a Timeline or SlideBoth Slides and Timelines (for the title slide) define a piece of media to show on the slide. Django Timelines allows either the specifying of an external URL or a link to an internal object. The benefit of an internal object link, is that it can provide the values for the other fields for you, and modifications of the object automatically appear on the timeline.Even if you specify an internal object, you can still override the values provided by that model’s adapter.Specify the media:For external URLs, simply enter the value in theMedia URLfield.For internal objects, select the model from theMedia content typefield (only models with registered adapters are shown). Then click on the magnifying glass icon to open a window to browse for an object. You can also create a new object on the fly here.Set the content fields:For external URLs, you must set appropriate values manually.For interal objects, the help text under each of the fields will tell you the default as determined from the model’s adapter. You only need to enter values if necessary.Modify the background(optional)ClickUse media as backgroundto use the URL or object specified in #1 as the background for the slide.You can specify an alternative image to use as the background by specifying aBackground image.You can specify a color for the background (default is white).Creating a TimelineFollow the instructions above inDefining media for a Timeline or Slideto specify the title slide information and background.In theOther Informationsection, you can alter theScale, addEras(seeErasbelow) and mark the Timeline asPublished.Adding slides to a TimelineClick onAdd another Slide.Click on the magnifying glass icon.Select or create a slide. Once you have saved the Timeline, you will see summary data about the slide and a link to edit the slide.TimelineJS has the ability to organize events in the same row or adjecent rows based on theirgroup. You can fill in the group attribute if necessary.Enter in theOrderif necessary. Slides are automatically sorted by their date. However, since several events could have the same date, use the order field for fine control over them.Creating a SlideSet a start date and optional time. SeeDates, times and resolutionbelow for more information regarding dates.Optionally set an end date and time.Set the media and content according toDefining media for a Timeline or Slideabove.Dates, times and resolutionYou can specify a date with variable resolution. The allowed resolutions are:Year(e.g. 1776)Month(e.g. July 1776)Date(e.g. July 4, 1776)Datetime(e.g. July 4, 1776 at 5:24 PM)Dates are sorted from lowest resolution to heighest resolution, in that:Year resolution is sorted before January 1 of the same year. Consider it January 0th of that year.Month resolution is sorted before the 1st of the month of that year. Consider it the 0th of the specified month.Date resolution is sorted before Midnight of that date. Consider it the -1 AM of that date, since Midnight is 0.Datetime resolution is sorted according to the time.ErasEras are used to label a span of time on the timeline navigation component. Eras are reusable across Timeline objects. They consist of a start and end date and an optional label.