Moved License code to separate app

This commit is contained in:
Kristofers Solo
2023-04-08 13:16:38 +03:00
parent d5bf12cf29
commit a055cbe476
10 changed files with 71 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
from django.contrib import admin
from .models import (HostingPlatform, License, ProgrammingLanguage, Project,
from .models import (HostingPlatform, ProgrammingLanguage, Project,
ProjectHostingPlatform, ProjectProgrammingLanguage)
@@ -25,7 +25,6 @@ class ProjectAdmin(admin.ModelAdmin):
return " | ".join([i.hosting_platform.hosting_platform for i in object.projecthostingplatform_set.all()])
admin.site.register(License)
admin.site.register(ProgrammingLanguage)
admin.site.register(HostingPlatform)
admin.site.register(Project, ProjectAdmin)

View File

@@ -1,6 +1,6 @@
from django import forms
from .models import (HostingPlatform, License, ProgrammingLanguage, Project,
from .models import (HostingPlatform, ProgrammingLanguage, Project,
ProjectHostingPlatform, ProjectProgrammingLanguage)
@@ -23,12 +23,6 @@ class ProjectForm(forms.ModelForm):
}
class LicenseForm(forms.ModelForm):
class Meta:
model = License
fields = ["short_name", "full_name", "url", "description"]
class ProgrammingLanguageForm(forms.ModelForm):
percentage = forms.IntegerField(min_value=0, max_value=100)

View File

@@ -0,0 +1,22 @@
# Generated by Django 4.1.7 on 2023-04-08 10:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('license', '0001_initial'),
('fossdb', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='License',
),
migrations.AlterField(
model_name='project',
name='licenses',
field=models.ManyToManyField(to='license.license'),
),
]

View File

@@ -3,15 +3,7 @@ import uuid
from django.contrib.auth.models import User
from django.db import models
class License(models.Model):
short_name = models.CharField(max_length=50)
full_name = models.CharField(max_length=100, null=True, blank=True)
url = models.URLField(null=True, blank=True)
description = models.TextField(null=True, blank=True)
def __str__(self):
return self.short_name
from license.models import License
class ProgrammingLanguage(models.Model):