Skip to content

Commit

Permalink
Merge pull request #764 from sapuri/delete-news
Browse files Browse the repository at this point in the history
main: delete news page and news model
  • Loading branch information
sapuri authored Mar 9, 2024
2 parents c0840a6 + 151a1d1 commit 60dba51
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 889 deletions.
9 changes: 1 addition & 8 deletions main/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from main.models import Difficulty, Level, Sran_Level, Music, Medal, Bad_Count, Extra_Option, News, Activity
from main.models import Activity, Bad_Count, Difficulty, Extra_Option, Level, Medal, Music, Sran_Level


class DifficultyAdmin(admin.ModelAdmin):
Expand Down Expand Up @@ -42,12 +42,6 @@ class Extra_OptionAdmin(admin.ModelAdmin):
ordering = ('-id',)


class NewsAdmin(admin.ModelAdmin):
list_display = ('id', 'music', 'kind', 'created_at', 'status')
list_filter = ('kind', 'status')
ordering = ('-id',)


class ActivityAdmin(admin.ModelAdmin):
list_display = ('id', 'music', 'user', 'updated_at', 'status')
list_filter = ('user', 'status')
Expand All @@ -61,5 +55,4 @@ class ActivityAdmin(admin.ModelAdmin):
admin.site.register(Medal, MedalAdmin)
admin.site.register(Bad_Count, Bad_CountAdmin)
admin.site.register(Extra_Option, Extra_OptionAdmin)
admin.site.register(News, NewsAdmin)
admin.site.register(Activity, ActivityAdmin)
16 changes: 16 additions & 0 deletions main/migrations/0003_delete_news.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.4 on 2024-03-09 18:29

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('main', '0002_alter_activity_music_alter_bad_count_music_and_more'),
]

operations = [
migrations.DeleteModel(
name='News',
),
]
22 changes: 0 additions & 22 deletions main/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import datetime, timedelta

from django.db import models
from django.utils import timezone

from users.models import CustomUser

Expand Down Expand Up @@ -212,27 +211,6 @@ class Meta:
]


class News(models.Model):
KIND_CHOICES = (
('新規', '新規'),
('レベル更新', 'レベル更新'),
('S乱レベル更新', 'S乱レベル更新'),
('削除', '削除'),
)

music = models.ForeignKey(Music, verbose_name='曲', on_delete=models.CASCADE)
kind = models.CharField('種類', max_length=10, choices=KIND_CHOICES)
created_at = models.DateField('作成日', default=timezone.now)
status = models.BooleanField('状態', default=True)

def __str__(self):
return '%s - %s' % (self.music, self.kind)

class Meta:
verbose_name = 'News'
verbose_name_plural = 'News'


class Activity(models.Model):
""" 更新履歴 """
music = models.ForeignKey(Music, verbose_name='曲', on_delete=models.CASCADE)
Expand Down
835 changes: 0 additions & 835 deletions main/templates/main/news.html

This file was deleted.

6 changes: 0 additions & 6 deletions main/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ def test_get_authenticated_user(self):
self.assertEqual(200, resp.status_code)


class NewsTests(TestCase):
def test_get(self):
resp = self.client.get(resolve_url(f'{APP_NAME}:news'))
self.assertEqual(200, resp.status_code)


class SearchTests(TestCase):
def test_get(self):
resp = self.client.get(resolve_url(f'{APP_NAME}:search'))
Expand Down
4 changes: 2 additions & 2 deletions main/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.urls import path
from django.views.generic import TemplateView

from .views import api, difflist, difflist_level_select, edit, index, level, level_select, news, omikuji, ranking, ranking_detail, ranking_level_select, search
from .views import api, difflist, difflist_level_select, edit, index, level, level_select, omikuji, ranking, \
ranking_detail, ranking_level_select, search

app_name = 'main'
urlpatterns = [
path('', index.index, name='index'),
path('news/', news.news, name='news'),
path('search/', search.search, name='search'),
path('level/', level_select.level_select, name='level_select'),
path('level/<int:level>/', level.level, name='level'),
Expand Down
15 changes: 0 additions & 15 deletions main/views/news.py

This file was deleted.

2 changes: 1 addition & 1 deletion srandom/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.conf import settings
from django.conf.urls import include
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [
Expand Down

0 comments on commit 60dba51

Please sign in to comment.