mirror of
https://github.com/kristoferssolo/FOSSDB.git
synced 2025-10-21 17:50:35 +00:00
Renamed Project.author to Project.owner
This commit is contained in:
parent
7166099b72
commit
558a52d319
@ -20,7 +20,7 @@ class ProjectHostingPlatformInline(admin.TabularInline):
|
||||
|
||||
class ProjectAdmin(admin.ModelAdmin):
|
||||
inlines = [ProjectHostingPlatformInline, ProjectProgrammingLanguageInline]
|
||||
list_display = ("name", "author", "_languages")
|
||||
list_display = ("name", "owner", "_languages")
|
||||
|
||||
def _languages(self, object):
|
||||
return " | ".join([i.programming_language.name for i in object.projectprogramminglanguage_set.all()])
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.2 on 2023-06-26 14:06
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fossdb', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='project',
|
||||
old_name='author',
|
||||
new_name='owner',
|
||||
),
|
||||
]
|
||||
@ -12,7 +12,7 @@ User = settings.AUTH_USER_MODEL
|
||||
|
||||
class Project(models.Model):
|
||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, verbose_name="ID")
|
||||
author = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
|
||||
owner = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True, default="")
|
||||
license = models.ManyToManyField(License, blank=True)
|
||||
@ -26,12 +26,12 @@ class Project(models.Model):
|
||||
|
||||
@property
|
||||
def absolute_url(self):
|
||||
return f"/{self.author.name}/{self.name}"
|
||||
return f"/{self.owner}/{self.name}"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.author} | {self.name}"
|
||||
return f"{self.owner} | {self.name}"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.uuid:
|
||||
self.uuid = uuid.uuid3(uuid.uuid4(), f"{self.author.username}-{self.name}")
|
||||
self.uuid = uuid.uuid3(uuid.uuid4(), f"{self.owner.username}-{self.name}")
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user