mirror of
https://github.com/kristoferssolo/FOSSDB.git
synced 2025-10-21 17:50:35 +00:00
Merge branch 'license' into fossdb
This commit is contained in:
commit
bccf0c08f8
@ -1,6 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import (HostingPlatform, License, ProgrammingLanguage, Project,
|
from .models import (HostingPlatform, ProgrammingLanguage, Project,
|
||||||
ProjectHostingPlatform, ProjectProgrammingLanguage, Tag)
|
ProjectHostingPlatform, ProjectProgrammingLanguage, Tag)
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +25,6 @@ class ProjectAdmin(admin.ModelAdmin):
|
|||||||
return " | ".join([i.hosting_platform.hosting_platform for i in object.projecthostingplatform_set.all()])
|
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(ProgrammingLanguage)
|
||||||
admin.site.register(HostingPlatform)
|
admin.site.register(HostingPlatform)
|
||||||
admin.site.register(Project, ProjectAdmin)
|
admin.site.register(Project, ProjectAdmin)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from .models import (HostingPlatform, License, ProgrammingLanguage, Project,
|
from .models import (HostingPlatform, ProgrammingLanguage, Project,
|
||||||
ProjectHostingPlatform, ProjectProgrammingLanguage)
|
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):
|
class ProgrammingLanguageForm(forms.ModelForm):
|
||||||
percentage = forms.IntegerField(min_value=0, max_value=100)
|
percentage = forms.IntegerField(min_value=0, max_value=100)
|
||||||
|
|
||||||
|
|||||||
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -3,17 +3,7 @@ import uuid
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
User = settings.AUTH_USER_MODEL
|
from license.models import License
|
||||||
|
|
||||||
|
|
||||||
class License(models.Model):
|
|
||||||
short_name = models.CharField(max_length=50)
|
|
||||||
full_name = models.CharField(max_length=100, blank=True)
|
|
||||||
url = models.URLField(null=True, blank=True)
|
|
||||||
description = models.TextField(null=True, blank=True)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.short_name
|
|
||||||
|
|
||||||
|
|
||||||
class ProgrammingLanguage(models.Model):
|
class ProgrammingLanguage(models.Model):
|
||||||
|
|||||||
0
FOSSDB_web/apps/license/__init__.py
Normal file
0
FOSSDB_web/apps/license/__init__.py
Normal file
5
FOSSDB_web/apps/license/admin.py
Normal file
5
FOSSDB_web/apps/license/admin.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from .models import License
|
||||||
|
|
||||||
|
admin.site.register(License)
|
||||||
6
FOSSDB_web/apps/license/apps.py
Normal file
6
FOSSDB_web/apps/license/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class LicenseConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'license'
|
||||||
9
FOSSDB_web/apps/license/forms.py
Normal file
9
FOSSDB_web/apps/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"]
|
||||||
24
FOSSDB_web/apps/license/migrations/0001_initial.py
Normal file
24
FOSSDB_web/apps/license/migrations/0001_initial.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 4.1.7 on 2023-04-08 10:14
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='License',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('short_name', models.CharField(max_length=50)),
|
||||||
|
('full_name', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
|
('url', models.URLField(blank=True, null=True)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
0
FOSSDB_web/apps/license/migrations/__init__.py
Normal file
0
FOSSDB_web/apps/license/migrations/__init__.py
Normal file
11
FOSSDB_web/apps/license/models.py
Normal file
11
FOSSDB_web/apps/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, 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
|
||||||
3
FOSSDB_web/apps/license/tests.py
Normal file
3
FOSSDB_web/apps/license/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
0
FOSSDB_web/apps/license/views.py
Normal file
0
FOSSDB_web/apps/license/views.py
Normal file
@ -37,6 +37,7 @@ ALLOWED_HOSTS = config["ALLOWED_HOSTS"]
|
|||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
"fossdb",
|
"fossdb",
|
||||||
|
"license",
|
||||||
"account",
|
"account",
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
"django.contrib.auth",
|
"django.contrib.auth",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user