Commit 26299343 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

articles

parent 12057875
...@@ -2,10 +2,10 @@ import logging ...@@ -2,10 +2,10 @@ import logging
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from rainboard.models import Forge, License, Repo
import requests import requests
from rainboard.models import Forge, License, Repo
LICENSES = 'https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json' LICENSES = 'https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json'
logger = logging.getLogger('rainboard.management.populate') logger = logging.getLogger('rainboard.management.populate')
......
# Generated by Django 2.0.1 on 2018-01-11 15:46 # Generated by Django 2.0.1 on 2018-01-11 15:46
import autoslug.fields
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
import autoslug.fields
import ndh.models import ndh.models
......
import logging import logging
from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
import requests
from autoslug import AutoSlugField from autoslug import AutoSlugField
from ndh.models import NamedModel, TimeStampedModel, Links from ndh.models import Links, NamedModel, TimeStampedModel
from ndh.utils import enum_to_choices, query_sum from ndh.utils import enum_to_choices, query_sum
import requests
from .utils import SOURCES, TARGETS from .utils import SOURCES, TARGETS
logger = logging.getLogger('rainboard.models') logger = logging.getLogger('rainboard.models')
class Article(NamedModel):
authors = models.ManyToManyField(User)
year = models.PositiveSmallIntegerField()
url = models.URLField(max_length=200)
pdf = models.URLField(max_length=200)
class Namespace(NamedModel): class Namespace(NamedModel):
group = models.BooleanField(default=False) group = models.BooleanField(default=False)
...@@ -32,6 +40,7 @@ class Project(Links, NamedModel, TimeStampedModel): ...@@ -32,6 +40,7 @@ class Project(Links, NamedModel, TimeStampedModel):
main_namespace = models.ForeignKey(Namespace, on_delete=models.SET_NULL, null=True, blank=True) main_namespace = models.ForeignKey(Namespace, on_delete=models.SET_NULL, null=True, blank=True)
license = models.ForeignKey(License, on_delete=models.SET_NULL, blank=True, null=True) license = models.ForeignKey(License, on_delete=models.SET_NULL, blank=True, null=True)
homepage = models.URLField(max_length=200, blank=True, null=True) homepage = models.URLField(max_length=200, blank=True, null=True)
articles = models.ManyToManyField(Article)
def get_absolute_url(self): def get_absolute_url(self):
return reverse('rainboard:project', kwargs={'slug': self.slug}) return reverse('rainboard:project', kwargs={'slug': self.slug})
......
from django.urls import path from django.urls import path
from django.views.generic import ListView from django.views.generic import ListView
from .models import Forge, Namespace, Project
from . import views from . import views
from .models import Forge, Namespace, Project
app_name = 'rainboard' app_name = 'rainboard'
urlpatterns = [ urlpatterns = [
......
from django.shortcuts import render from django.shortcuts import render
from django.views.generic import DetailView from django.views.generic import DetailView
from django_filters.views import FilterView
from django_tables2 import RequestConfig from django_tables2 import RequestConfig
from django_tables2.views import SingleTableMixin from django_tables2.views import SingleTableMixin
from django_filters.views import FilterView
from .filters import ProjectFilter
from .models import Forge, Namespace, Project from .models import Forge, Namespace, Project
from .tables import ProjectTable, RepoTable from .tables import ProjectTable, RepoTable
from .filters import ProjectFilter
def home(request): def home(request):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment