Re: Problem with order_by on one record only

2012-06-15 Thread Kurtis Mullins
You could try grabbing the exact SQL statement(s) executed for this query
and run them yourself on the Oracle Database. At least that would tell you
if the problem lay in Django or not. Then, maybe use a debugger to step
through the query (try using ipdb or something similar) and see where it
gets mangled.

On Fri, Jun 15, 2012 at 5:42 PM, Alex Umrysh  wrote:

> I'm having a strange error on an object query when I try to do negative
> order_by. This is on an Oracle 11 database with Django 1.4
> it looks something like:
>
> MyModel.objects.filter(pk=N).order_by('-datetime')[:5]
>
> This gives me valid data for all values of N in the database except for
> one specific record.
> This one record works fine when the order_by is on 'datetime', but
> '-datetime' doesn't work.  using .latest('datetime') appears to do the same
> thing (under the hood), so there's no difference in the behavior there.
>
> I'm not sure what the issue is with this specific object, but it does use
> more columns than the rest of the objects in the database.
>
> I have looked at the datetime objects, and they all appear to be good.
> I added some additional model fields based on the changes my DBA made to
> this table, but I'm not certain why this would cause this one specific
> object to return nothing where others do, as the data appears good.
> any ideas where to look?
> I would provide more code but it's of a confidential nature so I'll have
> to scrub any names before I post the models, so I'm hoping someone has an
> idea or hunch before I have to do that.
>
> Thanks, and sorry for not posting much code.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/XDSZwfTqchMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem with order_by on one record only

2012-06-15 Thread Alex Umrysh
I'm having a strange error on an object query when I try to do negative 
order_by. This is on an Oracle 11 database with Django 1.4
it looks something like:

MyModel.objects.filter(pk=N).order_by('-datetime')[:5]

This gives me valid data for all values of N in the database except for one 
specific record.
This one record works fine when the order_by is on 'datetime', but 
'-datetime' doesn't work.  using .latest('datetime') appears to do the same 
thing (under the hood), so there's no difference in the behavior there.

I'm not sure what the issue is with this specific object, but it does use 
more columns than the rest of the objects in the database.

I have looked at the datetime objects, and they all appear to be good.
I added some additional model fields based on the changes my DBA made to 
this table, but I'm not certain why this would cause this one specific 
object to return nothing where others do, as the data appears good.
any ideas where to look?
I would provide more code but it's of a confidential nature so I'll have to 
scrub any names before I post the models, so I'm hoping someone has an idea 
or hunch before I have to do that.

Thanks, and sorry for not posting much code.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/XDSZwfTqchMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-06-15 Thread Kurtis Mullins
Honestly, if your host doesn't provide those services out of the box -- you
might have better luck going with a different hosting provider. I would
choose a cheap VPS or Cloud Server if I were you.

On Fri, Jun 15, 2012 at 4:18 PM, Dan Santos  wrote:

> Hi darwin,
>
> Sorry for the late reply.  Thanks for your new instructions.  I'm
> currently stuck at step 1 because my wehost hasn't included important
> commands and packages such as:
>
> * uname
> * make
> * gcc (package)
>
> So I will try to discuss with my webhost this week to see if they can
> enable those commands so I can compile my chosen Python version.
> And then continue with running your procedure.
>
>
> //Dan
>
>
>
> On 5/25/12, darwin31  wrote:
> > I forgot to say something important. In order to make such changes
> > permanent you will need to insert in the END of you ~/.bash_profile the
> > following commands:
> >
> > export WORKON_HOME=~/Envs
> > source ~/python/bin/virtualenvwrapper.sh
> >
> >
> > Em sábado, 12 de maio de 2012 07h29min39s UTC-3, Dan Santos escreveu:
> >>
> >> *1.)*
> >> Hi I have downloaded this zip file:  Python-2.7.3.tgz
> >>
> >> *2.)*
> >> And tried to compile it, I think it's called by doing this command:
> >>
> >> dan@debian:~/usr-32/Python-2.7.3$ *./configure
> --prefix=/home/dan/usr-32*
> >> *
> >> *
> >> checking for --enable-universalsdk... no
> >> checking for --with-universal-archs... 32-bit
> >> checking MACHDEP... linux2
> >> checking EXTRAPLATDIR...
> >> checking machine type as reported by uname -m... x86_64
> >> checking for --without-gcc... no
> >> checking for gcc... no
> >> checking for cc... no
> >> checking for cl.exe... no
> >> configure: error: in `/home/dan/usr-32/Python-2.7.3':
> >> configure: error: no acceptable C compiler found in $PATH
> >> See `config.log' for more details
> >>
> >>
> >> How do I deal with this on my shared host account with no root access?
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/85q_uB8_rWQJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-06-15 Thread Dan Santos
Hi darwin,

