Last active
August 29, 2015 14:27
-
-
Save zzgvh/73fa9495ddf4cf9f49d5 to your computer and use it in GitHub Desktop.
Dashboard models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Akvo Reporting is covered by the GNU Affero General Public License. | |
# See more details in the license.txt file located at the root folder of the Akvo RSR module. | |
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. | |
from django.db import models | |
class Dashboard(models.Model): | |
name = models.CharField() | |
class Page(models.Model): | |
dashboard = models.ForeignKey(Dashboard, related_name='pages') | |
title = models.CharField() | |
description = models.TextField() | |
class Panel(models.Model): | |
WIDTHS = [1, 2, 3, 4, 6, 12] | |
page = models.ForeignKey(Page, related_name='panels') | |
width = models.PositiveSmallIntegerField(choices=WIDTHS) | |
heigth = models.PositiveSmallIntegerField() | |
order = models.PositiveIntegerField() | |
class Widget(models.Model): | |
panel = models.ForeignKey(Panel, related_name='widgets') | |
visualization = models.OneToOneField(Visualization) | |
class Visualization(models.Model): | |
VISUALIZATION_TYPE = ('bar', 'line', 'pie', 'grid',) | |
visualization_type = models.PositiveSmallIntegerField(choices=VISUALIZATION_TYPE) | |
data_source = models.ForeignKey(DataSource) | |
parameters = models.ManyToManyField(Parameter) | |
filters = models.ManyToManyField(Filter) | |
aggregations = models.ManyToManyField(Aggregation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment