ModelAdmin.save_as integrity error

2015-06-22 Thread Mike Dewhirst
The following is all I could find in the docs about ModelAdmin.save_as ModelAdmin.save_as (https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_as) Set save_as to enable a “save as” feature on admin change forms. Normally, objects have three

Re: The related_name of ForeignKey cannot be Unicode name after Django 1.8

2015-06-22 Thread Cheng-Hung Hsueh
I have posted in https://code.djangoproject.com/ticket/25016#ticket . Tim Graham於 2015年6月23日星期二 UTC+8上午12時30分48秒寫道: > > It looks like the check added in ticket #22064 may be too strict (only > allowing alphanumeric characters in related_name). Would you like to open a > ticket? > > On Monday,

Re: "RuntimeError: Error creating new content types."

2015-06-22 Thread Devang Mundhra
Chris- By any chance, did you fake any of the migrations. That was the problem I had faced- it wasn't a Django problem, it was a problem with my migration. On Mon, Jun 22, 2015 at 3:52 PM Chris DiLorenzo < dilorenzo.christop...@gmail.com> wrote: > I'm seeing this issue as well. Not sure if it

Re: "RuntimeError: Error creating new content types."

2015-06-22 Thread Chris DiLorenzo
I'm seeing this issue as well. Not sure if it helps but I get it when running my tests. I chose to raise the error instead and saw this: django.db.utils.IntegrityError: null value in column "name" violates not- null constraint DETAIL: Failing row contains (1, null, app, listing). Where app

Manually add image to filefield in save method on modelform

2015-06-22 Thread Andreas Kuhne
Hi all, I have created a modelform that has an Imagefield in it. I want to override the save function and manually create a filefield with an image that already exists in the file storage (S3). So the things I have to do would be: * Download the image from S3 and save it to a temporary file *

HStore values query with contains not working as expected

2015-06-22 Thread Alex Magidow
Hi, I was going to file this as a bug, but it said to ask the mailing list first. When using an HStore __values query with __contains chained on to it, the query does not work as expected in Django 1.8.2. Expected action is that any values which contain the text will be returned from the

Re: Best Queryset Practice

2015-06-22 Thread Luis Zárate
Querysets are lazy, so Model.objects.all().filter(...) execute a same query that Model.objects.filter(...).all() and Model.objects.filter(...). For check this tray in shell str(Model.objects.all().filter(pk=1).query) str(Model.objects.filter(pk=1).all().query)

conflicts with six.moves

2015-06-22 Thread Christopher L. Trudeau
I've been using django to interface with a couple of data source libraries, both of which use six. There appears to be some sort of conflict problem between six and django.utils.six which causes ImportErrors. For example, using the Reddit library "praw": > from six.moves.urllib.parse import

Re: Best Queryset Practice

2015-06-22 Thread Tim Graham
Have you had a look at the documentation? https://docs.djangoproject.com/en/stable/topics/db/optimization/#understand-querysets On Monday, June 22, 2015 at 11:28:51 AM UTC-4, Paritosh Gupta wrote: > > Hello, > > Do advice me on: > > queryset = User.objects.all() > user = get_object_or_404(pk=id)

Re: The related_name of ForeignKey cannot be Unicode name after Django 1.8

2015-06-22 Thread Tim Graham
It looks like the check added in ticket #22064 may be too strict (only allowing alphanumeric characters in related_name). Would you like to open a ticket? On Monday, June 22, 2015 at 11:28:50 AM UTC-4, Cheng-Hung Hsueh wrote: > > This code can run before django 1.7 > But "related_name" got an

Best Queryset Practice

2015-06-22 Thread Paritosh Gupta
Hello, Do advice me on: queryset = User.objects.all() user = get_object_or_404(pk=id) > Is it better to call the list in queryset and then apply filter or directly use .filter() in the first step. > If so, when we call all the object frequently does it cache and from cache we do filter or

The related_name of ForeignKey cannot be Unicode name after Django 1.8

2015-06-22 Thread Cheng-Hung Hsueh
This code can run before django 1.7 But "related_name" got an error after django 1.8 使用者表.來源: (fields.E306) The name '使用者' is invalid related_name for field 使用者表.來源 class 來源表(models.Model): 名 = models.CharField(max_length=100) class 使用者表(models.Model): 來源 = models.OneToOneField(來源表,

Re: ValueError: No JSON object could be decoded

2015-06-22 Thread Bill Freeman
You probably don't want request.body. You are probably POSTing the JSON using a form, which means that it shows up as something like request.POST['data'], where you should replace 'data' with the name of the form element (textarea?) where you are putting the JSON. Posting with a form wraps

Passing an image to the other url?

2015-06-22 Thread Jeremi Podlasek
Please beware that I'm just few weeks into django and really do not feel confortable at it In my first django project I've created an app which is uploading images to the site, the images are stored at the same link the uploading takes place What I'm trying to accomplish is to upload the