project can be public (default) or private
This commit is contained in:
parent
e870608072
commit
00b8ae612d
5 changed files with 27 additions and 4 deletions
|
@ -7,8 +7,8 @@ from django_markdown.widgets import MarkdownWidget
|
||||||
from issue.models import *
|
from issue.models import *
|
||||||
|
|
||||||
|
|
||||||
AddProjectForm = modelform_factory(Project, fields=['display_name', 'name', 'description'])
|
AddProjectForm = modelform_factory(Project, fields=['display_name', 'name', 'description', 'public'])
|
||||||
EditProjectForm = modelform_factory(Project, fields=['display_name', 'description'])
|
EditProjectForm = modelform_factory(Project, fields=['display_name', 'description', 'public'])
|
||||||
LabelForm = modelform_factory(Label, fields=['name', 'color', 'inverted'])
|
LabelForm = modelform_factory(Label, fields=['name', 'color', 'inverted'])
|
||||||
|
|
||||||
class MilestoneForm(forms.ModelForm):
|
class MilestoneForm(forms.ModelForm):
|
||||||
|
|
|
@ -8,5 +8,5 @@ class ProjectMiddleware:
|
||||||
if view.__module__ != 'issue.views':
|
if view.__module__ != 'issue.views':
|
||||||
return
|
return
|
||||||
|
|
||||||
projects = Project.objects.all()
|
projects = Project.objects.filter(public=True)
|
||||||
request.projects = projects
|
request.projects = projects
|
||||||
|
|
20
issue/migrations/0005_project_public.py
Normal file
20
issue/migrations/0005_project_public.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('issue', '0004_milestone_closed'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='project',
|
||||||
|
name='public',
|
||||||
|
field=models.BooleanField(default=True, verbose_name='Do unregistered users have read access to this project?'),
|
||||||
|
preserve_default=True,
|
||||||
|
),
|
||||||
|
]
|
|
@ -29,6 +29,9 @@ class Project(models.Model):
|
||||||
description = models.TextField(blank=True, default="",
|
description = models.TextField(blank=True, default="",
|
||||||
verbose_name="Description")
|
verbose_name="Description")
|
||||||
|
|
||||||
|
public = models.BooleanField(default=True,
|
||||||
|
verbose_name="Do unregistered users have read access to this project?")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
||||||
return self.display_name
|
return self.display_name
|
||||||
|
|
|
@ -10,7 +10,7 @@ import shlex
|
||||||
|
|
||||||
def project_list(request):
|
def project_list(request):
|
||||||
|
|
||||||
if not Project.objects.exists():
|
if not request.projects.exists():
|
||||||
|
|
||||||
messages.info(request, 'Start by creating a project.')
|
messages.info(request, 'Start by creating a project.')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue