admin_timeline package¶
Subpackages¶
Submodules¶
admin_timeline.compat module¶
admin_timeline.conf module¶
- admin_timeline.conf.get_setting(setting, override=None)[source]¶
Get a setting from admin_timeline conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
admin_timeline.defaults module¶
admin_timeline.forms module¶
admin_timeline.settings module¶
Override the following values in your global settings module by adding ADMIN_TIMELINE_ prefix to the values. When it comes to importing the values, import them from admin_timeline.settings module (without the ADMIN_TIMELINE_ prefix).
NUMBER_OF_ENTRIES_PER_PAGE: Number of entries per page.
SINGLE_LOG_ENTRY_DATE_FORMAT: Date format for the single log entry. Default value is “g:i:s A”.
LOG_ENTRIES_DAY_HEADINGS_DATE_FORMAT: Day headings date format. Default value is “l j F Y”.
DEBUG
admin_timeline.tests module¶
admin_timeline.urls module¶
admin_timeline.views module¶
- admin_timeline.views.log(*args, **kwargs)[source]¶
Get number of log entires. Serves both non-AJAX and AJAX driven requests.
Since we have a breakdown of entries per day per entry and we have an AJAX driven infinite scroll and we want to avoid having duplicated date headers, we always pass a variable named “last_date” when making another request to our main AJAX-driven view. So... this is our case scenario:
Initial timeline rendered as a normal HTML (non AJAX request) (from a list of log entries). We send date of last element as “last_date” to the context too, which will be used an an initial value for a global JavaScript variable. Later on that date will be used to send it to the AJAX driven view and used in rendering (“render_to_string” method). After we have rendered the HTML to send back, we get the last date of the last element and send it along with the HTML rendered to our view in JSON response. When receiving the JSON response, we update the above mentioned global JavaScript variable with the value given.
Parameters: - request – django.http.HttpRequest
- template_name – str
- template_name_ajax – str
Returns: django.http.HttpResponse
This view accepts the following POST variables (all optional). :param page: int - Page number to get. :param user_id: int - If set, used to filter the user by. :param last_date: str - Example value “2012-05-24”. :param start_date: str - If set, used as a start date to filter the actions
with. Example value “2012-05-24”.Parameters: end_date – str - If set, used as an end date to filter the actions with. Example value “2012-05-24”. NOTE: If it gets too complicatd with filtering, we need to have forms to validate and process the POST data.