Cutting away the fat

Removed the gender selection thing as it was pointless, also trimmed the fat for the MOTDs and welcome messages.
This commit is contained in:
some weird guy
2023-07-25 20:59:06 -07:00
parent 5bab1f320a
commit 700b722736
11 changed files with 21 additions and 700 deletions
+9 -51
View File
@@ -633,13 +633,13 @@ class Community(models.Model):
if self.type == 1:
return {
0: "",
1: "3DS Games",
2: "Wii U Games",
3: "Switch Games",
4: "Wii U Games\u30FB3DS Games",
5: 'PC Games',
6: 'Xbox Games',
7: 'Playstation Games',
1: "3DS Game",
2: "Wii U Game",
3: "Switch Game",
4: "Wii U / 3DS Game",
5: 'PC Game',
6: 'Xbox Game',
7: 'Playstation Game',
}.get(self.platform)
else:
return {
@@ -1153,14 +1153,9 @@ class Profile(models.Model):
pronoun_is = models.IntegerField(default=0, choices=(
(0, "I don't know"), (1, "He/him"), (2, "She/her"), (3, "He/she"), (4, "It"), (5, "They/Them")
))
gender_is = models.IntegerField(default=0, choices=(
(0, "I don't know"), (1, "Girl"), (2, "Boy"), (3, "Minion"), (4, "Toaster"), (5, "Dinosaur"), (6, "Truck"), (7, "Robot"), (8, "Monkey"), (9, "Big chungus"), (10, "Other")
))
))
let_friendrequest = models.SmallIntegerField(default=0, choices=visibility)
yeahs_visibility = models.SmallIntegerField(default=0, choices=visibility)
comments_visibility = models.SmallIntegerField(default=2, choices=visibility)
#relationship_visibility = models.SmallIntegerField(default=0, choices=visibility)
@@ -1612,7 +1607,7 @@ class RedFlag(models.Model):
def __str__(self):
return "Report on a " + self.get_type_display() + " for " + self.get_reason_display() + ": " + str(self.reasoning)
# Login attempts: for incorrect passwords
# Login attempts:
class LoginAttempt(models.Model):
id = models.AutoField(primary_key=True)
created = models.DateTimeField(auto_now_add=True)
@@ -1689,19 +1684,6 @@ class AuditLog(models.Model):
else:
return False
# TODO: MAKE THIS ACTUALLY WORK
class Restriction(models.Model):
id = models.AutoField(primary_key=True)
created = models.DateTimeField(auto_now_add=True)
type = models.SmallIntegerField(choices=((0, "Prevent yeah"), (1, "Prevent follow"), (2, "Prevent comment"), ))
post = models.ForeignKey(Post, related_name='restriction_post', null=True, on_delete=models.CASCADE)
comment = models.ForeignKey(Comment, related_name='restriction_comment', null=True, on_delete=models.CASCADE)
user = models.ForeignKey(User, related_name='restriction_user', null=True, on_delete=models.CASCADE)
by = models.ForeignKey(User, related_name='restriction_by', on_delete=models.CASCADE)
def __str__(self):
return "Restrict " + str(self.user) + " on " + self.get_type_display() + " at " + str(self.created)
class UserRequest(User):
# USER AGENT
ua = models.TextField(default='', null=True, blank=True)
@@ -1740,18 +1722,6 @@ class Motd(models.Model):
hide_date = models.BooleanField(default=False)
image = models.ImageField(upload_to='MOTD/%y/%m/%d/', max_length=255, null=True, blank=True)
def get_one():
mesoftheday = Motd.objects.order_by('order', '-id').filter(show=True)
return mesoftheday
def motds_available():
global motdsavailable
if(Motd.objects.filter(show=True).exists()):
motdsavailable = True
else:
motdsavailable = False
return motdsavailable
class welcomemsg(models.Model):
id = models.AutoField(primary_key=True)
order = models.IntegerField(max_length=3, default=1)
@@ -1760,18 +1730,6 @@ class welcomemsg(models.Model):
Title = models.CharField(max_length=256, null=False, blank=False, default='Title')
message = models.TextField(null=False, blank=False)
image = models.ImageField(upload_to='welcomemsg/%y/%m/%d/', max_length=255, null=True, blank=True)
def get_one():
welmes = welcomemsg.objects.order_by('order', '-id').filter(show=True)
return welmes
def welcomemsg_available():
global welcomeisavailable
if(welcomemsg.objects.filter(show=True).exists()):
welcomeisavailable = True
else:
welcomeisavailable = False
return welcomeisavailable
# thing will log changes to your bio or nickname
class ProfileHistory(models.Model):
@@ -10,7 +10,7 @@
{% if user.is_warned %}
<div class="notice" style="background-color: #ffc783;border: 1px solid #ffb358;">
<p><b>WARNING</b>: You have been issued a warning by an administrator. No features have been restricted, as this is just a warning.
<p><b>WARNING</b>: You have been issued a warning by an administrator.
<div>
{% if user.get_warned_reason %}
<p>Reason: "{{ user.get_warned_reason }}"</p>
@@ -19,7 +19,7 @@
</div>
{% endif %}
{% if availablemotds and request.user.is_authenticated %}
{% if mesoftheday and request.user.is_authenticated %}
<div class="post-list-outline index-memo">
<h2 class="label">MOTD / News</h2>
{% for mesoftheday in mesoftheday %}
@@ -31,7 +31,7 @@
</div>
{% endif %}
{% if availablemes and not request.user.is_authenticated %}
{% if welmes and not request.user.is_authenticated %}
<div class="post-list-outline index-memo">
<h2 class="label">Welcome to Cedar!</h2>
{% for welmes in welmes %}
@@ -42,9 +42,6 @@
</div>
{% endif %}
{% if request.user.c_tokens > 0 %}<a class="big-button" href={% url "main:community-create" %}><span class="symbol-label">Create a community</span></a>{% endif %}
<!--
<iframe src="https://discord.com/widget?id=1001294283040620665&theme=dark" height="300" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
-->
{% if availableads %}
<div class="adx">
<h3>User-Generated Ad</h3>
@@ -1,9 +1,9 @@
{% extends "closedverse_main/layout.html" %}{% block main-body %}{% load closedverse_community %}
{% community_sidebar community request %}
<div class="main-column">
{% if user.is_warned and user.is_authenticated and user.is_active %}
{% if user.is_warned %}
<div class="notice" style="background-color: #ffc783;border: 1px solid #ffb358;">
<p><b>WARNING</b>: You have been issued a warning by an administrator. No features have been restricted, as this is just a warning.
<p><b>WARNING</b>: You have been issued a warning by an administrator.
<div>
{% if user.get_warned_reason %}
<p>Reason: "{{ user.get_warned_reason }}"</p>
@@ -22,4 +22,4 @@
</div>
</div>
{% endblock %}
{% endblock %}
@@ -172,14 +172,6 @@
</div>
</div>
{% endif %}
{% if profile.gender_is %}
<div class="data-content">
<h4><span>Gender</span></h4>
<div class="note">
<span>{{ profile.get_gender_is_display }}</span>
</div>
</div>
{% endif %}
{% if profile.external %}
<div class="data-content">
<h4><span>Discord Tag</span></h4>
@@ -136,26 +136,6 @@
</select>
</div>
</div>
</li>
<li>
<p class="settings-label"><label for="gender_select">Are you a girl, boy or something else?</label></p>
<div class="select-content">
<div class="select-button">
<select name="gender_select" id="gender_select">
<option value="0"{% if profile.gender_is == 0 %} selected{% endif %}>I don't know</option>
<option value="1"{% if profile.gender_is == 1 %} selected{% endif %}>Girl</option>
<option value="2"{% if profile.gender_is == 2 %} selected{% endif %}>Boy</option>
<option value="3"{% if profile.gender_is == 3 %} selected{% endif %}>Minion</option>
<option value="4"{% if profile.gender_is == 4 %} selected{% endif %}>Toaster</option>
<option value="5"{% if profile.gender_is == 5 %} selected{% endif %}>Dino</option>
<option value="6"{% if profile.gender_is == 6 %} selected{% endif %}>Truck</option>
<option value="7"{% if profile.gender_is == 7 %} selected{% endif %}>Robot</option>
<option value="8"{% if profile.gender_is == 8 %} selected{% endif %}>Monkey</option>
<option value="9"{% if profile.gender_is == 9 %} selected{% endif %}>Big chungus</option>
<option value="10"{% if profile.gender_is == 10 %} selected{% endif %}>Other</option>
</select>
</div>
</div>
</li>
<li>
<p class="settings-label"><label for="yeahs_visibility">Who should be able to see your Yeahs given?</label></p>
+6 -36
View File
@@ -27,8 +27,6 @@ from binascii import hexlify
from os import urandom
from datetime import date
#from silk.profiling.profiler import silk_profile
def json_response(msg='', code=0, httperr=400):
thing = {
# success would be false, but 0 is faster I think (Miiverse used 0 because Perl doesn't have bools)
@@ -46,17 +44,6 @@ def json_response(msg='', code=0, httperr=400):
return JsonResponse(thing, safe=False, status=httperr)
def community_list(request):
"""Lists communities / main page."""
msg_list = ["eat breakfast.", "The Cedar train must keep going", "be sure to drink a lot of water.", "We, crusaders, will fight for what we believe in!", "be chill, be calm.", "*insert inspiring sentence*", "this is gonna be a great day for you.", "why not try other not-usally-used features of the website?", "work is hard, but results are great!"]
msgoftheday = choice(msg_list)
#dateopening = date(2022, 7, 3)
#datehalloween = date(2022, 10, 31)
#datenow = date.today()
#age = datenow - dateopening
#halloween = datehalloween - datenow
#staff_list = User.objects.filter(staff=True)
if 'json' in request.META.get('HTTP_ACCEPT', ''):
cs = CommunitySerializer
response = {
@@ -80,30 +67,16 @@ def community_list(request):
ad = Ads.get_one()
else:
ad = "no ads"
availablemotds = Motd.motds_available()
if(availablemotds):
mesoftheday = Motd.get_one()
else:
mesoftheday = "no MOTDs"
availablemes = welcomemsg.welcomemsg_available()
if(availablemes):
welmes = welcomemsg.get_one()
else:
welmes = "no MOTDs"
WelcomeMSG = welcomemsg.objects.filter(show=True).order_by('-order', '-id')
mesoftheday = Motd.objects.filter(show=True).order_by('-order', '-id')
return render(request, 'closedverse_main/community_list.html', {
'title': 'Communities',
'ad': ad,
'mesoftheday': mesoftheday,
'welmes': welmes,
#'staff_list': staff_list,
#'age': round(age.days / 30, 2),
#'halloween': halloween.days,
'WelcomeMSG': WelcomeMSG,
'availableads': availableads,
'availablemotds': availablemotds,
'availablemes': availablemes,
'classes': classes,
'general': obj.filter(type=0).order_by('-created')[0:8],
'game': obj.filter(type=1).order_by('-created')[0:8],
@@ -120,6 +93,7 @@ def community_list(request):
},
})
def community_all(request):
# TODO, redo this completely.
"""All communities, with pagination"""
try:
offset = int(request.GET.get('offset', '0'))
@@ -423,10 +397,6 @@ def user_view(request, username):
return json_response('Big brother it\'s too big, I can\'t take it! (length '+str(len(request.POST.get('external')))+', max 300)')
if len(request.POST.get('email')) > 500:
return json_response('Big brother it\'s too big, I can\'t take it! (length '+str(len(request.POST.get('email')))+', max 500)')
# Kinda unneeded but gdsjkgdfsg
if request.POST.get('website') == 'Web URL' or request.POST.get('country') == 'Region' or request.POST.get('external') == 'DiscordTag':
return json_response("I'm laughing right now.")
if len(request.POST.get('avatar')) > 255:
return json_response('Avatar is too long (length '+str(len(request.POST.get('avatar')))+', max 255)')
if request.POST.get('email') and not request.POST.get('email') == 'None':