Skip to content

Latest commit

 

History

History
82 lines (65 loc) · 2.7 KB

CONTRIBUTING.md

File metadata and controls

82 lines (65 loc) · 2.7 KB

How to contribute?

Install all requirements and clone the repository. Create zorza/localsettings.py and there, add DEBUG=True and a random string SECRET_KEY. You can use head /dev/urandom | base64 for that.

Run the site locally with python3 manage.py runserver. Now you can create a branch for a feature or a bug fix and send a pull request!

SCSS is used for stylesheets, so install sassc or other .scss to .css compiler if you want to change them.

Python style

SCSS and HTML style

Classes should be lowercase with dashes between words, eg. example-div.

Make use of HTML5 tags like <main>, <section>, don't add classes when not necessary.

Don't use inline styling (<div style="...">).

Use i18n ({% load i18n %} and {% trans "string to translate" %}).

In HTML emphasize meaning over presentation (known as semantic HTML), for example use <strong> instead of <b>. Try to make the content accessible for all people, on all devices.

In HTML use tabs for indendation. HTML tags should increase the indendation level, Django tags should not.

Yes, many nested Django tags will be now hard to read, but that means the template logic is too complicated. You can try to simplify it or split into child templates.
Template sample:

<div>
	{% for key, value in dict.items %}
	<div id="key-{{ key }}">
		{{ value }}
		{% if cond %}
		True
		{% endif %}
	</div>
	{% endfor %}
</div>

CSS style sample:

$primary-color: #123456;
.class { // space before opening bracket on the same line
	font-family: "Roboto", sans-serif;
	// Prefer double quotes, put space after commas.
	// Don't have lines longer than 80 characters.
	// Use tabs for indentation.

	color: $primary-color;
	&:hover {
		text-decoration: underline;
	}
	// Make use of SCSS features like inheritance and variables.
}

Translations

Extract strings to translate with python3 manage.py makemessages -l <LANGUAGE_CODE>. Then, you can edit the strings in locale/<LANGUAGE_CODE>. To compile the translations, use python3 manage.py compilemessages. Remember to set your LANGUAGE_CODE in settings to see the websites in your language.

Other resources