diff --git a/villages/managers.py b/villages/managers.py new file mode 100644 index 00000000..9966196d --- /dev/null +++ b/villages/managers.py @@ -0,0 +1,9 @@ +from django.db.models import QuerySet + + +class VillageQuerySet(QuerySet): + + def not_deleted(self): + return self.filter( + deleted=False + ) diff --git a/villages/migrations/0004_village_deleted.py b/villages/migrations/0004_village_deleted.py new file mode 100644 index 00000000..3c1e5b3a --- /dev/null +++ b/villages/migrations/0004_village_deleted.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-07-10 16:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('villages', '0003_auto_20160705_2159'), + ] + + operations = [ + migrations.AddField( + model_name='village', + name='deleted', + field=models.BooleanField(default=False), + ), + ] diff --git a/villages/models.py b/villages/models.py index aec882b9..5104b915 100644 --- a/villages/models.py +++ b/villages/models.py @@ -7,6 +7,8 @@ from django.utils.text import slugify from camps.models import Camp from utils.models import CreatedUpdatedModel, UUIDModel +from .managers import VillageQuerySet + class Village(CreatedUpdatedModel, UUIDModel): @@ -18,13 +20,21 @@ class Village(CreatedUpdatedModel, UUIDModel): name = models.CharField(max_length=255) slug = models.SlugField(max_length=255, blank=True) - description = models.TextField() + description = models.TextField( + help_text="A descriptive text about your village. Markdown is supported." + ) private = models.BooleanField( default=False, help_text='Check if your village is privately organized' ) + deleted = models.BooleanField( + default=False, + ) + + objects = VillageQuerySet.as_manager() + def __str__(self): return self.name @@ -56,3 +66,7 @@ class Village(CreatedUpdatedModel, UUIDModel): self.camp = Camp.objects.current() super(Village, self).save(**kwargs) + + def delete(self, using=None, keep_parents=False): + self.deleted = True + self.save() diff --git a/villages/templates/village_confirm_delete.html b/villages/templates/village_confirm_delete.html new file mode 100644 index 00000000..4f28b3b2 --- /dev/null +++ b/villages/templates/village_confirm_delete.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} +{% load commonmark %} + +{% block content %} + +
+{% endblock %} diff --git a/villages/templates/village_detail.html b/villages/templates/village_detail.html index c65e40bb..c5aebff5 100644 --- a/villages/templates/village_detail.html +++ b/villages/templates/village_detail.html @@ -10,7 +10,8 @@- If this is your first hackercamp the term 'Village' might be confusing but it is fairly simple: a village is just a spot on the campsite where you and a bunch of your friends/likeminded people camp together. Apart from peoples individual tents which they sleep in, many villages bring a large common tent where you can hack and hang out during the day. + If this is your first hackercamp the term 'Village' might be confusing but it + is fairly simple: a village is just a spot on the campsite where you and a + bunch of your friends/likeminded people camp together. Apart from peoples + individual tents which they sleep in, many villages bring a large common tent + where you can hack and hang out during the day. +
+ ++ + It is also possible to rent a tent, chairs and tables for villages here. +
{% if user.is_authenticated %} @@ -17,6 +27,7 @@