-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
delete a4 tables, organisation models and reset home migrations.
run 'python manage.py migrate --fake home zero' and 'python manage.py migrate --fake-initial' to fix the migration state
- Loading branch information
Showing
54 changed files
with
387 additions
and
3,608 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 3.2.20 on 2024-09-10 15:03 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.RunSQL( | ||
sql=[ | ||
"DROP TABLE IF EXISTS background_task", | ||
"DROP TABLE IF EXISTS background_task_completedtask", | ||
"DROP TABLE IF EXISTS a4categories_category", | ||
"DROP TABLE IF EXISTS a4comments_comment", | ||
"DROP TABLE IF EXISTS a4maps_areasettings", | ||
"DROP TABLE IF EXISTS a4phases_phase", | ||
"DROP TABLE IF EXISTS a4polls_answer", | ||
"DROP TABLE IF EXISTS a4polls_othervote", | ||
"DROP TABLE IF EXISTS a4polls_vote", | ||
"DROP TABLE IF EXISTS a4polls_choice", | ||
"DROP TABLE IF EXISTS a4polls_question", | ||
"DROP TABLE IF EXISTS a4polls_poll", | ||
"DROP TABLE IF EXISTS a4modules_item", | ||
"DROP TABLE IF EXISTS a4modules_module", | ||
"DROP TABLE IF EXISTS a4projects_project_moderators", | ||
"DROP TABLE IF EXISTS a4projects_project_participants", | ||
"DROP TABLE IF EXISTS a4projects_project", | ||
"DROP TABLE IF EXISTS a4ratings_rating", | ||
"DROP TABLE IF EXISTS a4reports_report", | ||
"DROP TABLE IF EXISTS a4administrative_districts_administrativedistrict", | ||
], | ||
reverse_sql=migrations.RunSQL.noop, | ||
) | ||
] |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 3.2.20 on 2024-09-10 14:38 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('euth_organisations', '0006_update_parler_field'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name='organisationtranslation', | ||
unique_together=None, | ||
), | ||
migrations.RemoveField( | ||
model_name='organisationtranslation', | ||
name='master', | ||
), | ||
migrations.DeleteModel( | ||
name='Organisation', | ||
), | ||
migrations.DeleteModel( | ||
name='OrganisationTranslation', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +0,0 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
from django_countries import fields as countries_fields | ||
from parler.models import TranslatableManager | ||
from parler.models import TranslatableModel | ||
from parler.models import TranslatedFields | ||
|
||
from adhocracy4.images import fields | ||
from adhocracy4.models import base | ||
|
||
|
||
class OrganisationManager(TranslatableManager): | ||
def get_by_natural_key(self, name): | ||
return self.get(name=name) | ||
|
||
|
||
class Organisation(base.TimeStampedModel, TranslatableModel): | ||
name = models.CharField( | ||
max_length=512, | ||
unique=True, | ||
verbose_name=_('title') | ||
) | ||
slug = models.SlugField(max_length=512, unique=True) | ||
|
||
translations = TranslatedFields( | ||
description_why=models.TextField(), | ||
description_how=models.TextField(), | ||
description=models.TextField(), | ||
) | ||
|
||
initiators = models.ManyToManyField(settings.AUTH_USER_MODEL) | ||
image = fields.ConfiguredImageField( | ||
'heroimage', | ||
upload_to='organisations/images', | ||
blank=True, | ||
verbose_name=_('Header image'), | ||
help_prefix=_( | ||
'The image sets the atmosphere for your organisation page.' | ||
), | ||
) | ||
logo = fields.ConfiguredImageField( | ||
'logo', | ||
upload_to='organisations/logos', | ||
blank=True, | ||
help_prefix=_( | ||
'The official logo of your organisation.' | ||
), | ||
) | ||
twitter_handle = models.CharField(max_length=200, blank=True) | ||
facebook_handle = models.CharField(max_length=200, blank=True) | ||
instagram_handle = models.CharField(max_length=200, blank=True) | ||
webpage = models.URLField(blank=True) | ||
country = countries_fields.CountryField() | ||
place = models.CharField(max_length=200) | ||
|
||
objects = OrganisationManager() | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
def has_social_share(self): | ||
return ( | ||
self.twitter_handle or self.facebook_handle | ||
or self.instagram_handle or self.webpage | ||
) | ||
|
||
def has_initiator(self, user): | ||
return user in self.initiators.all() | ||
|
||
def get_absolute_url(self): | ||
from django.urls import reverse | ||
return reverse('organisation-detail', args=[str(self.slug)]) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.