mirror of
https://github.com/kristoferssolo/FOSSDB.git
synced 2025-10-21 17:50:35 +00:00
Moved License model to separate folder
This commit is contained in:
parent
743035a9b5
commit
fdf8833523
@ -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)
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
9
FOSSDB_web/apps/fossdb/license/forms.py
Normal file
9
FOSSDB_web/apps/fossdb/license/forms.py
Normal 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"]
|
||||
11
FOSSDB_web/apps/fossdb/license/models.py
Normal file
11
FOSSDB_web/apps/fossdb/license/models.py
Normal 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
|
||||
@ -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'),
|
||||
),
|
||||
]
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user