rendering to template help

2010-05-24 Thread Pirate Pete
I have been trying to get some kind of kind response from django for a few days now and it has been very unkind to me :P basically i need to create a page that has a video title (link) and an average rating with the amount of people that rated it in brackets. so it will look like ... Awesom

db autoclobbering with automated tests

2010-05-24 Thread dmitry b
Hi, I'm in the process of setting up automated selenium tests for a django app using Hudson. As part of the build script, I'm starting up a test server: $> python manage.py testserver --addrport 0.0.0.0:8080 ../../test/gui/ seed_data.json However, when this line runs, I get the following

Re: inclusion tag variable resolving

2010-05-24 Thread Dennis Kaarsemaker
On ma, 2010-05-24 at 13:49 -0700, christian verkerk wrote: > i made an inclusion tag for making an image button of varying widths, > which i call through: > > {% make_button 'click me' item.get_absolute_url %} > > i then resolve the second param in context for the button link, > however i would

Re: inclusion tag variable resolving

2010-05-24 Thread Scott Gould
Can you not simply pass foo: {% make_button 'click me' foo %} ... resolve it, and then use either its .get_absolute_url() or something other url, depending on what foo is? The inclusion tag's python code is far more equipped to deal with logic decisions, special cases, etc. than the template is.

Re: ANN: Django 1.2.1 released

2010-05-24 Thread Dhruv Adhia
Awesome! Congrats guys! Dhruv Vinodrai Adhia http://www.thirdimension.com On Mon, May 24, 2010 at 12:33 PM, James Bennett wrote: > Following up on last week's Django 1.2 release, today we'd like to > announce Django 1.2.1, the first bugfix release in the 1.2 series: > >

view permission on django admin

2010-05-24 Thread rahul jain
Hi Django, I know this has been discussed lot of times but not implemented on admin because django developers think that django admin will not be just used for viewing. Anyways, I need it for my model. I went through the path but was not able to solve this problem.

inclusion tag variable resolving

