Re: Django Many-to-many Query: Publications with no Articles? Publications with some Articles?

2015-08-21 Thread Shawn Milochik
No articles: Publication.objects.filter(article_set=None) Has articles: Publication.objects.exclude(article_set=None) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an

Writing tests after I took over a project. Getting 'Cannot add foreign key constraint'.

2015-08-21 Thread Adam Heller
When I took over this project it was in Django 1.5. I've since incrementally upgraded it and am now running successfully in 1.8.3. There are also no tests written. I've decided to write a few tests after adding some new views today. when i run ./manage.py test apps.public_web, i'm given the

Django Many-to-many Query: Publications with no Articles? Publications with some Articles?

2015-08-21 Thread Edward Sitarski
I have read the Django Many to Many documentation . Based on the example, I am stuck on how to formulate the following queries (this related to my "real life" problem): 1. What Publications have no Articles? 2. What

Working with FileFields/FieldFiles

2015-08-21 Thread Hugo Kitano
Hi, I'm a beginner with Django, and I'm trying to figure out how to work with FieldFiles. One of my models has a FileField in which the user must submit a .bed file. I use another library in python to analyze the .bed file. The .bed file is saved to a specific directory on disk, and I want

Re: Using ModelForms

2015-08-21 Thread Hugo Kitano
Do you have any idea what could be causing the problem, then? On Friday, August 21, 2015 at 2:25:17 AM UTC-7, Hugo Osvaldo Barrera wrote: > > > > > On Thu, Aug 20, 2015, at 17:43, Edgar Gabaldi wrote: > > The code seems right. Probably your form has some error. Try print > {{form.errors}}

Re: Sudden appearance of DatabaseWrapper Exception

2015-08-21 Thread Bryan Scott
I've come across a similar problem, and I'm pretty curious if you ever figured out what caused this for you. Any help is appreciated. Thanks Bryan On Sunday, April 6, 2014 at 1:02:20 AM UTC-4, Fraser Graham wrote: > > I have been running an Django 1.5.1 app under Apache for some time without

Re: Using ModelForms

2015-08-21 Thread 'Hugo Osvaldo Barrera' via Django users
On Thu, Aug 20, 2015, at 17:43, Edgar Gabaldi wrote: > The code seems right. Probably your form has some error. Try print > {{form.errors}} in your template to check. Shouldn't {{ form.as_p }} include errors as well? This seems to be what the doc indicates:

Getting Posts and its last comment in a single queryset

2015-08-21 Thread 'Hugo Osvaldo Barrera' via Django users
Hi all, Let's assume I've the classic blog post with multiple comments model. I'm trying to get a list of posts each annotated with its last comment (or at least a single field from it). The closest I've gotten is via: Post.objects.annotate(last_comment=F('comment__text')) But this just

Issue Django, in insert session login user data in database?

2015-08-21 Thread Remaze Vs
Actually I want to insert session login user data in database but I when I put this code I get all register user in Dropdown but I want to only current login user data not all and also I want to hide this field value.please help. model.py from django.conf import settingsfrom