Moved License model to separate folder

This commit is contained in:
Kristofers Solo 2023-04-09 13:20:45 +03:00
parent 743035a9b5
commit fdf8833523
6 changed files with 27 additions and 20 deletions

View File

@ -1,6 +1,7 @@
from django.contrib import admin
from .models import (HostingPlatform, License, ProgrammingLanguage, Project,
from .license.models import License
from .models import (HostingPlatform, ProgrammingLanguage, Project,
ProjectHostingPlatform, ProjectProgrammingLanguage, Tag)

View File

@ -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,9 @@
from django import forms
from .models import License
class LicenseForm(forms.ModelForm):
class Meta:
model = License
fields = ["short_name", "full_name", "url", "description"]

View File

@ -0,0 +1,11 @@
from django.db import models
class License(models.Model):
short_name = models.CharField(max_length=50)
full_name = models.CharField(max_length=100, blank=True, default="")
url = models.URLField(blank=True, default="")
description = models.TextField(blank=True, default="")
def __str__(self):
return self.short_name

View File

@ -1,4 +1,4 @@
# Generated by Django 4.1.7 on 2023-04-08 12:47
# Generated by Django 4.1.7 on 2023-04-09 10:17
from django.conf import settings
from django.db import migrations, models
@ -93,7 +93,7 @@ class Migration(migrations.Migration):
),
migrations.AddField(
model_name='project',
name='project_type',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='fossdb.tag'),
name='tag',
field=models.ManyToManyField(to='fossdb.tag'),
),
]

View File

@ -3,19 +3,11 @@ import uuid
from django.conf import settings
from django.db import models
from .license.models import License
User = settings.AUTH_USER_MODEL
class License(models.Model):
short_name = models.CharField(max_length=50)
full_name = models.CharField(max_length=100, blank=True, default="")
url = models.URLField(blank=True, default="")
description = models.TextField(blank=True, default="")
def __str__(self):
return self.short_name
class HostingPlatform(models.Model):
hosting_platform = models.CharField(max_length=100)