2010-05-24 Thread christian verkerk
i made an inclusion tag for making an image button of varying widths, which i call through: {% make_button 'click me' item.get_absolute_url %} i then resolve the second param in context for the button link, however i would like to be able to do something along the lines of: {% make_button

Re: Custom filterspec

2010-05-24 Thread Daniel Roseman
On May 24, 5:36 pm, Thales wrote: > Good afternoon, > > I am trying to make this snippet work:http://djangosnippets.org/snippets/1051/ > > But I am always getting the error "__init__() got an unexpected > keyword argument 'field_path'", We'll need to see the actual

Re: passing variable values in javascript being served statically

2010-05-24 Thread Daniel Roseman
On May 24, 8:24 pm, gvkalra wrote: > Hi. > I am trying to do something like this: > > views.py > > return render_to_response('abc.html',{'variable':value}) > > abc.html > > > dummy = {{variable}}; > > > > My problem: > I am not able to use dummy inside xyz.js ... OR is

Re: passing variable values in javascript being served statically

2010-05-24 Thread gvkalra
yes it is a js problem .. But I was looking for a way in which I can use Django Variables passed by a view function inside a statically served js ... since it's static, the template engine won't parse it . On May 25, 12:38 am, Rodrigue Villetard wrote: >

Re: passing variable values in javascript being served statically

2010-05-24 Thread Rodrigue Villetard
Hello, I think you can use xyz.js as a template : return render_to_response('xyz.js' > > {'variable':value}) > Your problem is more a javscript problem of variable visibility as doesn't properly make an include. regards. 2010/5/24 gvkalra > Hi. > I am trying to do

ANN: Django 1.2.1 released

2010-05-24 Thread James Bennett
Following up on last week's Django 1.2 release, today we'd like to announce Django 1.2.1, the first bugfix release in the 1.2 series: * Announcement blog post: http://www.djangoproject.com/weblog/2010/may/24/121/ * Download: http://www.djangoproject.com/download/ * Checksums:

passing variable values in javascript being served statically

2010-05-24 Thread gvkalra
Hi. I am trying to do something like this: views.py return render_to_response('abc.html',{'variable':value}) abc.html dummy = {{variable}}; My problem: I am not able to use dummy inside xyz.js ... OR is there some other way by which I can use {{variable}} inside xyz.js ?? -- You

Best solution for remote static content server?

2010-05-24 Thread Szymon
Hello, What's the best solution for dispatching static (uploaded/generated by PIL) content to another server? NFS? What I need/want: a) I need to store uploaded files and generated by PIL (Image.save('/ path/foo/bar.png')), b) I want to serve it via nginx. In early version of Django book I saw

multi table inheritance ordering bug in postgreSQL backend?

2010-05-24 Thread gentlestone
class Dokument(Model): ... class Meta: abstract = True ordering = ['id'] class SupisMajetku(Dokument): ... class Pozemok(SupisMajetku): ... -- is producing this SQL: -- SELECT

UnicodeDecodeError

2010-05-24 Thread garagefan
hey all, was wondering if my following error is a result of copying django-tagging and markdown from my windows XP machine onto my server via FTP and then moving them into the appropriate directory. http://kennethdavid.net/blog/2010/may/24/test-1/ just going through the webmonkey tutorial to

Seeking beta testers for Wing IDE 4.0's Django support

2010-05-24 Thread Stephan Deibel
Hi, Wing IDE 4.0 beta2 was just released and focuses on support for Django: * Debug Django templates (set breakpoints, step, view data, etc) * Plugin with Django-specific actions (set up project, new app, sync db, etc) * Better syntax highlighting for Django templates * Better auto-completion

Re: Line continuation in block tag?

2010-05-24 Thread Dennis Kaarsemaker
On ma, 2010-05-24 at 07:15 -0700, Thomas Allen wrote: > Thomas Allen wrote: > > Is that possible in a Django template? If my tag spans more than one > > line, it is rendered as plaintext. > > Is this not possible? Correct. Tags should be on one line. -- Dennis K. They've gone to plaid! --

Re: API with django

2010-05-24 Thread Alexandre González
Thanks for your 2c :D It works for me now with curl, I've read about serialization and test again with a ajax request thanks! On Mon, May 24, 2010 at 17:45, Ovnicraft wrote: > > > El 23 de mayo de 2010 22:05, Alexandre González escribió: > > Hi! >> >> I

Custom filterspec

2010-05-24 Thread Thales
Good afternoon, I am trying to make this snippet work: http://djangosnippets.org/snippets/1051/ My files are like this: ## admin.py from django.contrib import admin from models import Pessoa import filterspec class AdminPessoa(admin.ModelAdmin): list_filter = ['name'] pass

Re: Security Question...

2010-05-24 Thread ringemup
Not a bad idea, actually, but the other site is on shared hosting, so I don't expect the host to be willing to add a self-signed cert as trusted. On May 24, 10:07 am, Alex Robbins wrote: > Just a thought, but if you are the only person using the url, you > could

Re: Items from multiple tables on one form?

2010-05-24 Thread Scott Gould
> Recall I'd like to make a table with each row in the table being a > "form" for a paired Author-Book item (recall my book-author is 1-1). > If I make an Author formset and a Books formset and then render them > in the template it's not clear to me that the book part of the form > would in fact

Re: API with django

2010-05-24 Thread Ovnicraft
El 23 de mayo de 2010 22:05, Alexandre González escribió: > Hi! > > I must develop a django app that receives XML and returns XML. > > What's the best way to do this? Create a view that receive the XML and > parse it to return a template with the XML resultant? > > I'm newbie in

Re: Items from multiple tables on one form?

2010-05-24 Thread Michael Davis
Hi Scott: Thanks for the suggestion. The 2 ModelForms suggestion is a good idea, but I'm not clear how it will work in a formset. Recall I'd like to make a table with each row in the table being a "form" for a paired Author-Book item (recall my book-author is 1-1). If I make an Author formset

Using StdImageField in an inherit context

2010-05-24 Thread Rodrigue Villetard
Hello There, I didn't received my mail from the mailgroup, so maybe it hasn't been sent. Sorry if you have already received it. here it is : I'm using the custom field StdImageField which automatically create a thumbnail and resize the image (http://code.google.com/p/django-stdimage/). It works

Re: API with django

2010-05-24 Thread Alexandre González
I've made some progress... but I always get an error 401 at the server. This is my code, please help me!!! I've lost some hours trying to do it work: urls.py --- *from django.conf.urls.defaults import ** *from piston.resource import Resource* *from piston.authentication import

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Euan Goddard
I've found the best way to solve these problems is to use a values_list queryset and inject the result of the into the outer query. Django is smart and doesn't actually evaluate the values_list query and instead injects that as a sub query in the SQL. However in this case can't you simply do:

Re: how to avoid "in" query for large sets?

2010-05-24 Thread J. Cliff Dyer
I believe you're confused. Your reply is to Tomasz, not to me. Also, my solution requires no model changes. Go back and look at it again. Cheers, Cliff On Mon, 2010-05-24 at 06:58 -0700, omat wrote: > @cliff: you are right, but i am writing an extension to an existing > app. i want to use

values of values in querysets

2010-05-24 Thread Henrik Genssen
Hi, the short question is: how can I use a ValuesQuerySet with more than one field in an filter(abc__in=query) clause? the long one: I have fthe following queryset: query = myobj.objects.all().values('col_a', 'col_b', 'col_c') and a seconde one: qs = ourobj.object.all().filter(col_a__in=

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Tom Evans
On Mon, May 24, 2010 at 3:36 PM, Tom Evans wrote: > On Mon, May 24, 2010 at 3:23 PM, omat wrote: >> ops, this doesn't work, because the the Quiz model is pointing to the >> User model, and i want to filter on the quiz model and get the >> matching User

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Tom Evans
On Mon, May 24, 2010 at 3:23 PM, omat wrote: > ops, this doesn't work, because the the Quiz model is pointing to the > User model, and i want to filter on the quiz model and get the > matching User instances. but in the example in the docs, the query is > on the parent model. > >

Re: how to avoid "in" query for large sets?

2010-05-24 Thread omat
ops, this doesn't work, because the the Quiz model is pointing to the User model, and i want to filter on the quiz model and get the matching User instances. but in the example in the docs, the query is on the parent model. quiz_qs = Quiz.objects.filter(score__gt=90)

Re: Line continuation in block tag?

2010-05-24 Thread Thomas Allen
Thomas Allen wrote: > Is that possible in a Django template? If my tag spans more than one > line, it is rendered as plaintext. Is this not possible? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Security Question...

2010-05-24 Thread Alex Robbins
Just a thought, but if you are the only person using the url, you could make your own self-signed security cert. It would be free and protect your data. It won't show up as trusted to users, but your other server can be set to accept it. (Assuming the lack of ssl is a budget issue, that wouldn't

Content Types and Filtering Generic Relationships

2010-05-24 Thread Streamweaver
I'm trying to implement tagging using Content Types and Generic Relationships.What I want to is query any tagged item with a status of Published. All my tagged models are implementing an Abstract Model class with a status field so they share the 'Published' and 'Unpublished' types. Here are

Re: how to avoid "in" query for large sets?

2010-05-24 Thread omat
@cliff: you are right, but i am writing an extension to an existing app. i want to use the models as-is if possible. i found the part in the docs: inner_qs = Blog.objects.filter(name__contains='Cheddar') entries = Entry.objects.filter(blog__in=inner_qs) thanks. On May 24, 4:22 pm, Tomasz

Re: Unicode Error when Saving Django Model

2010-05-24 Thread Scott Gould
Point taken, three times. On May 24, 9:40 am, Karen Tracey wrote: > On Mon, May 24, 2010 at 8:27 AM, Scott Gould wrote: > > > My database and all of its tables are UTF8 encoded with UTF8 collation > > > (DEFAULT CHARSET=utf8;) > > > The data I am

Re: Unicode Error when Saving Django Model

2010-05-24 Thread Karen Tracey
On Mon, May 24, 2010 at 8:27 AM, Scott Gould wrote: > > My database and all of its tables are UTF8 encoded with UTF8 collation > > (DEFAULT CHARSET=utf8;) > > The data I am inputting is unicode > > (u'Save up to 25% on your online order of select HP LaserJet\x92s') > > > > >

Re: Unicode Error when Saving Django Model

2010-05-24 Thread Karen Tracey
On Sun, May 23, 2010 at 10:10 PM, vjimw wrote: > I have been reading up on Unicode with Python and Django and I think I > have my code set to use UTF8 data when saving or updating an object > but I get an error on model.save() > > My database and all of its tables are

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Tomasz Zieliński
On 24 Maj, 08:58, Daniel Roseman wrote: > > User.objects.filter(id__in=Quiz.objects.filter(score__gt=90)) > Nice thing, is it documented somewhere (I think I haven't this before) ? -- Tomasz Zielinski http://pyconsultant.eu -- You received this message because you are

Re: How to save links in the TextField

2010-05-24 Thread nameless
mmm I could use also javascript or css and render the links on client side ? - On 24 Mag, 14:00, Marcus Carlsson wrote: > A better approach would be just saving the link (not using html markup) > and then apply a filter to those links. This result could

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Daniel Roseman
On May 24, 1:12 pm, omat wrote: > Hi All, > > I have a Quiz model, which is related to the User model by a > ForeignKey. I want to get a queryset of users that have a certain > score. > > I want to avoid: > > User.objects.filter(id__in=[u.id for u in >

Re: Creating many-to-many tables for auth.Group model two times cause traceback in syncdb.

2010-05-24 Thread Karen Tracey
On Mon, May 24, 2010 at 6:21 AM, Xuqing Kuang wrote: > Hi. all. > > I got a strange problem when syncdb. > > The syncdb output just like following, as you can see the > auth_group_permissions table create 2 times. It break unit testing > with './manage.py test' process. >

Re: No module named django_dns.urls

2010-05-24 Thread Karen Tracey
On Mon, May 24, 2010 at 5:08 AM, Reino wrote: > I am a newbee to Django. I recently installed Django om my Centos 5.4 > Linux box and created a projekt. Then I modified settings.py to suit > my needs, and modified Apache's config file. I created the databases > with default

Re: IronPython AssertionError

2010-05-24 Thread Sam Lai
Inline. On 21 May 2010 15:46, Russell Keith-Magee wrote: > On Fri, May 21, 2010 at 1:47 AM, Joe D wrote: >> Has anyone had any luck running Django on IronPython ? > > Testing under IronPython hasn't been part of our regular testing >

Re: how to avoid "in" query for large sets?

2010-05-24 Thread J. Cliff Dyer
What you are doing is querying the database once for each user to get their ID, because of your q.user.id. This means a million separate queries. You will be better off getting the id directly off the quiz table: User.objects.filter(id__in=[q.user_id for q in Quiz.objects.filter(score__gt=90)])

Re: Unicode Error when Saving Django Model

2010-05-24 Thread Scott Gould
> My database and all of its tables are UTF8 encoded with UTF8 collation > (DEFAULT CHARSET=utf8;) > The data I am inputting is unicode > (u'Save up to 25% on your online order of select HP LaserJet\x92s') > > > But when I try to save this data I get an error > Incorrect string value:

Re: Beginner's doubt

2010-05-24 Thread Karen Tracey
On Mon, May 24, 2010 at 2:38 AM, ravi krishna wrote: > This is the error i get now > > InvalidURL at /index > > nonnumeric port: > > > Note httplib is part of base Python, not Django. Therefore you will likely find more expertise and help with using it on a Python list than

Re: Items from multiple tables on one form?

2010-05-24 Thread Scott Gould
> # Models > class Author(models.Model): >     name = models.CharField(max_length=100) >     address = models.CharField(max_length=100) > > class Book(models.Model): >     author_id = models.OneToOneField(Author) >     title = models.CharField(max_length=100) > > I'd like to have a form that

Re: Multiple apps in one view

2010-05-24 Thread Scott Gould
> Can you run multiple apps in one view, and what would be the best way > to do that. Firstly you can't "run an app" as such. Think of apps as folders on your desktop -- they organise and compartmentalise in Django. > Let's say I have two apps and I want to display some items from app1 > and

Re: how to avoid "in" query for large sets?

2010-05-24 Thread omat
ops, a small correction. i meant: User.objects.filter(id__in=[q.user.id for q in Quiz.objects.filter(score__gt=90)]) -- oMat On May 24, 3:12 pm, omat wrote: > Hi All, > > I have a Quiz model, which is related to the User model by a > ForeignKey. I want to get a queryset of

how to avoid "in" query for large sets?

2010-05-24 Thread omat
Hi All, I have a Quiz model, which is related to the User model by a ForeignKey. I want to get a queryset of users that have a certain score. I want to avoid: User.objects.filter(id__in=[u.id for u in Quiz.objects.filter(score__gt=90)]) As there are about 1 million users, this is deadly slow.

Re: How to save links in the TextField

2010-05-24 Thread Marcus Carlsson
A better approach would be just saving the link (not using html markup) and then apply a filter to those links. This result could later on be cached if performance is an issue. If you later on modify the saved links, just remember to empty the cache. On 24 May 04:55, nameless wrote: > mmm 2

Re: How to save links in the TextField

2010-05-24 Thread nameless
mmm 2 textfields for the same information ? Is this a good approach ? -- On 22 Mag, 20:11, Rolando Espinoza La Fuente wrote: > On Fri, May 21, 2010 at 6:12 PM, nameless wrote: > > > I have a simple Blog model with a TextField. What is the best

Re: How to restrict the number of file upload sessions, so as to avoid Denial of Service attacks?

2010-05-24 Thread Graham Dumpleton
On May 24, 5:23 pm, laspal wrote: > Hi, > How can I restrict the number of file upload sessions. Say suppose I > want only 100 user at any instant of time and I > also there is no  problem of Denial of Service attacks. You may want to look at it in terms of bandwidth

Re: API with django

2010-05-24 Thread Alexandre González
I'm reading the piston sample, and it appears to be my necessary app, but the documentation is very few I think :_( As I say I'm newbie and I can't make the simplest documentation_view works, when I port to my app, I get a TemplateDoesNotExist documentation.html WTF!? if no file called

Re: How to restrict the size of file being uploaded apache + django

2010-05-24 Thread Graham Dumpleton
On May 24, 5:04 pm, laspal wrote: > Hi, >  How to restrict the size of file being uploaded. I am using django > 1.1 with apache. Can I use apache for this and show some html error > page if say size is bigger then 100MB. > I can use LimitRequestBody for restricting the

Re: API with django

2010-05-24 Thread Simone Dalla
2010/5/24 Alexandre González > Hi! > > I must develop a django app that receives XML and returns XML. > > What's the best way to do this? Create a view that receive the XML and > parse it to return a template with the XML resultant? > > I'm newbie in django and need your tips :)

No module named django_dns.urls

2010-05-24 Thread Reino
I am a newbee to Django. I recently installed Django om my Centos 5.4 Linux box and created a projekt. Then I modified settings.py to suit my needs, and modified Apache's config file. I created the databases with default setting in setting.py and and created an application. It worked fine. I then

Safe and easy internationalization

2010-05-24 Thread Pascal
Hello I'm studying the migration of my django site (mixed english and french languages...) to a properly localized architecture. >From what I've read so far, using translation "tags" (or quick phrases) in the code, and translating them to every target language (including english) sounds a better

Re: API with django

2010-05-24 Thread Bruce Wang
2010/5/24 Alexandre González > Hi! > > I must develop a django app that receives XML and returns XML. > > What's the best way to do this? Create a view that receive the XML and > parse it to return a template with the XML resultant? > > I'm newbie in django and need your tips :)

Creating many-to-many tables for auth.Group model two times cause traceback in syncdb.

2010-05-24 Thread Xuqing Kuang
Hi. all. I got a strange problem when syncdb. The syncdb output just like following, as you can see the auth_group_permissions table create 2 times. It break unit testing with './manage.py test' process. The thing happens both mysql and sqlite3 backend. And I check the models.py code in

Re: API with django

2010-05-24 Thread Dennis Kaarsemaker
On ma, 2010-05-24 at 05:05 +0200, Alexandre González wrote: > I must develop a django app that receives XML and returns XML. > > What's the best way to do this? Create a view that receive the XML and > parse it to return a template with the XML resultant? That would be a good way of doing it.

How to restrict the number of file upload sessions, so as to avoid Denial of Service attacks?

2010-05-24 Thread laspal
Hi, How can I restrict the number of file upload sessions. Say suppose I want only 100 user at any instant of time and I also there is no problem of Denial of Service attacks. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: How to restrict the size of file being uploaded apache + django

2010-05-24 Thread Marcus Carlsson
As far as I know you have no way of knowing the size of the file before the upload except if you use a javascript/flash upload. Otherwise to determit the size of the file the user will have to upload it and then the form (along with the file) is sent to your view which will then handle it. The

How to restrict the size of file being uploaded apache + django

2010-05-24 Thread laspal
Hi, How to restrict the size of file being uploaded. I am using django 1.1 with apache. Can I use apache for this and show some html error page if say size is bigger then 100MB. I can use LimitRequestBody for restricting the file size in apache, My problem is I wanted to show some error page if

Re: Beginner's doubt

2010-05-24 Thread ravi krishna
This is the error i get now InvalidURL at /index nonnumeric port: On Mon, May 24, 2010 at 10:51 AM, ravi krishna wrote: > sorry the VIEW.py is: > > > > conn=httplib.HTTPConnection("www.python.org") > conn.request("GET", "/index.html") > > r1 = conn.getresponse() > print