Re: Is file based cache is safe for concurrent process?

2013-03-26 Thread Andre Terra
safe or not, it is slow. why not use redis?

On Tue, Mar 26, 2013 at 9:57 PM, Ivan Smirnoff  wrote:

> Hi all.
> Can anyone tell, does django.cache locks file for writing by concurrent
> process?
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using values_list and extra on same queryset

2013-03-26 Thread Larry Martell
On Tue, Mar 26, 2013 at 4:51 PM, Larry Martell  wrote:
> I have some existing code that calls values_list on a queryset. I need
> to add something using extra to this queryset. If I call extra before
> values_list the extra stuff is gone from the query after the
> values_list. If I call extra after the call to values_list it seems to
> have to effect - the extra stuff is not in the query. Is there some
> way to use both values_list and extra on same queryset?

I think I may have found a bug. I stepped though the code, and
values_list() does want to respect any extras that may have been
added. In django/db/models/query.py(962)_setup_query() it does:

if not self.query.extra and not self.query.aggregates:

And for my case that is returning false, but I do have extras:

(Pdb) print not self.query.extra
False
(Pdb) print self.query.extra
{'top-bottom': (u'top-bottom', [])}


This does not seem correct to me. Am I missing something here (because
I've been coding since 4:30am and it's 8pm now)?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Is file based cache is safe for concurrent process?

2013-03-26 Thread Ivan Smirnoff
Hi all.
Can anyone tell, does django.cache locks file for writing by concurrent 
process?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there a plan for Django to handle NoSQL databases natively?

2013-03-26 Thread Russell Keith-Magee
On Wed, Mar 27, 2013 at 12:46 AM, Javier Guerra Giraldez  wrote:

> On Tue, Mar 26, 2013 at 11:10 AM, Donnie Darko 
> wrote:
> > I was wondering if there there was a plan to change Django's ORM to
> support
> > NoSQL databases?
>
>
> since there's no such thing as "common NoSQL features", each datastore
> would need its own modifications, so i think the common attitude is
> that most of these features don't belong in the ORM.
>

I'm not sure where you've got that impression. Django's ORM was
*specifically* designed in a way to allow for NoSQL backends. Look at the
architecture of the django.db module -- there's a query module, and a sql
submodule. There's very little SQL content in the base query module. That's
so that we can add a "noSQL" module at some later date. We've also been
aggressive about adding SQL-specific features (e.g., HAVING clauses, GROUP
BY clauses) to the ORM API.

There's a *very* clear high level API picture of how NoSQL integration to
the ORM API would happen. See the design discussions around the NoSQL GSoC
project for more details.

What we *don't* have is a huge amount of interest in actually doing the
work to make NoSQL a development priority. NoSQL generated a lot of buzz a
few years ago, but now the buzz has died down, sober heads have prevailed,
and it's become clear that a well configured PostgreSQL store is easily a
match for a NoSQL for most use cases.

I'm not saying NoSQL doesn't have it's place. I'm just saying that 99% of
projects on the internet aren't *ever* going to face the sort combined load
demands and usage patterns that would expose the limits of a good
relational datastore and make a NoSQL datastore a necessity. And as a
result, the core team hasn't been spending a whole lot of effort in this
area.

That said - if someone wants to take on Django NoSQL support as a project,
they're certainly free to, and if they can clearly articulate a set of
changes needed in trunk that are needed to make this support happen, I'm
sure someone in the core team would be willing to make those changes.

Yours,
Russ Magee %-)

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Create Django web apps with drag and drop interface builder

2013-03-26 Thread timothy crosley
While I have a horrible microphone, I went ahead and made a screencast that 
shows building an app using WebBot, it's using AppEngine in this example 
but the steps are more or less the same when used with Django:

http://www.youtube.com/watch?v=ucougrZK9wI

