Re: basci question about queryset for retrieving top element

2012-04-15 Thread Pavan Verma
I am a Django newbie and also interested in this question. >From reading the Django book http://www.djangobook.com/en/2.0/chapter05/, I see that the query 'Publisher.objects.order_by('name')[0:2]' maps to: SELECT id, name, address, city, state_province, country, website FROM books_publisher

How to change widgets for admin site?

2012-04-15 Thread Gchorn
Hello, I'm trying to create a blog site using Django (with "Post" as my main model and "text" as the attribute corresponding to the main body of text for each post). On the admin page, when someone is filling out fields to create a new blog post, I want the "text" entry field to be larger than

Re: Can't start new project

2012-04-15 Thread Jani Tiainen
One more advice so you don't get caught with the problems: (Well I suggest that you start using virtualenvs as well, they really rock) After installing TCC/LE create one batch file (I use tcstart.btm) with the following contents: @echo off rem Set python binding to handle virtualenvironments

Re: 'ascii' codec can't encode character u'\xe4'

2012-04-15 Thread kenneth gonsalves
solved - I upgraded to today's trunk and the problem vanished. On Mon, 2012-04-16 at 10:22 +0530, kenneth gonsalves wrote: > hi, > > I am doing some work in Finnish using django trunk. The code works fine > in the shell. But on the web, I am getting a strange error. I have a > model called

'ascii' codec can't encode character u'\xe4'

2012-04-15 Thread kenneth gonsalves
hi, I am doing some work in Finnish using django trunk. The code works fine in the shell. But on the web, I am getting a strange error. I have a model called Sponsor. If I give print item.sponsor, I get: Kumpumäki Raili 21755 print item.sponsor.lname, I get: 'ascii' codec can't encode character

Re: mocking out a Model

2012-04-15 Thread Arruda
Have you ever tried model-mommy? It's has some nice features, don't know if you find what you want there but it's a good shot. Em sábado, 14 de abril de 2012 08h49min06s UTC-3, jonas escreveu: > > Hello, > > I'm trying to test a function that imports and acts upon a django model, > named House.

Re: Add new QuerySet to reverse of a ManyToMany relation

2012-04-15 Thread Arruda
Sorry everyone, I just found out this was a fixed issue in the PassThroughManager of django-model-utils, in 1.1.0 it adds also the queryset to the related. =) Em segunda-feira, 16 de abril de 2012 00h08min03s UTC-3, Arruda escreveu: > > Hi there, I don't know if I put the right title, so here

Re: mocking out a Model

2012-04-15 Thread HarpB
I would recommend that you don't use the patch decorator, but rather the patch function itself. Here is a wrapper function I used when patching classes and functions (assuming you are using TestCase class): def patch(self, *args): if len(args) == 2: patcher =

Add new QuerySet to reverse of a ManyToMany relation

2012-04-15 Thread Arruda
Hi there, I don't know if I put the right title, so here is what I'm stuck with: I have this model: > class Foo(models.Model): > name = models.CharField(...) this one: > class Bar(models.Model): > name = models.CharField() And their connection: > class FooBar(models.Model): >

Re: PythonScript(Zope) like in a django app, any tips?

2012-04-15 Thread Doug Ballance
You might also try a different scripting language, for example Lua. I've a python module "lupa" bookmarked for a project on my todo list that requires user scripting. It appears you can have a relatively sandboxed access to python objects. I'm hoping that with some careful compiling of the

Re: Can't start new project

2012-04-15 Thread Brandy
I certainly will. Thanks for the advice:) On Sunday, April 15, 2012 2:42:00 PM UTC-5, Jani Tiainen wrote: > It's apparently TCC/LE which saves me about all that command execution and > arg passing hazzle.. :) > > Never used plain command prompt so I've been immune to peculiarities of > Windows

First App: SentenceBuilder

2012-04-15 Thread Corbin Tarrant
Hello everyone, I'm brand new to django and would really appreciate any help getting started. So far I have gone through the first app tutorial and am working on my first app. I have setup the basic structure of the app and also figured out user authentication. The code is on github:

Re: Can't start new project

2012-04-15 Thread Jani Tiainen
It's apparently TCC/LE which saves me about all that command execution and arg passing hazzle.. :) Never used plain command prompt so I've been immune to peculiarities of Windows command line utilities. I suggest you give it a try - it's really nice. On Sun, Apr 15, 2012 at 10:04 PM, Brandy

Re: Can't start new project

