tags.md 911 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1 2 3
Tags
=====

4
To simplify the general `backend` architecture and allow for some generality, a *tagging* system has been put in place.
Florent Chehab's avatar
Florent Chehab committed
5

6 7
A *Tag* is kind of Django model that contains the definition of its field (and the associated constraints) in its `config` attribute.
All information provided by the user is then stored in `JSON` format.
Florent Chehab's avatar
Florent Chehab committed
8

9
At this point, all `City`, `University`, `Campus` and `Country` models can be associated with any tag through `XXXXXTaggedItem` class.
Florent Chehab's avatar
Florent Chehab committed
10

11
A `tag` is configured with a `JSON` that looks like this:
Florent Chehab's avatar
Florent Chehab committed
12 13 14

```json
{
15
    "name of the field":{
Florent Chehab's avatar
Florent Chehab committed
16 17 18 19 20 21 22
        "type": "????",
        "required": bool,
        "validators" : {
            "name_validator_1" : ...
        }
}
```
23 24

At this point, `type` and `validators` may be:
Florent Chehab's avatar
Florent Chehab committed
25
- 'text' :
26
  - `max_length` to constrain the length of the text.
Florent Chehab's avatar
Florent Chehab committed
27
- 'url' :
28 29
  - `extension` : The constrain the extension (right `.` part) of the url.
- `list` : TODO