On Monday, March 25, 2013 12:40:34 PM UTC-4, timothy crosley wrote:
>
> Hi Gabriel,
>
> Thanks for your response, Do you have an further information on how Servoy 
> is built - or any particular features you think I should take inspiration 
> from?
> I went to there site and tried to download it, and was only able to after 
> creating an account and filling out a survey. Even then I was presented only
> with binaries and a propitiatory licence - so I was unable to browse 
> through the code to see how it was built. And from what I can tell on there 
> site
> they are a web app platform for deploying apps (with a small set of 
> tools) similar to what Google's app engine is and not a collection of open 
> source
> tools that let's you build apps for any of these platforms (including 
> possibly Servoy in the future) like WebBot is.
>
> While I do not personally use Eclipse IDE (I'm more of a Kate guy), a lot 
> of WebBot users do and I am told WebBot works quite nicely in it, one is 
> currently
> building a tutorial on how to integrate the tool which I will upload on my 
> site, and I can ask for a rough draft of to send to you if you are 
> interested.
>
> Thanks for your feedback and for wishing me good luck!
>
> Timothy 
>
> On Monday, March 25, 2013 3:44:49 AM UTC-4, Gabriel - Iulian Dumbrava 
> wrote:
>>
>> Hi Tim,
>>
>> I have not tried webbot yet, but I would also like to make a suggestion. 
>> Take a look on how Servoy is built. It is also kind of a framework to build 
>> database intensive apps both for web and smart client. 
>>
>> They have built it on top of eclipse, so they were able to leverage on 
>> that. 
>>
>> Good luck with your project!!!
>>
>>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there a plan for Django to handle NoSQL databases natively?

2013-03-26 Thread Russell Keith-Magee
On Wed, Mar 27, 2013 at 12:10 AM, Donnie Darko  wrote:

> I really like Django. I've fiddled around a bit with Rails, but I
> personally prefer Django's logic. I also prefer Python over Ruby. Again,
> personal preferences. Despite all that, I am now switching back to Rails
> because of Django's lack of native support for databases like mongodb. I
> saw there was no plan for Django 1.5 to support NoSQL databases.
>
> I've tried to install django-nonrel as it looked promising, but with no
> success. Even if I succeeded, I can't trust this fork of django considering
> the lack of active development. There isn't even a post to tell you what
> version of the dependencies to install, some of which are updating quite
> fast. So you run into errors that are not well-documented, and it's just an
> horror.
>
> Django could be a long term investement for me, so I was wondering if
> there there was a plan to change Django's ORM to support NoSQL databases?
>
Are there any active plans to change the ORM? No.

Have we thought about it? Yes. A couple of years back, we had a Summer of
Code project to add NoSQL support to the ORM. This got to the point of
having a proof of concept implementation that worked -- but there were also
some technical problems that were never resolved, and as a result the
branch was never merged.

Django-nonrel was always an unofficial fork. AFAIK, the original developer
is no longer maintaining the project; I'm not aware if someone else has
picked up the maintenance burden.

However - it's not all gloom and doom.

Firstly, you can still use NoSQL data stores in a Django app - you just
don't get anything to do with Models. Django is Python, so if there's a
Python API for MongoDB, you can call that API in you Django view code. You
can still use Forms (but not ModelForms), URL routing, and many other parts
of Django - you just can't use anything that depends on Models.

Secondly, there's one approach to NoSQL that hasn't been investigated at
all that might yield a result -- duck typing. This is Python, and in most
cases the API doesn't care if you *actually* have a Django model - it just
needs to quack like one -- and depending on your needs, it may not be that
hard to construct an object that quacks enough like a Django model to use
it with ModelForms or Admin. This sort of API wrapper is something that
could be developed externally to the Django project -- again, as long as
your wrapper quacks the right way, it should be possible to make it
compatible.

Yours,
Russ Magee %-)

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using values_list and extra on same queryset

2013-03-26 Thread Larry Martell
On Tue, Mar 26, 2013 at 5:04 PM, Andre Terra  wrote:
> Could you provide us any examples or code at all?


The app is very abstracted. It builds a queryset, starting with:

queryset = self.data_model.objects.filter(**args)

then there are more calls to filter on it and then it finally gets to
the code I'm modifying, and there's a call to queryset =
queryset.values_list()

If I put my queryset = queryset.extra() before that, then look at the
query, my extra is there:


-> queryset = queryset.extra(select={field['name'] : field['name']})
(Pdb) n
-> queryset = queryset.values_list(*self.get_search_columns())
(Pdb) print queryset.query
SELECT (top-bottom) AS `top-bottom`,  
(Pdb) n
-> data = list(queryset)
(Pdb) print queryset.query
SELECT `data_cst`.`image_measurer_id`, `data_cst`.`image_pr_top_id`,
`data_target`.`name`, `data_recipe`.`name`, `data_cst`.`ep`,
`data_lot`.`name`, `data_cst`.`date_time`, `data_cst`.`bottom` FROM
`data_cst` INNER JOIN `data_target` ON (`data_cst`.`target_name_id` =
`data_target`.`id`) INNER JOIN `data_recipe` ON
(`data_cst`.`recipe_id` = `data_recipe`.`id`) INNER JOIN `data_lot` ON
(`data_cst`.`lot_id` = `data_lot`.`id`) WHERE (`data_cst`.`date_time`
<= 2013-03-26 23:59:59  AND `data_cst`.`date_time` >= 2010-03-26
00:00:00 ) ORDER BY `data_cst`.`date_time` DESC


But if I reverse the order the extra doesn't make to the query at all:



Then after the call to queryset.values_list() it's gone:


-> queryset = queryset.values_list(*self.get_search_columns())
(Pdb) n
-> queryset = queryset.extra(select={field['name'] : field['name']})
(Pdb) print queryset.query
SELECT `data_cst`.`image_measurer_id`, `data_cst`.`image_pr_top_id`,
`data_target`.`name`, `data_recipe`.`name`, `data_cst`.`ep`,
`data_lot`.`name`, `data_cst`.`date_time`, `data_cst`.`bottom` FROM
`data_cst` INNER JOIN `data_target` ON (`data_cst`.`target_name_id` =
`data_target`.`id`) INNER JOIN `data_recipe` ON
(`data_cst`.`recipe_id` = `data_recipe`.`id`) INNER JOIN `data_lot` ON
(`data_cst`.`lot_id` = `data_lot`.`id`) WHERE (`data_cst`.`date_time`
<= 2013-03-26 23:59:59  AND `data_cst`.`date_time` >= 2010-03-26
00:00:00 ) ORDER BY `data_cst`.`date_time` DESC
{Pdb) n
-> data = list(queryset)
(Pdb) print queryset.query
SELECT `data_cst`.`image_measurer_id`, `data_cst`.`image_pr_top_id`,
`data_target`.`name`, `data_recipe`.`name`, `data_cst`.`ep`,
`data_lot`.`name`, `data_cst`.`date_time`, `data_cst`.`bottom` FROM
`data_cst` INNER JOIN `data_target` ON (`data_cst`.`target_name_id` =
`data_target`.`id`) INNER JOIN `data_recipe` ON
(`data_cst`.`recipe_id` = `data_recipe`.`id`) INNER JOIN `data_lot` ON
(`data_cst`.`lot_id` = `data_lot`.`id`) WHERE (`data_cst`.`date_time`
<= 2013-03-26 23:59:59  AND `data_cst`.`date_time` >= 2010-03-26
00:00:00 ) ORDER BY `data_cst`.`date_time` DESC