2012-04-15 Thread Brandy
If you would like to read more about the issue, I found the error already reported on the Python website: http://bugs.python.org/issue7936 On Saturday, April 14, 2012 1:52:00 PM UTC-5, Jani Tiainen wrote: > Sounds very goofy. django-admin.py just creates files, doesn't open any > editors so

Re: PythonScript(Zope) like in a django app, any tips?

2012-04-15 Thread Arruda
Nice one this PyPy, I'll test this soon =) thanks! Em domingo, 15 de abril de 2012 07h58min41s UTC-3, Kevin escreveu: > > Check out PyPy Sandboxing, it may be your best bet: > > http://pypy.org/features.html#sandboxing > > > On Saturday, 14 April 2012 11:45:41 UTC-5, Arruda wrote: >> >> Hi there,

Any tool to validate django templates?

2012-04-15 Thread Marcin Tustin
Hi all, I've got a template that isn't parsing, but the error is the nondescript: TemplateSyntaxError: Could not parse the remainder: '"{%' from '"{%' Is there a tool that can help locate the source of the error? Marcin -- Marcin Tustin Tel: 07773 787 105 -- You received this message

Re: Problems extracting valid form data lately

2012-04-15 Thread Andy McKay
What does your form code look like? -- 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.

Problems extracting valid form data lately

2012-04-15 Thread Chris Seberino
The following code extracts the user info from a registration page on my Django site. Lately it isn't extracting the different fields from form.cleaned_data. When I print cd["username"] (i.e. form.cleaned_data["username"]) it gives the ENTIRE form.cleaned_data dict!?!?! Why can't I extract

why can not request context be accessed in filter

2012-04-15 Thread Zheng Li
if there any reason that request context can NOT be accessed in a filter? -- 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

Re: mocking out a Model

2012-04-15 Thread Jonas Geiregat
>> @patch('apps.market.models.House') > > Is create house in apps.market.models, or is it somewhere else? If > it's somewhere else, mock it relative to that file eg: > @patch('apps.some_file.House') def create_house can be found in apps/deps/house_factory.py Inside house_factory I ' from

Re: Admin site not working

2012-04-15 Thread andrea mucci
hi have you make a syncdb? El 15/04/2012, a las 15:17, mohamed elsebaey escribió: > Hi, > I'm a new user for django, I started using the tutorial for ver 1.4 > with > python 2.7.1 on mac 10.7.3 > when i try to open the admin site it' gives me the following error > > > DoesNotExist at /admin/

Re: Form Validation

2012-04-15 Thread Daniel Roseman
On Sunday, 15 April 2012 10:22:43 UTC+1, coded kid wrote: > > > def my_memb(request): > if request.method=="POST": > form=MembForm(request.POST) > if form.is_valid(): > data=form.cleaned_data > form.save()

Admin site not working

2012-04-15 Thread mohamed elsebaey
Hi, I'm a new user for django, I started using the tutorial for ver 1.4 with python 2.7.1 on mac 10.7.3 when i try to open the admin site it' gives me the following error DoesNotExist at /admin/ Site matching query does not exist. Request Method: GET Request URL: http://127.0.0.1:8000/admin/

Re: Working Hello World Ajax example via django pleeeease

2012-04-15 Thread Kevin
Here you go, a fully working AJAX "Hello World" example in Django: http://www.dajaxproject.com/dajaxice/ I use both Dajax and Dajaxice for a few projects of mine, check out my profile site for a fully working AJAX website made in Django: http://iamkevin.ca/ Django even has specific form

Re: Password protected URLs Django - choose which to be protected also in admin

2012-04-15 Thread Kevin
Depending on how you are building your application, you have a few options here: - If you need to protect specific rows in a database to only a handful of users, and make this configurable in admin site, use something like django-guardian to provide row-level permissions. - If you absolutely

Re: PythonScript(Zope) like in a django app, any tips?

2012-04-15 Thread Kevin
Check out PyPy Sandboxing, it may be your best bet: http://pypy.org/features.html#sandboxing On Saturday, 14 April 2012 11:45:41 UTC-5, Arruda wrote: > > Hi there, I'm doing a system where I want the users to be able to > set/change some scripts that are dynamically run(RPG like scripts). > So

Form Validation

2012-04-15 Thread coded kid
I want my form to validate the fields so that only users who fill the form field should be redirected to the next page. If a user fails to fill any of the form field, the user should be taken to the same page where it will output validation error so that the user can fill the fields. I tried