Archives for 2011

When you modify your settings.py file of your Django project on production servers you can get errors like this when updating the code: $ git fetch $ git merge origin/master ... error: Your local changes to 'settings.py' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge. ... [...]


// Symfony 2 public function updateAction($id) { $em = $this->getDoctrine()->getEntityManager(); $product = $em->getRepository('AcmeStoreBundle:Product')->find($id); if (!$product) { throw $this->createNotFoundException('No product found for id '.$id); } $product->setName('New product name!'); $em->flush(); return $this->redirect($this->generateUrl('homepage')); } # Django def updateAction(request, id): product = Product.objects.get(pk=id) # Product.DoesNotExist exception raised if not found product.name = u"New product name!" product.save() return HttpResponseRedirect(reverse('homepage'))


more on this. Now that we know how to trigger django permission creation mechanism with a fake migration, there is still one more issue. Those permissions are not associated to the right content_type (the one that corresponds to the proxy models), so they are useless in the django admin. This is related to an old [...]


So much for a post title. The thing is as follows: you use migrations for a certain app in some point at your development, you add proxy models to that app you need to have specific permissions for that recently created proxy model. since that app you’re adding the proxy model is not controlled by [...]