>
>
> Cheers,
> AT
>
> On Tue, Mar 26, 2013 at 7:51 PM, Larry Martell 
> wrote:
>>
>> I have some existing code that calls values_list on a queryset. I need
>> to add something using extra to this queryset. If I call extra before
>> values_list the extra stuff is gone from the query after the
>> values_list. If I call extra after the call to values_list it seems to
>> have to effect - the extra stuff is not in the query. Is there some
>> way to use both values_list and extra on same queryset?
>>
>> --
>> 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Using values_list and extra on same queryset

2013-03-26 Thread Andre Terra
Could you provide us any examples or code at all?


Cheers,
AT

On Tue, Mar 26, 2013 at 7:51 PM, Larry Martell wrote:

> I have some existing code that calls values_list on a queryset. I need
> to add something using extra to this queryset. If I call extra before
> values_list the extra stuff is gone from the query after the
> values_list. If I call extra after the call to values_list it seems to
> have to effect - the extra stuff is not in the query. Is there some
> way to use both values_list and extra on same queryset?
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Using values_list and extra on same queryset

2013-03-26 Thread Larry Martell
I have some existing code that calls values_list on a queryset. I need
to add something using extra to this queryset. If I call extra before
values_list the extra stuff is gone from the query after the
values_list. If I call extra after the call to values_list it seems to
have to effect - the extra stuff is not in the query. Is there some
way to use both values_list and extra on same queryset?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [django-users] Limit uploaded image properties

2013-03-26 Thread Avraham Serour
next time consider recommending pillow instead of PIL
https://github.com/python-imaging/Pillow
https://pypi.python.org/pypi/Pillow/2.0.0


On Tue, Mar 26, 2013 at 4:30 AM, Nikolas Stevenson-Molnar <
nik.mol...@consbio.org> wrote:

> I think you can get at a file's size with the 'size' attribute (in
> bytes). Conceivably you could stick it inside a "clean" method for your
> form and do it that way.
>
> class MyForm(forms.Form):
> ...
> def clean_image(self):
> image = self.cleaned_data['image']
> if image.size > 1024*1024: //1MB
> raise forms.ValidationError("Images are limited to 1MB")
> return image
>
> Alternatively, if you have PIL installed, you can use it to look at the
> image dimensions and cap enforce restrictions there (or simply rescale
> to the maximum). http://www.pythonware.com/products/pil/
>
> _Nik
>
> On 3/25/2013 7:24 PM, Shawn Milochik wrote:
> > It's easy to do it by file size in your server config. For example, in
> > nginx or Apache. You shouldn't have to set it in Django, and I don't
> > believe Django provides any ability to cap it.
> >
> > https://docs.djangoproject.com/en/dev/topics/http/file-uploads/
> >
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: 1.5 user abstract question

2013-03-26 Thread Rafael E. Ferrero
Inherid from User Model

2013/3/26 frocco 

> Hello
>
> I need a couple of extra fields in my user model
>
> Do I have to specify all fields in django user?
>
> Is django user still used?
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Rafael E. Ferrero
Claro: (03562) 15514856

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




1.5 user abstract question

2013-03-26 Thread frocco
Hello

I need a couple of extra fields in my user model 

Do I have to specify all fields in django user?

Is django user still used?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Runtime error (using SQLite)

2013-03-26 Thread Bill Freeman
More error message details?  Stack trace?  Does it happen right away at
startup, or do you have to visit one of these views,and if so, which?

On Tue, Mar 26, 2013 at 8:32 AM, Fusi0n  wrote:

> Can someone spot something that could possibly cause a runtime error ?
> This the Poll example from the djangoproject homepage. Any help is
> appreciated.
>
> *views.py: *
>
> from django.http import HttpResponse, HttpResponseRedirect
> from django.shortcuts import render, get_object_or_404
> from django.core.urlresolvers import reverse
> from polls.models import Poll, Choice
>
> def index(request):
> latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
> context = {'latest_poll_list': latest_poll_list}
> return render(request, 'polls/index.html', context)
>
> def detail(request, poll_id):
> poll = get_object_or_404(Poll, pk=poll_id)
> return render(request, 'polls/detail.html', {'poll':poll})
> def results(request, poll_id):
> poll = get_object_or_404(Poll, pk=poll_id)
> return render(request, 'polls/results.html', {'poll': poll})
> def vote(request, poll_id):
> p = get_object_or_404(Poll, pk=poll_id)
> try:
> selected_choice = p.choice_set.get(pk=request.POST['choice'])
> except (KeyError, Choice.DoesNotExist):
> # Redisplay the poll voting form.
> return render(request, 'polls/detail.html', {
> 'poll': p,
> 'error_message': "You didn't select a choice.",
> })
> else:
> selected_choice.votes += 1
> selected_choice.save()
> # Always return an HttpResponseRedirect after successfully dealing
> # with POST data. This prevents data from being posted twice if a
> # user hits the Back button.
> return HttpResponseRedirect(reverse('polls:results', args=(p.id,)))
>
>  --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: NoReverseMatch at /my_account/

2013-03-26 Thread Bill Freeman
You haven't shown us the call to reverse of use of the url template tag
that evokes this issue.  A stack trace might be helpful too, in jogging
someone's memory.

