rename steam link to store link

This commit is contained in:
InigoAllende
2025-08-15 13:16:38 +02:00
parent f932781b1f
commit 22dee3e47a
4 changed files with 25 additions and 25 deletions

View File

@@ -20,7 +20,7 @@ class SubmissionForm(ModelForm):
'video_download_link': 'Video direct download link',
'contact_email': 'Email to Contact you',
'author_name' : 'Author or studio',
'steam_link': 'Steam store link (optional)'
'store_link': 'Store link (optional)'
}
def __init__(self, *args, **kwargs):

View File

@@ -0,0 +1,22 @@
# Generated by Django 3.2.25 on 2025-08-15 11:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vote', '0004_auto_20250814_2001'),
]
operations = [
migrations.RemoveField(
model_name='video',
name='steam_link',
),
migrations.AddField(
model_name='video',
name='store_link',
field=models.URLField(blank=True, default=''),
),
]

View File

@@ -110,28 +110,6 @@ def _validate_youtube_url(value):
except Exception:
raise ValidationError("URL must be a valid YouTube link.")
def _validate_steam_store_url(value):
"""
Validates that a given URL is a Steam Store link.
"""
try:
parsed = urlparse(value)
hostname = (parsed.hostname or '').lower()
if hostname != "store.steampowered.com":
raise ValidationError("URL must be from store.steampowered.com")
# Optional: Check path structure for app/bundle/sub with ID
steam_path_pattern = r"^/(app|bundle|sub)/\d+"
if not re.match(steam_path_pattern, parsed.path):
raise ValidationError(
"Steam Store URL must be for an app, bundle, or subscription."
)
except Exception:
raise ValidationError("Enter a valid URL.")
class Video(models.Model):
showreel = models.ForeignKey(Showreel, blank=False, on_delete=models.CASCADE)
@@ -143,7 +121,7 @@ class Video(models.Model):
video_download_link = models.CharField(max_length=200, blank=False, unique=True, validators=[URLValidator()])
contact_email = models.CharField(max_length=200, default="", blank=True, validators=[EmailValidator()])
follow_me_link = models.CharField(max_length=200, default="", blank=True)
steam_link = models.URLField(max_length=200, default="", blank=True, validators=[_validate_steam_store_url])
store_link = models.URLField(max_length=200, default="", blank=True, validators=[])
def get_youtube_video_id(self):
query = urlparse(self.video_link)

View File

@@ -224,7 +224,7 @@ class ShowreelResultsAsCSVView(LoginRequiredMixin, UserPassesTestMixin, SingleOb
ratings.append(d[(user.id, video.id)])
else:
ratings.append(None)
writer.writerow([video.author_name, video.follow_me_link, video.game, video.video_link, video.video_download_link, video.contact_email, video.steam_link] + ratings)
writer.writerow([video.author_name, video.follow_me_link, video.game, video.video_link, video.video_download_link, video.contact_email, video.store_link] + ratings)
return response