Commit 4a041cbf authored by Ola Hermann Opheim's avatar Ola Hermann Opheim
Browse files

project pylint fix

parent ee3fe0ca
from django import forms
from django.contrib.auth.models import User
from user.models import Profile
from .models import (
Project,
......@@ -8,7 +9,6 @@ from .models import (
ProjectCategory,
Team,
Projects)
from django.contrib.auth.models import User
class SortForm(forms.ModelForm):
......
from django.db import models
from datetime import datetime
import os
from user.models import Profile
from django.core.files.storage import FileSystemStorage
from django.conf import settings
from datetime import datetime
import os
from django.db import models
class Projects(models.Model):
......@@ -30,7 +31,7 @@ class Projects(models.Model):
class OverwriteStorage(FileSystemStorage):
def get_available_name(self, name, max_length):
def get_available_name(self, name):
"""Returns a filename that's free on the target storage system, and
available for new content to be written to.
......@@ -129,7 +130,7 @@ class Task(models.Model):
def __str__(self):
return str(self.id) + " " + self.title
def accepted_task_offer(task):
def accepted_task_offer(self, task):
task_offer = None
try:
task_offer = task.taskoffer_set.get(status='a')
......
from django.http import HttpResponse, HttpResponseRedirect
from user.models import Profile
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from .models import (
Project,
Task,
TaskFile,
TaskOffer,
Delivery,
ProjectCategory,
Team,
TaskFileTeam)
ProjectCategory)
from .forms import (
ProjectForm,
TaskFileForm,
......@@ -21,9 +18,6 @@ from .forms import (
TeamForm,
TeamAddForm,
SortForm)
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from .templatetags.project_extras import get_user_task_permissions
from .templatetags.projects_extras import sort_projects
......@@ -46,7 +40,7 @@ from .templatetags.task_view_extras import (
def projects(request):
projects = Project.objects.all()
all_projects = Project.objects.all()
project_categories = ProjectCategory.objects.all()
sort_form = SortForm()
......@@ -54,23 +48,21 @@ def projects(request):
sort_form = SortForm(request.POST)
if sort_form.is_valid():
sort_form.save(commit=False)
projects = sort_projects(projects, request.POST.get('sort_by'))
all_projects = sort_projects(all_projects, request.POST.get('sort_by'))
return render(request,
'projects/projects.html',
{
'projects': projects,
'projects': all_projects,
'project_categories': project_categories,
'sort_form': sort_form,
}
)
})
@login_required
def new_project(request):
if request.method == 'POST':
form = ProjectForm(request.POST)
print(form.errors)
if form.is_valid():
project = form.save(commit=False)
create_new_project(request, project)
......@@ -157,9 +149,9 @@ def task_view(request, project_id, task_id):
user_permissions = get_user_task_permissions(request.user, task)
if (user_permissions['read'] or
user_permissions['write'] or
user_permissions['modify'] or
user_permissions['owner'] or
user_permissions['write'] or
user_permissions['modify'] or
user_permissions['owner'] or
user_permissions['view_task']):
if request.method == 'POST':
accepted_task_offer = task.accepted_task_offer()
......@@ -204,7 +196,7 @@ def task_permissions(request, project_id, task_id):
task = Task.objects.get(pk=task_id)
project = Project.objects.get(pk=project_id)
if (can_modify_permissions(request, project, task) and
int(project_id) == task.project.id and
int(project_id) == task.project.id and
request.method == 'POST'):
task_permission_form = TaskPermissionForm(request.POST)
......
Supports Markdown
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