But I seem to recall problems when I named my url patter the same as the
name of my view function.  It's not that it can't work that way, just that
it was surprising, and required specifying things strangely in the reverse
or url call.  But I could be remembering a nightmare instead of reality.

There's always good old pdb.

Bill

On Tue, Mar 26, 2013 at 6:37 AM, rainikotobary wrote:

> Hello,
>
> I dont have the $ sign like you but I'm still getting this error.
> Please, is there any workaround, what are the issues ? I really about to
> give up
>
> Le lundi 4 février 2013 21:48:37 UTC+3, frocco a écrit :
>>
>> I am getting NoReverseMatch at /my_account/
>> what is wrong with my urls?
>> Thanks
>>
>> Reverse for 'order_info' with arguments '()' and keyword arguments '{}' not 
>> found.
>>
>> main urls.py
>>
>> (r'^my_account/$', include('accounts.urls')),
>>
>>
>> accounts/urls.py
>>
>> urlpatterns = patterns('accounts.views',
>> (r'^$', 'my_account',
>>  {'template_name': 'registration/my_account.html'**}, 'my_account'),
>> (r'^order_info/$', 'order_info',
>>  {'template_name': 'registration/order_info.html'**}, 'order_info'),
>>  (r'^register/$', 'register',
>>  {'template_name': 'registration/register.html', 'SSL': 
>> settings.ENABLE_SSL }, 'register'),
>> (r'^order_info/$', 'order_info',
>>  {'template_name': 'registration/order_info.html'**}, 'order_info'),
>>  (r'^order_details/(?P[-\w]+)/$', 'order_details',
>>  {'template_name': 'registration/order_details.**html'}, 
>> 'order_details'),
>> )
>>
>>  --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Casting a raw query set as a list for pagination

2013-03-26 Thread Bill Freeman
Wouldn't you be better served by implementing the count() (which is
probably what the paginator calls) method on your raw queryset (subclassing
as necessary, whatever a raw queryset is), rather than poking into
paginator internals?

On Tue, Mar 26, 2013 at 5:51 AM,  wrote:

> I'm trying to implement Django's built in pagination feature with a raw
> query set. I've researched the issue and the answer is I need to cast my
> set as a list. Something like this:
>
> paginator = Paginator(refg, 100) # Show 100 contacts per page
> paginator._count = len(list(refg))
>
> From my understanding, setting the count field for the paginator should 
> prevent Django from trying to get the size of my raw set, but this is not the 
> case.  I'm still getting the "RawQuerySet has no len() operation" error.  
> I've attched the relevant code from my views.py and my template.
>
> Can I get some advice as to how I can fix this error?
>
>
> views.py
> refg = RefGene.objects.raw(qrefg)
>
> paginator = Paginator(refg, 100) # Show 100 contacts per page
> paginator._count = len(list(refg))
>
> # using django's generated forms
> c = RequestContext(request, {
> "refg": refg, ... })
>
> return HttpResponse(t.render(c))
>
>
> template
>
> {% autopaginate refg %}
> {% for r in refg %}
>
> 
> {{ r.data}}
> {{ r.loc}}
> 
>
> {% endfor %}
> {% paginate %}
>
>  --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Announcement - django-base64field

2013-03-26 Thread Alir3z4
Hi,

I've released django-base64feld. Current version is 0.9.
 I'm using this app for couple of months now, So I've done some clean-up on 
it, 
wrote some tests and released it.

Overview

A django model field  to bring ``base64`` encoded key to models.
It generate a base64 encoded key from ``pk`` field on models.

 You can read more about it on its github repository page,
Also it's very well tested to demonstrate how it works.

django-base64field is available on pypi and github.

pypi:
http://pypi.python.org/pypi/django-base64field

github:
https://github.com/Alir3z4/django-base64field

Regards,
Alireza Savand

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: makemessages failing with non ascii characters in templates

2013-03-26 Thread Bastian
I have to search again to filter only the non ascii chars in the comments. 
Right now I have a list of all non ascii characters. But I am considering 
upgrading to 1.4 before that not only for the translations. If not, or if 
the problem still exists by then I will search for the exact template.
Thanks for your help, much appreciated.

On Tuesday, March 26, 2013 4:07:02 PM UTC+1, Ramiro Morales wrote:
>
> On Tue, Mar 26, 2013 at 9:23 AM, Bastian  
> wrote: 
> > If I understand well, your fix is used to allow non ascii characters in 
> the 
> > comments of a template. I found non ascii characters outside comments 
> too, 
> > won't this break also? 
>
> Unfortunately we don't have information about which template file is the 
> one 
> triggering the issue. 
>
> it would be great if you could isolate it and create a simple test case. 
>
> Non ASCII characters in non-comment template content should be handled 
> transparently. 
>
> -- 
> Ramiro Morales 
> @ramiromorales 
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there a plan for Django to handle NoSQL databases natively?

2013-03-26 Thread Nikolas Stevenson-Molnar
Does anyone know what approach Rails takes to support for non-rel databases?

_Nik

