# How do I...?¶

## ...Change the appearance of the site/content of pages?¶

To change the appearance of the site, you need to edit the CSS file “main.css” that is found in the static/ folder at the root of the project.

To change the content and specific look of pages, you need to edit the HTML files found in the templates/ folder at the root of the project. There is generally one template file for every view.

Please note that due to the nature of the site, much of the content is generated dynamically. To change how dynamic content is presented, you can also edit these HTML files. To change the actual content, you will need to change the code in webanalysis/views.py for the specific view and conent which you wish to edit.

## ...Change the ‘database’ fields?¶

In Django, all interactions with the database are actually done with Python classes, called models. Each model represents a different table in the database, and each field in the model represents a column.

Whilst it is very possible to edit the pre-existing fields that I have already written - I would not advise doing so unless absoultely nessasary as doing so may break large portions of the site, and other applications that depend on the current layout of the database, such as the analysis daemon “analysisd” and the LUCID project.

The file where models are stored is called models.py and can be found in the webanalysis folder.

When adding a new model - or changing fields, you must make migrations, and apply them to the database for the changes to take affect. When you are inside the ‘tapas’ directory you can use the following commands to do so. Be careful! Doing this can mess up your database! Make sure you have a backup.:

sudo python3 manage.py makemigrations

sudo python3 manage.py migrate


## ...Change the form fields?¶

Similarly to database fields, form fields in Django are made using classes. This allows dynamic generation of data. To change these fields, or to add new forms, you will need to edit the forms.py file in the webanalysis folder. Changing fields here does not automatically add the fields to the database, and forms set here do not automatically put data into the database. You’ll need to see the section ”...Change the ‘database’ fields?” to do some of this. You will need to edit your views in webanalysis/views.py to edit how you add data to the database from forms.

## ...Change the views?¶

To change the views, you will need to edit the file views.py in the webanalysis folder. Each view has a different function and controls a different page of the site. Therefore, what you need to change is heavily dependent on what you want to change. Each view is defined as a different Python function in this file. Every view _requires_ the ‘request’ parameter, and other parameters make up dynamic parts of the URL.

To actually make the view visible on the site, you will need to edit the analysis/urls.py file. This routes traffic to the correct function within the site. You’ll need to know a small amount of regex to do this.

If added a new view called myviewname (the function was called this) and I wanted the URL to be tapas/myviewname, I would create a URL definition as follows:

url(r'^myviewname/\$', views.myviewname, name='myviewname'),