Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused Favorites module #1692

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
from comments.models import Comment
from donations.models import Donation
from forum.models import Post, Thread
from general.models import SocialModel
from geotags.models import GeoTag
from messages.models import Message
from ratings.models import SoundRating
from sounds.models import DeletedSound, License, Sound, Pack, Download, PackDownload, BulkUploadProgress
from tags.models import TaggedItem
from utils.locations import locations_decorator
from utils.mail import transform_unique_email
from utils.search import get_search_engine, SearchEngineException
Expand Down Expand Up @@ -96,7 +96,7 @@ def random_uploader():
return None


class Profile(SocialModel):
class Profile(models.Model):
user = models.OneToOneField(User, related_name="profile", on_delete=models.CASCADE)
about = models.TextField(null=True, blank=True, default=None)
home_page = models.URLField(null=True, blank=True, default=None)
Expand Down Expand Up @@ -610,7 +610,7 @@ def num_packs(self):
# Return the number of packs for which at least one sound has been published
return Sound.public.filter(user_id=self.user_id).exclude(pack=None).order_by('pack_id').distinct('pack').count()

class Meta(SocialModel.Meta):
class Meta:
ordering = ('-user__date_joined', )


Expand Down
Empty file removed favorites/__init__.py
Empty file.
35 changes: 0 additions & 35 deletions favorites/migrations/0001_initial.py

This file was deleted.

Empty file removed favorites/migrations/__init__.py
Empty file.
40 changes: 0 additions & 40 deletions favorites/models.py

This file was deleted.

Empty file removed favorites/views.py
Empty file.
1 change: 0 additions & 1 deletion freesound/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
'general.apps.GeneralConfig',
'support',
'wiki',
'favorites',
'sounds',
'comments',
'bookmarks',
Expand Down
13 changes: 1 addition & 12 deletions general/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,10 @@
# See AUTHORS file.
#
from django.contrib.auth.models import User
from django.contrib.contenttypes import fields
from django.db import models

from favorites.models import Favorite
from tags.models import TaggedItem


class SocialModel(models.Model):
tags = fields.GenericRelation(TaggedItem)
fans = fields.GenericRelation(Favorite)

class Meta:
abstract = True

class AkismetSpam(SocialModel):
class AkismetSpam(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
spam = models.TextField()
created = models.DateTimeField(auto_now_add=True)
11 changes: 6 additions & 5 deletions sounds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes import fields
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist
Expand All @@ -52,7 +53,6 @@
from comments.models import Comment
from freesound.celery import app as celery_app
from general import tasks
from general.models import SocialModel
from geotags.models import GeoTag
from ratings.models import SoundRating
from general.templatetags.util import formatnumber
Expand Down Expand Up @@ -587,7 +587,7 @@ def get_queryset(self):
return super().get_queryset().filter(moderation_state="OK", processing_state="OK")


class Sound(SocialModel):
class Sound(models.Model):
user = models.ForeignKey(User, related_name="sounds", on_delete=models.CASCADE)
created = models.DateTimeField(db_index=True, auto_now_add=True)

Expand All @@ -613,6 +613,7 @@ class Sound(SocialModel):
license = models.ForeignKey(License, on_delete=models.CASCADE)
sources = models.ManyToManyField('self', symmetrical=False, related_name='remixes', blank=True)
pack = models.ForeignKey('Pack', null=True, blank=True, default=None, on_delete=models.SET_NULL, related_name='sounds')
tags = fields.GenericRelation(TaggedItem)
geotag = models.ForeignKey(GeoTag, null=True, blank=True, default=None, on_delete=models.SET_NULL)

# fields for specifying if the sound was uploaded via API or via bulk upload process (or none)
Expand Down Expand Up @@ -1330,7 +1331,7 @@ def get_geotag_name(self):
else:
return f'{self.geotag.lat:.2f}, {self.geotag.lon:.3f}'

class Meta(SocialModel.Meta):
class Meta:
ordering = ("-created", )


Expand Down Expand Up @@ -1605,7 +1606,7 @@ def ordered_ids(self, pack_ids, exclude_deleted=True):
'''


class Pack(SocialModel):
class Pack(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
description = models.TextField(null=True, blank=True, default=None)
Expand All @@ -1630,7 +1631,7 @@ def get_absolute_url(self):
def get_pack_sounds_in_search_url(self):
return f'{reverse("sounds-search")}?f=grouping_pack:{ self.pack_filter_value() }&s=Date+added+(newest+first)&g=1'

class Meta(SocialModel.Meta):
class Meta:
unique_together = ('user', 'name', 'is_deleted')
ordering = ("-created",)

Expand Down
Loading