On 3/26/2013 9:46 AM, Javier Guerra Giraldez wrote:
> On Tue, Mar 26, 2013 at 11:10 AM, Donnie Darko  wrote:
>> I was wondering if there there was a plan to change Django's ORM to support
>> NoSQL databases?
>
> since there's no such thing as "common NoSQL features", each datastore
> would need its own modifications, so i think the common attitude is
> that most of these features don't belong in the ORM.
>
> also, most NoSQL datastores have very simple APIs, so thin wrappers
> are in many cases more appropriate than a full-fledged ORM.  Other,
> "thicker" abstraction layers tend to be application-specific, so they
> could be on extra modules, instead of in Django core.
>
> finally, even if Django doesn't support a specific datastore, as long
> as there are good Python libraries, you can use them just nicely, even
> from the templates.
>
> --
> Javier
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there a plan for Django to handle NoSQL databases natively?

2013-03-26 Thread Javier Guerra Giraldez
On Tue, Mar 26, 2013 at 11:10 AM, Donnie Darko  wrote:
> I was wondering if there there was a plan to change Django's ORM to support
> NoSQL databases?


since there's no such thing as "common NoSQL features", each datastore
would need its own modifications, so i think the common attitude is
that most of these features don't belong in the ORM.

also, most NoSQL datastores have very simple APIs, so thin wrappers
are in many cases more appropriate than a full-fledged ORM.  Other,
"thicker" abstraction layers tend to be application-specific, so they
could be on extra modules, instead of in Django core.

finally, even if Django doesn't support a specific datastore, as long
as there are good Python libraries, you can use them just nicely, even
from the templates.

--
Javier

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Is there a plan for Django to handle NoSQL databases natively?

2013-03-26 Thread Donnie Darko


I really like Django. I've fiddled around a bit with Rails, but I 
personally prefer Django's logic. I also prefer Python over Ruby. Again, 
personal preferences. Despite all that, I am now switching back to Rails 
because of Django's lack of native support for databases like mongodb. I 
saw there was no plan for Django 1.5 to support NoSQL databases.

I've tried to install django-nonrel as it looked promising, but with no 
success. Even if I succeeded, I can't trust this fork of django considering 
the lack of active development. There isn't even a post to tell you what 
version of the dependencies to install, some of which are updating quite 
fast. So you run into errors that are not well-documented, and it's just an 
horror.

Django could be a long term investement for me, so I was wondering if there 
there was a plan to change Django's ORM to support NoSQL databases?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: makemessages failing with non ascii characters in templates

2013-03-26 Thread Ramiro Morales
On Tue, Mar 26, 2013 at 9:23 AM, Bastian  wrote:
> If I understand well, your fix is used to allow non ascii characters in the
> comments of a template. I found non ascii characters outside comments too,
> won't this break also?

Unfortunately we don't have information about which template file is the one
triggering the issue.

it would be great if you could isolate it and create a simple test case.

Non ASCII characters in non-comment template content should be handled
transparently.

-- 
Ramiro Morales
@ramiromorales

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to copy a cart session

2013-03-26 Thread Galia Weiss
Hi,
Not sure this is what you mean, but I am trying to help.
If I understand the cart data is saved somewhere in your database, and is 
linked to the user.

How did you do your cart form?
I think I have a similar scenario, in my case, I have a ModelForm based on 
an Order model I have defined
(which in your case, could be linked to a session ID in the begining and 
later to the user)
So when user looks at his/hers orders, and click on one, it actualy open 
the ModelForm with the related data
If you want to actualy duplicate it, you can use the data from the order 
that was just clicked as an "initial" data to a new instance of the 
ModelForm

One note - in a cart scenarion, the ModelForm is normally a ModelFormSet 
because the cart, includes many products, and you should be able to modify 
the quantity or delete each product

Hope this helps
Galia

On Monday, March 25, 2013 4:51:36 PM UTC+1, slim wrote:
>
>
> Hello everyone,
>
>
> I have an e-commerce site
> A user arrives  without first logging in, adds a few things to their cart, 
>  a session is established for this user, and then proceeds to the checkout. 
> the command is then saved in database.
>
> Now I need the user to log in and see their recent commands,untill now no 
> probleme (at least at first sight) but the user want to "duplicate" one of 
> their recent commands put it in the current cart then modify on it if 
> necessary before checkout
>
> I have absolutely no idea how to do that :/
>
> If possible,I need a quick answer on the complexity of doing it and how 
> much time I need so I can go back to my boss
> then any clues to help me do that would be greatly appreciated
>
> Thanks in advance
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: save as

2013-03-26 Thread Larry Martell
On Tue, Mar 26, 2013 at 6:48 AM, Larry Martell  wrote:
> On Wed, Mar 20, 2013 at 6:26 PM, Felipe Coelho  wrote:
>>> 2013/3/20 Larry Martell 
>>>
>>>
>>> I'm not outputting any PDF. I have a zip file I want to download to
>>> the user's computer, and I also want my template rendered.
>>
>>
>> That means you have should have two requests, possibly processed by two
>> different views, which is what Felipe (the other one) is trying to tell you.
>>
>> You must have a view that renders your template. In the resulting page,
>> include something to trigger the file download from the other view.
>
> OK, I've implemented this using ajax as the other Felipe suggested,
> but the save as is not getting triggered on the response from the view
> invoked by the ajax call. If I invoke the same view by cutting and
> pasting the URL generated by the ajax call into my browser's address
> bar the save as is invoked, but when called from ajax it is not. Any
> idea why that could be happening?

I figured this out - instead of using ajax I just assign the URL to
location.href. Works perfectly.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Runtime error (using SQLite)

2013-03-26 Thread Fusi0n
Can someone spot something that could possibly cause a runtime error ? This 
the Poll example from the djangoproject homepage. Any help is appreciated.

*views.py: *

from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.core.urlresolvers import reverse
from polls.models import Poll, Choice

