hacklabr / timtec

MOOC platform built with Django and Angular to deliver and manage courses, classes and student activities
GNU Affero General Public License v3.0
73 stars 64 forks source link

Acesso ao admin como usuário anônimo gera erro #582

Open brunosmartin opened 8 years ago

brunosmartin commented 8 years ago

http://localhost:8080/admin/courses/1/

Deveria gerar um forbiden (403)

Internal Server Error: /admin/course/1/certificatesettings/ Traceback (most recent call last): File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, _callback_args, _callback_kwargs) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, _args, _kwargs) File "/home/bruno/devel/timtec/administration/views.py", line 78, in dispatch if not (request.user.is_superuser or self.object.get_professor_role(request.user) == 'coordinator'): File "/home/bruno/devel/timtec/core/models.py", line 196, in get_professor_role cp = self.course_professors.get(user=user) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(_args, _kwargs) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/query.py", line 325, in get clone = self.filter(_args, _kwargs) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/query.py", line 679, in filter return self._filter_or_exclude(False, _args, _kwargs) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/query.py", line 697, in _filter_or_exclude clone.query.add_q(Q(_args, _kwargs)) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1310, in add_q clause, require_inner = self._add_q(where_part, self.used_aliases) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1338, in _add_q allow_joins=allow_joins, split_subq=split_subq, File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1200, in build_filter lookups, value) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/fields/related.py", line 1745, in get_lookup_constraint lookup_class(target.get_col(alias, source), val), AND) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/lookups.py", line 101, in init self.rhs = self.get_prep_lookup() File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/lookups.py", line 139, in get_prep_lookup return self.lhs.output_field.get_prep_lookup(self.lookup_name, self.rhs) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/fields/init.py", line 727, in get_prep_lookup return self.get_prep_value(value) File "/home/bruno/.virtualenvs/timtec-novo/lib/python2.7/site-packages/django/db/models/fields/init.py", line 985, in get_prep_value return int(value) TypeError: int() argument must be a string or a number, not 'SimpleLazyObject'