Sorry for the late reply.  Thanks for your new instructions.  I'm
currently stuck at step 1 because my wehost hasn't included important
commands and packages such as:

* uname
* make
* gcc (package)

So I will try to discuss with my webhost this week to see if they can
enable those commands so I can compile my chosen Python version.
And then continue with running your procedure.


//Dan



On 5/25/12, darwin31  wrote:
> I forgot to say something important. In order to make such changes
> permanent you will need to insert in the END of you ~/.bash_profile the
> following commands:
>
> export WORKON_HOME=~/Envs
> source ~/python/bin/virtualenvwrapper.sh
>
>
> Em sábado, 12 de maio de 2012 07h29min39s UTC-3, Dan Santos escreveu:
>>
>> *1.)*
>> Hi I have downloaded this zip file:  Python-2.7.3.tgz
>>
>> *2.)*
>> And tried to compile it, I think it's called by doing this command:
>>
>> dan@debian:~/usr-32/Python-2.7.3$ *./configure --prefix=/home/dan/usr-32*
>> *
>> *
>> checking for --enable-universalsdk... no
>> checking for --with-universal-archs... 32-bit
>> checking MACHDEP... linux2
>> checking EXTRAPLATDIR...
>> checking machine type as reported by uname -m... x86_64
>> checking for --without-gcc... no
>> checking for gcc... no
>> checking for cc... no
>> checking for cl.exe... no
>> configure: error: in `/home/dan/usr-32/Python-2.7.3':
>> configure: error: no acceptable C compiler found in $PATH
>> See `config.log' for more details
>>
>>
>> How do I deal with this on my shared host account with no root access?
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/85q_uB8_rWQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: dropping ForeignKey not reflected in admin

2012-06-15 Thread Larry Martell
On Fri, Jun 15, 2012 at 1:13 PM, vikalp sahni  wrote:
> strange, I hope you are checking the right model and right admin.
>
> Can you check you have traces for that field on your admin.py

Turns out there are 2 tables with very similar names, and I was
looking at the admin for the wrong table.


> On Fri, Jun 15, 2012 at 11:37 PM, Larry Martell 
> wrote:
>>
>> I have a table that had a ForeignKey reference. In the admin screen
>> for adding to this table there was a dropdown for that column. I want
>> to get rid of that ForeignKey. I changed models.py and removed the
>> ForeignKey column, bounced apache and altered the table and removed
>> that column. In the admin screen it still has the dropdown for that
>> column. If I try and add a row it silently fails. If I try and display
>> the rows from the table it says there are none, even thought there
>> are. I even tried dropping the table and running syncdb. It created
>> the table without the ForeignKey column, but yet the admin screen
>> still has the dropdown for that column. What am I doing wrong here?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: dropping ForeignKey not reflected in admin

2012-06-15 Thread vikalp sahni
strange, I hope you are checking the right model and right admin.

Can you check you have traces for that field on your admin.py

Regards,
//Vikalp

On Fri, Jun 15, 2012 at 11:37 PM, Larry Martell wrote:

> I have a table that had a ForeignKey reference. In the admin screen
> for adding to this table there was a dropdown for that column. I want
> to get rid of that ForeignKey. I changed models.py and removed the
> ForeignKey column, bounced apache and altered the table and removed
> that column. In the admin screen it still has the dropdown for that
> column. If I try and add a row it silently fails. If I try and display
> the rows from the table it says there are none, even thought there
> are. I even tried dropping the table and running syncdb. It created
> the table without the ForeignKey column, but yet the admin screen
> still has the dropdown for that column. What am I doing wrong here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Any clue why Facebook iframe would be blank?

2012-06-15 Thread Kurtis Mullins
Haha, no problem! Yep, it's in there (like you saw).
I opened up a Stackoverflow post with the question here:
http://facebook.stackoverflow.com/questions/11056283/iframe-showing-up-blank

On Fri, Jun 15, 2012 at 1:58 PM, Rafał Stożek  wrote:

> Sorry, I didn't read the code.
>
>
> On Friday, June 15, 2012 6:56:56 PM UTC+1, Rafał Stożek wrote:
>>
>> Does this view accept POST requests? Because facebook uses POST to send
>> you some data in signed_request param.
>>
>> On Friday, June 15, 2012 6:40:25 PM UTC+1, Kurtis wrote:
>>>
>>> I've created a very simple page. It pretty much just dumps out some html
>>> with the text "Hello, Facebook". This view can be found at:
>>> http://www.fireflie.com/**facebook/ 
>>>
>>> We created a very simple Canvas app on facebook pointing to this link.
>>> It can be found here: 
>>> http://apps.facebook.**com/fireflietest/
>>>
>>> For some odd reason, when I hit the view directly it prints out the text
>>> without any problem. I can do a GET or POST request and get the same
>>> results. However, when I view the Facebook app -- it shows nothing. It's
>>> just blank. On the contrary, if I point it at other URLs which actually
>>> have some real functionality and aren't CSRF Excempt -- then they show the
>>> error page. But it's still some type of output.
>>>
>>> I've used Google Chrome and Firebug to try to see the response object
>>> from my site. It looks like only the headers are being returned. Am I
>>> missing something obvious? haha
>>>
>>> Here's the tiny little view that I'm using:
>>>
>>> from django.http import HttpResponse
>>> from django.views.decorators.csrf import csrf_exempt, csrf_protect
>>>
>>> @csrf_exempt
>>> def facebook(request):
>>> body = """
>>> 
>>> Fireflie on Facebook
>>> Hello, Facebook!
>>> 
>>> """
>>> return HttpResponse(body)
>>>
>>> I looked through my nginx logs and saw these lines which are kind of
>>> weird:
>>>
>>> 24.210.144.32 - fireflie [15/Jun/2012:17:09:34 +] "POST /facebook/
>>> HTTP/1.1" 200 31 
>>> "http://apps.facebook.com/**fireflietest/"
>>> "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko)
>>> Ubuntu/12.04 Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19"
>>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>>> 24.210.144.32 - fireflie [15/Jun/2012:17:10:05 +] "GET /facebook/
>>> HTTP/1.1" 200 111 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19
>>> (KHTML, like Gecko) Ubuntu/12.04 Chromium/18.0.1025.151
>>> Chrome/18.0.1025.151 Safari/535.19"
>>>
>>> The first several lines are from my connection attempt using Facebook.
>>> The last line is directly hitting the server. In this particular case I did
>>> use two different browsers but I've tried it every browser I have.
>>>
>>> I'm up for any ideas people might have on debugging this problem. Thanks!
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/WB4GxsbA_QgJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



dropping ForeignKey not reflected in admin

2012-06-15 Thread Larry Martell
I have a table that had a ForeignKey reference. In the admin screen
for adding to this table there was a dropdown for that column. I want
to get rid of that ForeignKey. I changed models.py and removed the
ForeignKey column, bounced apache and altered the table and removed
that column. In the admin screen it still has the dropdown for that
column. If I try and add a row it silently fails. If I try and display
the rows from the table it says there are none, even thought there
are. I even tried dropping the table and running syncdb. It created
the table without the ForeignKey column, but yet the admin screen
still has the dropdown for that column. What am I doing wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Any clue why Facebook iframe would be blank?

2012-06-15 Thread Rafał Stożek
Sorry, I didn't read the code.

On Friday, June 15, 2012 6:56:56 PM UTC+1, Rafał Stożek wrote:
>
> Does this view accept POST requests? Because facebook uses POST to send 
> you some data in signed_request param.
>
> On Friday, June 15, 2012 6:40:25 PM UTC+1, Kurtis wrote:
>>
>> I've created a very simple page. It pretty much just dumps out some html 
>> with the text "Hello, Facebook". This view can be found at: 
>> http://www.fireflie.com/facebook/
>>
>> We created a very simple Canvas app on facebook pointing to this link. It 
>> can be found here: http://apps.facebook.com/fireflietest/
>>
>> For some odd reason, when I hit the view directly it prints out the text 
>> without any problem. I can do a GET or POST request and get the same 
>> results. However, when I view the Facebook app -- it shows nothing. It's 
>> just blank. On the contrary, if I point it at other URLs which actually 
>> have some real functionality and aren't CSRF Excempt -- then they show the 
>> error page. But it's still some type of output.
>>
>> I've used Google Chrome and Firebug to try to see the response object 
>> from my site. It looks like only the headers are being returned. Am I 
>> missing something obvious? haha
>>
>> Here's the tiny little view that I'm using:
>>
>> from django.http import HttpResponse
>> from django.views.decorators.csrf import csrf_exempt, csrf_protect
>>
>> @csrf_exempt
>> def facebook(request):
>> body = """
>> 
>> Fireflie on Facebook
>> Hello, Facebook!
>> 
>> """
>> return HttpResponse(body)
>>
>> I looked through my nginx logs and saw these lines which are kind of 
>> weird:
>>
>> 24.210.144.32 - fireflie [15/Jun/2012:17:09:34 +] "POST /facebook/ 
>> HTTP/1.1" 200 31 "http://apps.facebook.com/fireflietest/"; "Mozilla/5.0 
>> (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/12.04 
>> Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19"
>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
>> 24.210.144.32 - fireflie [15/Jun/2012:17:10:05 +] "GET /facebook/ 
>> HTTP/1.1" 200 111 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 
>> (KHTML, like Gecko) Ubuntu/12.04 Chromium/18.0.1025.151 
>> Chrome/18.0.1025.151 Safari/535.19"
>>
>> The first several lines are from my connection attempt using Facebook. 
>> The last line is directly hitting the server. In this particular case I did 
>> use two different browsers but I've tried it every browser I have.
>>
>> I'm up for any ideas people might have on debugging this problem. Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WB4GxsbA_QgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Any clue why Facebook iframe would be blank?

2012-06-15 Thread Rafał Stożek
Does this view accept POST requests? Because facebook uses POST to send you 
some data in signed_request param.

On Friday, June 15, 2012 6:40:25 PM UTC+1, Kurtis wrote:
>
> I've created a very simple page. It pretty much just dumps out some html 
> with the text "Hello, Facebook". This view can be found at: 
> http://www.fireflie.com/facebook/
>
> We created a very simple Canvas app on facebook pointing to this link. It 
> can be found here: http://apps.facebook.com/fireflietest/
>
> For some odd reason, when I hit the view directly it prints out the text 
> without any problem. I can do a GET or POST request and get the same 
> results. However, when I view the Facebook app -- it shows nothing. It's 
> just blank. On the contrary, if I point it at other URLs which actually 
> have some real functionality and aren't CSRF Excempt -- then they show the 
> error page. But it's still some type of output.
>
> I've used Google Chrome and Firebug to try to see the response object from 
> my site. It looks like only the headers are being returned. Am I missing 
> something obvious? haha
>
> Here's the tiny little view that I'm using:
>
> from django.http import HttpResponse
> from django.views.decorators.csrf import csrf_exempt, csrf_protect
>
> @csrf_exempt
> def facebook(request):
> body = """
> 
> Fireflie on Facebook
> Hello, Facebook!
> 
> """
> return HttpResponse(body)
>
> I looked through my nginx logs and saw these lines which are kind of weird:
>
> 24.210.144.32 - fireflie [15/Jun/2012:17:09:34 +] "POST /facebook/ 
> HTTP/1.1" 200 31 "http://apps.facebook.com/fireflietest/"; "Mozilla/5.0 
> (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/12.04 
> Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19"
> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
> 24.210.144.32 - - [15/Jun/2012:17:09:50 +] "-" 400 0 "-" "-"
> 24.210.144.32 - fireflie [15/Jun/2012:17:10:05 +] "GET /facebook/ 
> HTTP/1.1" 200 111 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 
> (KHTML, like Gecko) Ubuntu/12.04 Chromium/18.0.1025.151 
> Chrome/18.0.1025.151 Safari/535.19"
>
> The first several lines are from my connection attempt using Facebook. The 
> last line is directly hitting the server. In this particular case I did use 
> two different browsers but I've tried it every browser I have.
>
> I'm up for any ideas people might have on debugging this problem. Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MdqFX2guutIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Progromatically creating Images using Django-Cumulus?

2012-06-15 Thread Kurtis Mullins
Hey guys/girls,

I've ran into a problem which I'm not quite sure how to tackle. We use
Django-cumulus for handling our user's media. I need to programatically
create an image and save it as a ImageField. I want to avoid any "hackish"
ways of doing it and try to keep it consistent with the way Django and
django-cumulus function.

I've created a Stackoverflow post here:
http://stackoverflow.com/questions/11047051/how-can-i-programatically-save-an-image-to-an-imagefield-using-django-cloudfiles

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DjangoCon US CfP Closes Tomorrow

2012-06-15 Thread Sean O'Connor
Hey Everybody,

Just a quick heads up that the call for talk and tutorial proposals for 
DjangoCon US 2012 closes tomorrow.  You can find all of the details on this 
year's conference along with the form to submit a proposal at 
http://www.djangocon.us/.

If you have any questions or feedback please feel free to let me know at 
s...@seanoc.com.

Thanks!

-- 
Sean O'Connor
http://www.seanoc.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How postgres data type "real" is represented in Django?

2012-06-15 Thread IgorS
Thanks a lot, Anssi!  
This is very helpful.
Just in case someone else is interested in "Writing custom model fields", 
here is a link to Django's docs: 
https://docs.djangoproject.com/en/dev/howto/custom-model-fields/

Thank you once again,
-igor


On Thursday, 14 June 2012 05:18:40 UTC-4, akaariai wrote:
>
> On 12 kesä, 18:50, IgorS  wrote: 
> > Hi ALL! 
> > 
> > It seems that there is no class in Django models that represents 4-byte 
> > data type "real" in postgres. I looked into 
> > django\db\backends\postgresql_psycopg2\creation.py but could not find it 
> > there. The only choice seems to be FloatField, which represents "double 
> > precision" in postgres. But i would like to use "real" to minimize the 
> > index size? How can i do it? 
>
> It might be you will need to do a FloatField subclass - RealField, 
> which will return "REAL" as its database type from field.db_type(). It 
> has been a while since last dealing with custom fields so there might 
> be something more needed. Django's documentation should contain more 
> information. 
>
>  - Anssi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BLHtqdBwZJ8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trailing slash defeats get_absolute_url

2012-06-15 Thread Mike Dewhirst
Thanks Bruno.  I haven't looked closely at that yet. I'll see if i can do some 
reading this weekend. 

Cheers

Mike

Connected by MOTOBLUR™

-Original message-
From: bruno desthuilliers 
To: django-users@googlegroups.com
Sent: Fri, 15 Jun 2012, 18:48:24 AEST
Subject: Re: trailing slash defeats get_absolute_url

On Friday, June 15, 2012 9:42:33 AM UTC+2, Mike Dewhirst wrote:
>
> On 15/06/2012 5:11pm, bruno desthuilliers wrote: 
> > You have to end your url patterns with a slash, ie r'^search/'. 
>
> Ok. I added a trailing slash to the get_absolute_url method like so ...   
> return 'xitem/%s/' % self.id ... 



While we're at it: you should definitely use 
django.core.urlresolvers.reverse (same thing as the {% url %} templatetag) 
to reverse-build your urls, instead of hard-coding them (well, unless you 
really enjoy having to grep thru your whole codebase when your url scheme 
changes). As a matter of fact, you wouldn't have had to edit this part if 
you had used reverse() instead, just adding the final slash in the url 
pattern would have been enough.

 

> and added an extra url pattern ... 
>
> urlpatterns = patterns('item.views', 
>  url(r'^search/$', 'search'), 
>

Note that you may want to make the slash conditional, ie:

   r'^search/?$'

so it will match both "/search" and "/search/"


HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/iN2ICAX2EjcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trailing slash defeats get_absolute_url

2012-06-15 Thread bruno desthuilliers
On Friday, June 15, 2012 9:42:33 AM UTC+2, Mike Dewhirst wrote:
>
> On 15/06/2012 5:11pm, bruno desthuilliers wrote: 
> > You have to end your url patterns with a slash, ie r'^search/'. 
>
> Ok. I added a trailing slash to the get_absolute_url method like so ...   
> return 'xitem/%s/' % self.id ... 



While we're at it: you should definitely use 
django.core.urlresolvers.reverse (same thing as the {% url %} templatetag) 
to reverse-build your urls, instead of hard-coding them (well, unless you 
really enjoy having to grep thru your whole codebase when your url scheme 
changes). As a matter of fact, you wouldn't have had to edit this part if 
you had used reverse() instead, just adding the final slash in the url 
pattern would have been enough.

 

> and added an extra url pattern ... 
>
> urlpatterns = patterns('item.views', 
>  url(r'^search/$', 'search'), 
>

Note that you may want to make the slash conditional, ie:

   r'^search/?$'

so it will match both "/search" and "/search/"


HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/iN2ICAX2EjcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to rework list of items (model instances page) in AdminSite?

2012-06-15 Thread Dominis
Hello.
I try to make a simple structured model of data (categories for articles 
instances) and now cant find right way to reorder/rebuild list of elements, 
which rendering in admin site. Explain:
It's easy to switch ordering by 'ordering = ['field_name']', but it's just 
an order. I need to change algorithm which choose order of elements for 
render.
I need make tree such structure
-root_category_1
--child_category_1
--child_category_2
--child_category_3
-root_category_2
--child_category_1
--child_category_2
etc. In addition i need to order elemnts in that branches.  But i think 
it's not hard... 
So how can i do it? In documentation i find nice way - use queryset 
function. But it should to return queryset... and i can't create structure 
what i need in one queryset... How can i solve it?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/uHcAchkEh0sJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: trailing slash defeats get_absolute_url

2012-06-15 Thread Mike Dewhirst

On 15/06/2012 5:11pm, bruno desthuilliers wrote:

You have to end your url patterns with a slash, ie r'^search/'.


Ok. I added a trailing slash to the get_absolute_url method like so ...  
return 'xitem/%s/' % self.id ... and added an extra url pattern ...


urlpatterns = patterns('item.views',
url(r'^search/$', 'search'),
url(r'^search/xitem/(?P\d+)/$', 'display'),
url(r'^xitem/(?P\d+)/$', 'display'),
)

... and used $ to enforce the trailing slash everywhere - and it is all 
working consistently.


Thanks Bruno

Mike






--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



trailing slash defeats get_absolute_url

2012-06-15 Thread bruno desthuilliers
You have to end your url patterns with a slash, ie r'^search/'. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JAbME4x4ZusJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



trailing slash defeats get_absolute_url

2012-06-15 Thread bruno desthuilliers
You have to end your url patterns with a slash, ie r'^search/'. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/iks8SsEo2v4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: from future url -- argh

2012-06-15 Thread Benedict Verheyen
On 15/06/2012 1:55, Andre Terra wrote:
> Ah, here it is:
> 
> https://docs.djangoproject.com/en/dev/internals/deprecation/#id2
> 
> 
> Cheers,
> AT



Indeed, the first argument in the url tag used to be an implied string.
In Django 1.5 it isn't anymore, so if the first argument to the url tag is 
indeed a string,
you can write something like this: {% url 'myfirstarg' %}

I had the same problem, and that was the solution for me.

Here's what I found on the problem:

"The url and ssi template tags will be modified so that the first argument to 
each tag is a template variable, not an implied string. Until
then, the new-style behavior is provided in the future template tag library."

Cheers,
Benedict

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.