def index(request):
latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
context = {'latest_poll_list': latest_poll_list}
return render(request, 'polls/index.html', context) 

def detail(request, poll_id):
poll = get_object_or_404(Poll, pk=poll_id)
return render(request, 'polls/detail.html', {'poll':poll})
def results(request, poll_id):
poll = get_object_or_404(Poll, pk=poll_id)
return render(request, 'polls/results.html', {'poll': poll})
def vote(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
try:
selected_choice = p.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
# Redisplay the poll voting form.
return render(request, 'polls/detail.html', {
'poll': p,
'error_message': "You didn't select a choice.",
})
else:
selected_choice.votes += 1
selected_choice.save()
# Always return an HttpResponseRedirect after successfully dealing
# with POST data. This prevents data from being posted twice if a
# user hits the Back button.
return HttpResponseRedirect(reverse('polls:results', args=(p.id,)))

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: save as

2013-03-26 Thread Larry Martell
On Wed, Mar 20, 2013 at 6:26 PM, Felipe Coelho  wrote:
>> 2013/3/20 Larry Martell 
>>
>>
>> I'm not outputting any PDF. I have a zip file I want to download to
>> the user's computer, and I also want my template rendered.
>
>
> That means you have should have two requests, possibly processed by two
> different views, which is what Felipe (the other one) is trying to tell you.
>
> You must have a view that renders your template. In the resulting page,
> include something to trigger the file download from the other view.

OK, I've implemented this using ajax as the other Felipe suggested,
but the save as is not getting triggered on the response from the view
invoked by the ajax call. If I invoke the same view by cutting and
pasting the URL generated by the ajax call into my browser's address
bar the save as is invoked, but when called from ajax it is not. Any
idea why that could be happening?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: makemessages failing with non ascii characters in templates

2013-03-26 Thread Bastian
If I understand well, your fix is used to allow non ascii characters in the 
comments of a template. I found non ascii characters outside comments too, 
won't this break also? 

On Tuesday, March 26, 2013 12:19:36 PM UTC+1, Ramiro Morales wrote:
>
> On Tue, Mar 26, 2013 at 8:04 AM, Bastian  
> wrote: 
> > Hi, I am trying to create a .po file to start a translation. I use the 
> > command './manage.py makemessages -l ru' to try to create the Russian 
> > locale. The script seems to be working for a while and then crashes 
> with: 
> > 
> > processing language ru 
> > Traceback (most recent call last): 
> >   File "./manage.py", line 15, in  
> > execute_manager(settings) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
>
> > line 438, in execute_manager 
> > utility.execute() 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
>
> > line 379, in execute 
> > self.fetch_command(subcommand).run_from_argv(self.argv) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
>  
>
> > line 191, in run_from_argv 
> > self.execute(*args, **options.__dict__) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
>  
>
> > line 220, in execute 
> > output = self.handle(*args, **options) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
>  
>
> > line 351, in handle 
> > return self.handle_noargs(**options) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
>  
>
> > line 365, in handle_noargs 
> > make_messages(locale, domain, verbosity, process_all, extensions, 
> > symlinks, ignore_patterns, no_wrap, no_obsolete) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
>  
>
> > line 233, in make_messages 
> > f.write(templatize(src, orig_file[2:])) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/utils/translation/__init__.py",
>  
>
> > line 127, in templatize 
> > return _trans.templatize(src, origin) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
>  
>
> > line 450, in templatize 
> > content = u''.join(comment) 
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: 
> > ordinal not in range(128) 
>
> Upgrade your copy of Django 1.3.x to a supported version (1.3 isn't 
> for this kind 
> of fixes) or apply this fix manually: 
>
>
> https://github.com/django/django/commit/0defa7dc9dc97a11baea3b91158fbc7c57e5c3a6
>  
>
> Django versions 1.4 or newer already include it. 
>
> As a general rule, if you find a problem with an ancient version it's 
> better to test 
> with a newer version because chanes are it has been fixed. 
>
> -- 
> Ramiro Morales 
> @ramiromorales 
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




problems with django-celery

2013-03-26 Thread Mateusz Iwański
Hi,

I have a problem with django-celery. When i want to delay function I get an 
error from celery worker, it happens every second time when i want to use 
it. 

Error from celery worker:

Can't decode message body: ImportError('No module named 
manager.apps.ffmpeg.tasks',) (type:u'application/x-python-serialize' 
encoding:u'binary' 
raw:"'\\x80\\x02}q\\x01(U\\x07expiresq\\x02NU\\x03utcq\\x03\\x88U\\x04argsq\\x04cmanager.apps.ffmpeg.tasks\\nFfmpegTasks\\nq\\x05)\\x81q\\x06}q\\x07(U\\tfile_pathq\\x08X*\\x00\\x00\\x00/media/temp/video/2462009/8132009624142319U\\x02IDq\\tM\\x1eDU\\x0cvideo_objectq\\ncdjango.db.models.base\\nmodel_unpickle\\nq\\x0bcmanager.apps.manager.models\\nVideoContent\\nq\\x0c]cdjango.db.models.base\\nsimple_class_factory\\nq\\r\\x87Rq\\x0e}q\\x0f(U\\x08date_addq\\x10cdatetime\\ndatetime\\nq\\x11U\\n\\x07\\xd9\\x06\\x18\\x0e\\x17\\x00\\x00\\x00\\x00cpytz\\n_UTC\\nq\\x12)Rq\\x13\\x86Rq\\x14U\\x04busyq\\x15\\x89U\\x0bdescriptionq\\x16XF\\x00\\x00\\x00Spotkanie
 
z Wand? P\\xc3\\xb3?tawsk?, przyjaci\\xc3\\xb3?k? Jana Paw?a II cz??c 
druga.U\\x0f_category_cacheq\\x17h\\x0bcmanager.apps.manager.models\\nVideoCategory\\nq\\x18]h\\r\\x87Rq\\x19}q\\x1a(U\\x06_stateq\\x1bcdjango.db.models.base\\nModelState\\nq\\x1c)\\x81q\\x1d}q\\x1e(U\\x06addingq\\x1f\\x89U\\x02dbq...
 
(1317b)"')

I installed librabbitmq and worker after that give me an error:

Can't decode message body: ImportError('No module named 
manager.apps.ffmpeg.tasks',) (type:'application/x-python-serialize' 
encoding:'binary' raw:' (1277b)'') 

First time when i delay function everything is OK the second time I have an 
error the third time work properly and so on.

RabbitMQ 3.0.4
Django 1.4.0
Linux version 3.2.0-39-generic (buildd@aatxe) (gcc version 4.6.3 
(Ubuntu/Linaro 4.6.3-1ubuntu5) ) #62-Ubuntu SMP Wed Feb 27 22:05:17 UTC 2013

celery report :

software -> celery:3.0.17 (Chiastic Slide) kombu:2.5.8 py:2.7.3
billiard:2.7.3.23 librabbitmq:1.0.1
platform -> system:Linux arch:32bit, ELF imp:CPython
loader   -> celery.loaders.default.Loader
settings -> transport:librabbitmq results:disabled

__class__: 
__cmp__: 
__contains__: 
__delattr__: 
__delitem__: 
__doc__: "dict() -> new empty dictionary\ndict(mapping) -> new dictionary 
initialized from a mapping object's\n(key, value) pairs\ndict(iterable) 
-> new dictionary initialized as if via:\nd = {}\nfor k, v in 
iterable:\nd[k] = v\ndict(**kwargs) -> new dictionary initialized 
with the name=value pairs\nin the keyword argument list.  For example: 
 dict(one=1, two=2)"
__eq__: 
__format__: 
__ge__: 
__getattribute__: 
__getitem__: 
__gt__: 
__hash__: None
__init__: 
__iter__: 
__le__: 
__len__: 
__lt__: 
__ne__: 
__new__: 
__reduce__: 
__reduce_ex__: 
__repr__: 
__setattr__: 
__setitem__: 
__sizeof__: 
__str__: 
__subclasshook__: 
clear: 
copy: 
fromkeys: 
get: 
has_key: 
items: 
iteritems: 
iterkeys: 
itervalues: 
keys: 
pop: 
popitem: 
setdefault: 
update: 
values: 
viewitems: 
viewkeys: 
viewvalues: 

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: NoReverseMatch at /my_account/

2013-03-26 Thread rainikotobary
Hello,

I dont have the $ sign like you but I'm still getting this error.
Please, is there any workaround, what are the issues ? I really about to 
give up

Le lundi 4 février 2013 21:48:37 UTC+3, frocco a écrit :
>
> I am getting NoReverseMatch at /my_account/
> what is wrong with my urls?
> Thanks
>
> Reverse for 'order_info' with arguments '()' and keyword arguments '{}' not 
> found.
>
> main urls.py
>
> (r'^my_account/$', include('accounts.urls')),
>
>
> accounts/urls.py
>
> urlpatterns = patterns('accounts.views',
> (r'^$', 'my_account',
>  {'template_name': 'registration/my_account.html'}, 'my_account'),
> (r'^order_info/$', 'order_info',
>  {'template_name': 'registration/order_info.html'}, 'order_info'),
>   (r'^register/$', 'register', 
>   {'template_name': 'registration/register.html', 'SSL': 
> settings.ENABLE_SSL }, 'register'),
> (r'^order_info/$', 'order_info',
>  {'template_name': 'registration/order_info.html'}, 'order_info'),
>   (r'^order_details/(?P[-\w]+)/$', 'order_details', 
>   {'template_name': 'registration/order_details.html'}, 
> 'order_details'),
> )
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Casting a raw query set as a list for pagination

2013-03-26 Thread chambers24889


I'm trying to implement Django's built in pagination feature with a raw 
query set. I've researched the issue and the answer is I need to cast my 
set as a list. Something like this:

paginator = Paginator(refg, 100) # Show 100 contacts per page
paginator._count = len(list(refg))

>From my understanding, setting the count field for the paginator should 
>prevent Django from trying to get the size of my raw set, but this is not the 
>case.  I'm still getting the "RawQuerySet has no len() operation" error.  I've 
>attched the relevant code from my views.py and my template.  

Can I get some advice as to how I can fix this error?


views.py
refg = RefGene.objects.raw(qrefg) 

paginator = Paginator(refg, 100) # Show 100 contacts per page 
paginator._count = len(list(refg)) 

# using django's generated forms 
c = RequestContext(request, { 
"refg": refg, ... }) 

return HttpResponse(t.render(c)) 


template

{% autopaginate refg %}
{% for r in refg %}


{{ r.data}}
{{ r.loc}}


{% endfor %}
{% paginate %}

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: makemessages failing with non ascii characters in templates

2013-03-26 Thread Bastian
Thanks Ramiro,

I don't know the actual burden of upgrading a whole project from 1.3 to 1.4 
but it does sound terrifying :) I might go the patch way.

