<commit_before>import logging
from django.conf import settings
from django.views import generic

from .models import Article
from .forms import ArticleForm, DoiForm

logger = logging.getLogger(__name__)


class DoiFormView(generic.FormView):
    form_class = DoiForm
    template_name = 'compendia/doi.html'


class ArticleListView(generic.ListView):
    model = Article
    template_name = 'compendia/index.html'
    paginate_by = 25

    def get_queryset(self):
        return Article.objects.filter(status__iexact=Article.STATUS.active)


class ArticleDetailView(generic.DetailView):
    model = Article
    template_name = 'compendia/detail.html'

    def get_context_data(self, **kwargs):
        context = super(ArticleDetailView, self).get_context_data(**kwargs)
        context['static_url'] = settings.STATIC_URL.rstrip('/')
        return context


class ArticleCreateView(generic.edit.CreateView):
    model = Article
    form_class = ArticleForm
    template_name = 'compendia/create.html'<commit_msg>require signin to create compendia<commit_after>import logging
from django.conf import settings
from django.views import generic

from braces.views import LoginRequiredMixin

from .models import Article
from .forms import ArticleForm, DoiForm

logger = logging.getLogger(__name__)


class DoiFormView(generic.FormView):
    form_class = DoiForm
    template_name = 'compendia/doi.html'


class ArticleListView(generic.ListView):
    model = Article
    template_name = 'compendia/index.html'
    paginate_by = 25

    def get_queryset(self):
        return Article.objects.filter(status__iexact=Article.STATUS.active)


class ArticleDetailView(generic.DetailView):
    model = Article
    template_name = 'compendia/detail.html'

    def get_context_data(self, **kwargs):
        context = super(ArticleDetailView, self).get_context_data(**kwargs)
        context['static_url'] = settings.STATIC_URL.rstrip('/')
        return context


class ArticleCreateView(LoginRequiredMixin, generic.edit.CreateView):
    model = Article
    form_class = ArticleForm
    template_name = 'compendia/create.html'
{'fraction_non_alphanumeric': 0.08806818181818182, 'fraction_numerical': 0.001893939393939394, 'mean_word_length': 4.309045226130653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6938949', 'n_tokens_mistral': 635, 'n_tokens_neox': 604, 'n_words': 134}