def setUp(self): """ create a user for testing the Issue views """ u = User.objects.create_user(username="******", email="*****@*****.**", password="******") p = Project(name="Test project", description="This is a test project") p.save() p.team = [u] c = Component(name="Test component", description="This is a test component", project=p, owner=u) c.save() m = Milestone(name="Test milestone", project=p) m.save() self.i = Issue( title="Issue", description="Test description", creator=u, assignee=u, project=p, milestone=m, component=c, status=1, priority=3, ) self.i.save()
def form_valid(self, form): name = form.cleaned_data['name'] description = form.cleaned_data['description'] team = form.cleaned_data['team'] p = Project(name=name, description=description) p.save() p.team = team return HttpResponseRedirect(p.get_absolute_url())