On Tuesday, March 26, 2013 12:19:36 PM UTC+1, Ramiro Morales wrote:
>
> On Tue, Mar 26, 2013 at 8:04 AM, Bastian  
> wrote: 
> > Hi, I am trying to create a .po file to start a translation. I use the 
> > command './manage.py makemessages -l ru' to try to create the Russian 
> > locale. The script seems to be working for a while and then crashes 
> with: 
> > 
> > processing language ru 
> > Traceback (most recent call last): 
> >   File "./manage.py", line 15, in  
> > execute_manager(settings) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
>
> > line 438, in execute_manager 
> > utility.execute() 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
>
> > line 379, in execute 
> > self.fetch_command(subcommand).run_from_argv(self.argv) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
>  
>
> > line 191, in run_from_argv 
> > self.execute(*args, **options.__dict__) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
>  
>
> > line 220, in execute 
> > output = self.handle(*args, **options) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
>  
>
> > line 351, in handle 
> > return self.handle_noargs(**options) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
>  
>
> > line 365, in handle_noargs 
> > make_messages(locale, domain, verbosity, process_all, extensions, 
> > symlinks, ignore_patterns, no_wrap, no_obsolete) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
>  
>
> > line 233, in make_messages 
> > f.write(templatize(src, orig_file[2:])) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/utils/translation/__init__.py",
>  
>
> > line 127, in templatize 
> > return _trans.templatize(src, origin) 
> >   File 
> > 
> "/home/env/project/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
>  
>
> > line 450, in templatize 
> > content = u''.join(comment) 
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: 
> > ordinal not in range(128) 
>
> Upgrade your copy of Django 1.3.x to a supported version (1.3 isn't 
> for this kind 
> of fixes) or apply this fix manually: 
>
>
> https://github.com/django/django/commit/0defa7dc9dc97a11baea3b91158fbc7c57e5c3a6
>  
>
> Django versions 1.4 or newer already include it. 
>
> As a general rule, if you find a problem with an ancient version it's 
> better to test 
> with a newer version because chanes are it has been fixed. 
>
> -- 
> Ramiro Morales 
> @ramiromorales 
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: makemessages failing with non ascii characters in templates

