python - Why would a django UpdateView return a 404 until the server was restarted? -


i have following create , update views (django 1.5, python 2.7):

class newscreateview(         permissionrequiredmixin,         createview     ):     model = news     template_name_suffix = "_create_form"     form_class = newsform     login_url = "/login/"     permission_required = "news.add_news"      def get_context_data(self, **kwargs):         # call base implementation context         context = super(newscreateview, self).get_context_data(**kwargs)         context['tags'] = news.tags.all()         return context      def form_valid(self, form):         obj = form.save(commit = false)         obj.slug = slugify(obj.headline)         obj.writer = self.request.user.person         obj.pub_date = datetime.datetime.now()         obj.featured = false         obj.enable_comments = true         return super(newscreateview, self).form_valid(form)   class newsupdateview(         permissionrequiredmixin,         updateview     ):     model = news     template_name_suffix = "_update_form"     form_class = newsform     login_url = "/login/"     permission_required = "news.change_news"      def get_context_data(self, **kwargs):         # call base implementation context         context = super(newsupdateview, self).get_context_data(**kwargs)         context['tags'] = news.tags.all()         return context 

the createview behaves expected, updateview in development only. in production, however, updateview returns 404 news article created since last gunicorn restart. restarting gunicorn makes updateview pages work fine.

i can't useful debugging information because can't recreate bug in development environment. know what's going on here?

update requested, here managers @ work on model. models.py

# visibility all_news =  models.manager() objects = livenewsmanager() 

and managers.py

class livenewsmanager(models.manager):     def get_query_set(self):         return super(livenewsmanager, self).get_query_set().filter(status = self.model.live_status).filter(pub_date__lt = timezone.now()) 


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -