Mocking Django queryset

2014-06-01 Thread Boris Ozegovic
Hi

I am having trouble mocking querysets which contains slice.  Example

qs = 
Thread.objects.filter(some_filter).order_by(some_order')[:app_settings.SEARCH_LIMIT]

And in my test I have:

Thread.objects.assert_has_calls([
mock.call.filter('some_filter'),
mock.call.filter().order_by('some_order'),
mock.call.filter().order_by().__getitem__(slice(None, 1000, 
None))
])

But this isn't working.  Message is:

Expected: [call.filter('filter'), call.filter().order_by('-post_counter'), 
('filter().order_by', (), {})]
Actual: [call.filter('filter'),
 call.filter().order_by('-post_counter'),
 call.filter().order_by().__getitem__(slice(None, 1000, None))]

Why? 

Python 2.7.5, Django 1.7b4

-- 
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 email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/90025e4e-b8d6-4e24-9ef1-d2d919d3cd09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django HTTP server and httplib

2008-05-23 Thread Boris Ozegovic

Hi, I have this few line of code:

parametar = msgid=1###userid=1102###nav_status=1###rot=100.0###sog=10.0
params = urllib.urlencode({'report': parametar})
conn = httplib.HTTPConnection("localhost:8000")
conn.request("POST", "/proba/", params, headers)
reportHTTP = conn.getresponse().read()

And I'm getting (not always, but most of the time):
(10053, 'Software caused connection abort')

Any ideas?

Apache works fine.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Translation issues in admin app

2008-04-25 Thread Boris Ozegovic

Croatian language has many declination rules, and therefore, only two
meta rules (verbose_name and verbose_name_plural) aren't enough.  Can
I somehow modified translation rules, and have exact model word on
exact admin pages.  for example, if model name is 'robot', can i have

'dodaj robota' on first page, and 'robot je promijenjen' on some other

in English:
'add robot' and 'robot has changed'

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: UnicodeDecodeError when rendering template

2008-04-23 Thread Boris Ozegovic

On 4/23/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  Are you using .96 or SVN?

0.96

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



UnicodeDecodeError when rendering template

2008-04-23 Thread Boris Ozegovic
I am getting UnicodeDecodeError, 'ascii' codec can't decode byte 0xc4.
 I using utf-8 in forms.py, and also, my template is saved as UTF-8.
And it doesn't work.   Any ideas?

This is part of my forms.py

--
# -*- coding: utf-8 -*-

CHOICES1 = (
('child', 'Dječja'),
('general', 'Opća'),
)

class NewExamForm(forms.Form):
anamnesis = forms.ChoiceField(choices=CHOICES1, 
widget=forms.RadioSelect())
--

And this is par of my template:

Tip anamneze:{{ form.anamnesis }}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Troubles with localization

2008-04-15 Thread Boris Ozegovic

On 4/15/08, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:

>  Also you said you "translated Django". Since Django already has a
>  Croation translation in trunk, does that work properly?

The problem was in PYTHONPATH :-/  Django root wasn't in PYTHONPATH.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Troubles with localization

2008-04-14 Thread Boris Ozegovic

I recently translated Django on croatian language, it works like a
charm, but only on my computer?  :)  Today when I deployed application
to server, hr localization didn't worked.  In settings.py I have 'hr'
just like I have at my home.  Folder 'hr' is at right place, and, what
is very important, every other localization works (de, en, you name
it).  What could be the problem?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Form errors

2008-03-24 Thread Boris Ozegovic

Hello

How do you handle situations like this one:
http://img209.imageshack.us/img209/9596/a1se8.jpg

When you have a grid of input fields, and every one can generate
error, and, of course, you don't wanna more than one row of errors in
your table.  If I check conditions directly in template, I can have
something like this:

This filed can't be empty
This filed can't be empty
This filed can't be empty

And this is very bad.  I would like each error one at a time.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Where to send localized files

2008-03-07 Thread Boris Ozegovic

Hello

I did localization for croatian language.  Where do I send .po files?

Tnx.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---