{% extends 'admin/master.html' %} {% block body %}
The pages here let you directly edit the database of the site. The editing interface is somewhat low-level, so before you use it you should probably know more about the internals of the site.
The MeieRaha database consists of four tables, which you might or might not need to edit: Settings, Users, Datasets and Visualizations.
The Settings table currently contains some global parameters used in the application:
DEFAULT_VISUALIZATION_ID
parameter determines what visualization is shown when the user enters the main page of the website. You may edit the value of this parameter
to any integer, which is a valid id of one of the Visualization entries.
INFO
and INFO_<lang>
parameters contain HTML code that is displayed in the "Info" box of the site.The Users table is what you expect it to be - a list of users. The user credentials are only checked when this
administration interface is accessed, and no matter what username you log in under, you will have full access. Hence, although
you may in principle add users, a single admin
user should suffice. You may want use the interface to edit the password, though.
Note that the password is stored in the database in encrypted form. However, when you edit the record, you should enter it in plaintext, and it will be automatically encrypted as necessary.
The entries of the Datasets table represent separate panels in the MeieRaha visualization. A single visualization references three Datasets: the left panel, the right panel and the "comparison bubbles".
The Dataset record contains two fields: title
and data
. The first one is just a descriptive string,
that is useful to identify the meaning of the dataset in the table of the admin interface (it is not displayed anywhere else).
The second stores the content of a dataset is stored as a JSON record. The record must contain the fields:
id
: integer ID of the bubble. All ids of the bubbles must be differentlabel
: textual label of the corresponding bubble. Make it reasonably short.
If you need a longer explanation, provide it in the description
field (see below).amount
: monetary amount, which also determines the size of the bubbleThe record may in addition, optionally contain the fields:
label_<lang>
: localized value of the label for a given language.description
and description_<lang>
: a longer description (possibly localized) for the given bubble. It is shown on
the tooltip that appears when mouse is hovered over a bubble.color
: a valid HTML color string. Forces the corresponding bubble to have that color.actualFillAmount
: a positive number, which depicts how much of a bubble is "filled".plannedFillAmount
: a positive number, which depicts how much of a bubble is "planned to be filled".
This value makes most sense in the context of "revisions" (see below). Whenever for some revision the actualFillAmount
is not specified,
the corresponding plannedFillAmount
is looked up instead.children
: a list of child records, each itself a valid record.
A dataset may contain several "revisions".
If it is the case, all the fields of the record except children
may contain instead of a single value a list of values or an object of values. For example, suppose that the visualization
has revisions "R1"
, "R2"
, and "R3"
. In this case, the following are valid examples of an amount
field:
amount: 1000
, indicates the amount is 1000 for all three revisionsamount: [100, 200, 300]
, indicates the amount has value 100 for revision R1
, 200 for revision R2
and 300 for revision R3
amount: {"R1":100, "R2":200, "R3": 300}
, is equivalent in meaning to the above notation,amount: [100, 200]
is equivalent to amount: [100, 200, 200]
and amount: {"R1":100, "R2":200}
,amount: {"R1":100, "R3":300}
is equivalent to amount: [100, 100, 300]
,amount: {"R2":100}
is equivalent to amount: [0, 100, 100]
.
Special logic is used to interpret revisioned values of the actualFillAmount
and plannedFillAmount
.
As noted above, actualFillAmount
is used to determine the displayed "filling" of the bubble, however if for some revision it is
not specified, value of plannedFillAmount
will be used if available.
You can also use revisions for label
and color
fields, however note that if you specify
label: {"R2": "Something"}
, the system will not be able to guess a reasonable value for the label at revision R1
.
The list of revisions of a multi-revision visualization must be specified within the meta
field of the Visualization object (see below).
The Dataset database entry also has a title
field, which is only used to identify the meaning of the dataset in the database for convenience.
The entries in Visualization correspond to actual visualizations, available on the site. Each entry is specified by providing
references to three Dataset entries (the left, the right and the comparison panels) a title
(to help identify
the record in the admin interface for the DB administrator) and a meta_data
JSON record.
The meta_data
record must have the field title
which will be shown on the website to identify the visualization.
In addition, the following optional fields are supported:
title_<lang>
: localised title.hide
: when this is "true", the resulting dataset is not shown in the list of available datasets on the main page.multiyear
: when this is "true", the revisions are assumed to correspond to different years rather than modifications of the same budget for one year.
The difference is in how the tooltip is displayed (for a single year budget revisions you will see things like "initial/planned" and "current/adjusted" values).show_info_panel
: when this is "true", an info panel is displayed automatically whenever the visualization is opened (the Armenia guys wanted this behaviour).revisions
: a list of objects, describing revisions. Each object must contain fields id
, label
and, possibly,
label_<lang>
. If such field is available, both left and right datasets are assumed to have multiple versions,
corresponding to those revisions (see above). The visualization will allow switching between the versions.