2013-03-26 Thread Ramiro Morales
On Tue, Mar 26, 2013 at 8:04 AM, Bastian  wrote:
> Hi, I am trying to create a .po file to start a translation. I use the
> command './manage.py makemessages -l ru' to try to create the Russian
> locale. The script seems to be working for a while and then crashes with:
>
> processing language ru
> Traceback (most recent call last):
>   File "./manage.py", line 15, in 
> execute_manager(settings)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 438, in execute_manager
> utility.execute()
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
> line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
> line 220, in execute
> output = self.handle(*args, **options)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/base.py",
> line 351, in handle
> return self.handle_noargs(**options)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
> line 365, in handle_noargs
> make_messages(locale, domain, verbosity, process_all, extensions,
> symlinks, ignore_patterns, no_wrap, no_obsolete)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
> line 233, in make_messages
> f.write(templatize(src, orig_file[2:]))
>   File
> "/home/env/project/lib/python2.7/site-packages/django/utils/translation/__init__.py",
> line 127, in templatize
> return _trans.templatize(src, origin)
>   File
> "/home/env/project/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
> line 450, in templatize
> content = u''.join(comment)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7:
> ordinal not in range(128)

Upgrade your copy of Django 1.3.x to a supported version (1.3 isn't
for this kind
of fixes) or apply this fix manually:

https://github.com/django/django/commit/0defa7dc9dc97a11baea3b91158fbc7c57e5c3a6

Django versions 1.4 or newer already include it.

As a general rule, if you find a problem with an ancient version it's
better to test
with a newer version because chanes are it has been fixed.

-- 
Ramiro Morales
@ramiromorales

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




makemessages failing with non ascii characters in templates

2013-03-26 Thread Bastian
Hi, I am trying to create a .po file to start a translation. I use the 
command './manage.py makemessages -l ru' to try to create the Russian 
locale. The script seems to be working for a while and then crashes with:

processing language ruTraceback (most recent call last):
  File "./manage.py", line 15, in 
execute_manager(settings)
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 438, in execute_manager
utility.execute()
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/__init__.py",
 line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/base.py", 
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/base.py", 
line 220, in execute
output = self.handle(*args, **options)
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/base.py", 
line 351, in handle
return self.handle_noargs(**options)
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
 line 365, in handle_noargs
make_messages(locale, domain, verbosity, process_all, extensions, symlinks, 
ignore_patterns, no_wrap, no_obsolete)
  File 
"/home/env/project/lib/python2.7/site-packages/django/core/management/commands/makemessages.py",
 line 233, in make_messages
f.write(templatize(src, orig_file[2:]))
  File 
"/home/env/project/lib/python2.7/site-packages/django/utils/translation/__init__.py",
 line 127, in templatize
return _trans.templatize(src, origin)
  File 
"/home/env/project/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
 line 450, in templatize
content = u''.join(comment)UnicodeDecodeError: 'ascii' codec can't decode 
byte 0xc3 in position 7: ordinal not in range(128)

>From what I understand makemessages will crash in such a way when encountering 
>a non ascii character in a template, whether marked for translation or not.
So I have been looking for non ascii characters in the templates of this 
project and indeed there are quite a lot of them.
Now my question is, if it really is a problem with non ascii characters in 
template files, then what can I do about those characters? Is there a way
to mark a template file as utf8 as in a .py script? Or what am I missing?

thanks!


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.