Django snippets - printable view?

2011-01-19 Thread Derek
I see the original design for the Django Snippets site was by Jeff Croft. I am not sure if he is involved any more, or who maintains the site design, but I was wondering if the CSS could be upgraded to allow for an improved, printable view? Thanks Derek -- You received this message because you

Re: Pinax: worth installing?

2011-01-19 Thread Derek
Jason I have been planning to use Pinax for a large social network site, but your comments make me concerned (and wondering if I should wait for a 1.0 release). I'd appreciate it if you could be a bit more specific about the issues you have encountered or know about. I assume that Django itself

[beginner] extra_context in generic views

2011-01-19 Thread John Yeukhon Wong
http://docs.djangoproject.com/en/dev/topics/generic-views/#adding-extra-context I am confused by the model scenario. "For example, think of showing a list of all the books on each publisher detail page. The object_detail generic view provides the publisher to the context, but it seems there's no w

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread arlolra
maybe use something like piston https://bitbucket.org/jespern/django-piston/wiki/Home -- 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

Re: Django + CSS

2011-01-19 Thread Vovk Donets
Man, this is just a quote from Django Documentation. 2011/1/20 Osiaq > Same problem here. Follow those rules, is simple and is working > perfect. > > > http://twigstechtips.blogspot.com/2009/08/django-how-to-serve-media-files-css.html > > -- *Vovk Donets* python/django developer skype: suu

Readonly on subset of forms in Admin inlines

2011-01-19 Thread Peter Phillips
Hello, Is there a straightforward way to set fields to read only for a subset of the forms in an inline formset in the Admin? I'd like to set some fields to read only on my inline form for rows that were not created by the user. However, when I set the fields to read only, it of course affects all

Re: [django-users] Custom signals

2011-01-19 Thread Łukasz Rekucki
On 20 January 2011 02:00, Piotr Zalewa wrote: > I'm trying to add custom signals to my models. > I'm sure I'm missing some step. > > http://paste.pocoo.org/show/323618/ > The "sender" argument in receiver() must match the one in send() (using identity). In receive() you're using a class, while in

Re: 4 different domains on single apache/mod_wsgi

2011-01-19 Thread Graham Dumpleton
Technically it should be able to made to work. I would recommend though you use mod_wsgi daemon mode and delegate each Django site instance to its own process, rather than each sharing the same process but in different sub interpreters. See: http://code.google.com/p/modwsgi/wiki/QuickConfigu

Re: 4 different domains on single apache/mod_wsgi

2011-01-19 Thread Kenneth Gonsalves
On Wed, 2011-01-19 at 16:56 -0800, Osiaq wrote: > Hi Kenneth! > Distro: Ubuntu Server 10.04 well ubuntu follows the debian mode for setting up virtual hosts - you have virtual hosts files in /etc/apache/sites-available and you symlink them to /etc/apache/sites-enabled/. Here is a typical virtual

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread scabbage
Is there a way to completely disable CSRF handling? Is there an documentation about how to create web services APIs using Django without frontends? Thanks. On Jan 19, 3:26 pm, Andy McKay wrote: > > What if I wanna expose my views as web services without providing a > > UI, how do I make sure cl

[django-users] Custom signals

2011-01-19 Thread Piotr Zalewa
I'm trying to add custom signals to my models. I'm sure I'm missing some step. http://paste.pocoo.org/show/323618/ zalun -- blog http://piotr.zalewa.info jobs http://webdev.zalewa.info twit http://twitter.com/zalun face http://facebook.com/zaloon -- You received this message because you ar

Search

2011-01-19 Thread delegbede
How do I insert a search field into a django page. I have looked through the documentation and couldn't get anything. I actually want to search for a phone number on a page where there are a lot of phone numbers. Kindly help. Sent from my BlackBerry wireless device from MTN -Original M

Re: 4 different domains on single apache/mod_wsgi

2011-01-19 Thread Osiaq
Hi Kenneth! Distro: Ubuntu Server 10.04 As I said the firs site, ELG is working OK. I just changed second site (cc4h) WSGI and it worked, printing "Hello World!" so domains are redirected OK. (please see code below) But the website itself is not working, still can't find the template Regards! --

Re: Django + CSS

2011-01-19 Thread Osiaq
Same problem here. Follow those rules, is simple and is working perfect. http://twigstechtips.blogspot.com/2009/08/django-how-to-serve-media-files-css.html On Jan 20, 1:58 am, "brian.mus...@ff.com" wrote: > Is it me or does it blow your mind that there is not one standard way > of importin

Re: 4 different domains on single apache/mod_wsgi

2011-01-19 Thread Kenneth Gonsalves
On Wed, 2011-01-19 at 16:20 -0800, Osiaq wrote: > It doesnt seems as easy as I thought it will be. it is as easy as falling of a log! If you can tell us what distro you are using we can point the way. -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ --

Re: Django + CSS

2011-01-19 Thread Eric Chamberlain
Unless you are trying to serve your CSS inline, which it doesn't appear to be the case from your post, why wouldn't you serve your CSS files like any other static file? Serve the static file with your web server or CDN and put the url in the template, no magic required. On Jan 19, 2011, at 3:5

Re: Can someone help with Many-to-many referencing and then calculations against another field on the linked model

2011-01-19 Thread Kenneth Gonsalves
On Wed, 2011-01-19 at 22:34 +, The Stanley Household wrote: > Happy to send Model if needed but at the moment I'm unable to run the > server to provide admin error report, can C&P from terminal if that > would help with the error. please copy and paste your code - it is easier for us to help

Django + CSS

2011-01-19 Thread brian.mus...@ff0000.com
Is it me or does it blow your mind that there is not one standard way of importing something as common as CSS files into Django templates? I realize there are a plethora of options as mentioned on the official site here: http://docs.djangoproject.com/en/dev/howto/static-files/ None of which actuall

4 different domains on single apache/mod_wsgi

2011-01-19 Thread Osiaq
Hi all! I have 2 separate projects, with 2 separate domains The problem: first website, ELG, is working OK. Another, cc4h, cannot find template index.html, but is working perfect on localhost with Django development server. Do you know any good tutorial regarding multiple domains on single Apache

Dynamic form and grouping elements

2011-01-19 Thread gregtrobertson
I have been trying to learn Django (and Python). I have a form that can have up to n elements. Each of those elements has 3 parts to it (a TextField, a TagField and a Checkbox). The form init looks like this def __init__(self, *args, **kwargs): notesAndTags = kwargs.pop('n

Re: Error 'long' has no attribute provision

2011-01-19 Thread John
Thank you very much for your response. I guess I should have realized the problem with the constructor. The 'report_header' was a virtual record that was previously never written to the database, I inherited the further development of this code and I am still learning some of the details of pytho

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Andy McKay
> What if I wanna expose my views as web services without providing a > UI, how do I make sure clients (e.g. Ajax, actionscript, etc) can use > it without this CSRF issue? You can mark things as exempt if you'd like to and are aware of the implications: http://docs.djangoproject.com/en/dev/ref/c

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread scabbage
How do I add CSRF token to curl then? What if I wanna expose my views as web services without providing a UI, how do I make sure clients (e.g. Ajax, actionscript, etc) can use it without this CSRF issue? Thanks. On Jan 19, 4:14 am, Jirka Vejrazka wrote: > > However, when I tried this: > > >  

Re: How to install Django on sitecloud.com

2011-01-19 Thread Javier Guerra Giraldez
On Wed, Jan 19, 2011 at 5:33 PM, Afke wrote: > "You just need to > put your python scripts under cgi-bin folders and run them" sounds like they allow one-shot python scripts but not long-running python apps (like Django) i think there's some hacky way to make it work; but performance would be te

How to install Django on sitecloud.com

2011-01-19 Thread Afke
Hi How to install Django on sitecloud.com .I have Cloud Hosting account python is installed. I got msg from site operator "You just need to put your python scripts under cgi-bin folders and run them" Cloud Hosting account have ,Secure Shell (SSH) I am little confused I am new with Django but I

Can someone help with Many-to-many referencing and then calculations against another field on the linked model

2011-01-19 Thread The Stanley Household
Dear whoever is out there This is my first e-mail to any kind of group. I am also new to all the concepts of programming, SQL, Python and Django. I've worked quite hard over the last six months to try an teach myself all these things. I am now writing an App and need some help with some calcula

Re: Django Email

2011-01-19 Thread Eduardo Cereto Carvalho
django-mailer[1] is a nice application to have around if you're planning to send too much emails. It queues messages and retry failled attempts. [1] On Wed, Jan 19, 2011 at 8:09 PM, Shawn Milochik wrote: > Whatever method you decide to use to gather the e-mail addresses is up to > you, and depe

Re: Django and google webmaster tools file

2011-01-19 Thread Martin Tiršel
Yes, you are right, this file is only for verification and not served regullary, so it is easier to add such urlpattern. Martin On Wed, 19 Jan 2011 22:36:37 +0100, Eduardo Cereto Carvalho wrote: Your static files probably already live in your MEDIA_URL and this file must live in your r

Re: Django Email

2011-01-19 Thread Shawn Milochik
Whatever method you decide to use to gather the e-mail addresses is up to you, and depends on your needs. The send_mail function accepts a list of recipients, and it doesn't really matter how you get them. Two notes on sending e-mail, though: 1. Ensure that you're sending the e-mail multiple

Re: Django and google webmaster tools file

2011-01-19 Thread Eduardo Cereto Carvalho
Your static files probably already live in your MEDIA_URL and this file must live in your root path. As this is just a single file and won't be handled often you can take the same approach I use when dealing with robots.txt. Keep in mind that this is not a recomended way to serve static files but

Re: Django Template CSS Load Path

2011-01-19 Thread Matías Iturburu
On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho < eduardocer...@gmail.com> wrote: > You can use MEDIA_URL conf to get the root path to your media files. > > /> > > the above code is correct, just make sure that you are using the media context processor or returning a RequestContext, not

Re: thumbnails and rackspace files

2011-01-19 Thread garagefan
easy thumbnails certainly does a decent job of creating thumbnails. I'm not too fond of having a template tag do that though... it basically does what i'm think of doing, but in a different area. it also doesn't send the thumbnail over to cloudfiles, which is really what i'm wanting to do, and with

Re: Django Template CSS Load Path

2011-01-19 Thread Eduardo Cereto Carvalho
You can use MEDIA_URL conf to get the root path to your media files. On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus wrote: > I am trying to load a css file in my base.html template > > > > >{% block title %}Test{% endblock %} > > > > What kind of path is supposed

Django Email

2011-01-19 Thread hank23
I'm in the process of coding the logic to send email through the send_mail package of Django. My question is what's the best way to support sending an email to multiple recipients? I had thought of using a text box to enter each address individually and then having a button click call a javascript

Re: thumbnails and rackspace files

2011-01-19 Thread Michel Thadeu Sabchuk
Hi, > setting up django-storages was simple... I recommend you to use django-cumulus [1] rather than django-storages. The first one is a rewrite made by the same author. > however... on the save of my gallery application i'm creating > thumbnails. this is easy to do with my custom field... norma

Django Template CSS Load Path

2011-01-19 Thread octopusgrabbus
I am trying to load a css file in my base.html template {% block title %}Test{% endblock %} What kind of path is supposed to go in the href? Is it relative to the document root? Does anyone have an example of loading a css file including the Apache configuration?

thumbnails and rackspace files

2011-01-19 Thread garagefan
setting up django-storages was simple... using rackspace's python API to send an image to my container... met with some troubles (broken pipe error on code that worked). however... on the save of my gallery application i'm creating thumbnails. this is easy to do with my custom field... normally. d

Re: URLField strange error

2011-01-19 Thread galago
ModelForm: class ArticleForm(ModelForm): title = forms.CharField(widget=forms.TextInput(attrs={'class':'input_visible_title', 'title' : _(u'Tytuł'),}), max_length=255, min_length=3) content = forms.CharField(widget=forms.Textarea(

Re: URLField strange error

2011-01-19 Thread Ian Clelland
On Wed, Jan 19, 2011 at 10:37 AM, galago wrote: > Django 1.2.4, > Python 2.7 > All is coded as it should be. debugger shows error in python code as You > said. Maybe it will be fixed in the future. Exception is only when i put [ . > When i put [] all is ok :) Yes, either a bare '[' or ']' in the

Re: Django and google webmaster tools file

2011-01-19 Thread Martin Tiršel
This is a static file and should be served directly by webserver, so you need to configure your webserver to provide this file (like other static files but from another url). It is possible to server it by Django too, then you are looking for django.views.static.serve but It is not recommen

Re: Django and google webmaster tools file

2011-01-19 Thread SQ9MEV
galago pisze: > How can I put a file, which is needed by the Google Webmasters Tool? > Where to put it or how to configure django to read it? AFAIR, you can add a DNS record or meta tag as well, meta tag coud be placed in your template, probably base.html -- Bartek -- You received this message

Django and google webmaster tools file

2011-01-19 Thread galago
How can I put a file, which is needed by the Google Webmasters Tool? Where to put it or how to configure django to read it? -- 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 u

Re: URLField strange error

2011-01-19 Thread galago
Django 1.2.4, Python 2.7 All is coded as it should be. debugger shows error in python code as You said. Maybe it will be fixed in the future. Exception is only when i put [ . When i put [] all is ok :) -- You received this message because you are subscribed to the Google Groups "Django users"

Pracovní nabídka

2011-01-19 Thread Plovarna
Ahojte, v lednu mi končí roční smlouva, během které jsme v malém týmu budovali Django aplikaci pro zahraničního klienta. Protože se chci v budoucnu věnovat projektu Scuk.cz, smlouvu jsem už neprodlužoval. Před odchodem jsem ještě kolegům slíbil, že jim s hledáním nového člověka pomůžu a proto p

Re: URLField strange error

2011-01-19 Thread Ian Clelland
On Wed, Jan 19, 2011 at 6:29 AM, galago wrote: > When I try to insert that string to urlfield: http://asd[d I get strange > exception: > > Invalid IPv6 URL > > How to correct it to show message and not error 500? You will likely need to post some more information: What version of Django, and what

Re: URLField strange error

2011-01-19 Thread aa56280
Something's not right with the data. Can you post more details - like, what string are you trying to insert exactly? -- 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 unsubscr

Re: Error 'long' has no attribute provision

2011-01-19 Thread Łukasz Rekucki
On 19 January 2011 18:06, John wrote: > def reports_list(request, period_id) >   # some other irrelevant code >   try: >      reportheader=ReportHeader.objects.get(pk=1 >   except Exception, e: >      pass >   return render_to_response("reports_list.html, locals(), > context_instance=RequestContex

Re: Inner classses

2011-01-19 Thread balu
Thank you sir. On Jan 19, 10:12 pm, Tom Evans wrote: > On Wed, Jan 19, 2011 at 5:05 PM, balu wrote: > > Respected sir > > > I'm working to create an Online examination system using django. In > > that concept there will be Question bank from which the Questions will > > be created. I'm trying to

Error 'long' has no attribute provision

2011-01-19 Thread John
Background: In a financial application I need to archive a set of reports at the end of each reporting period, the model is reasonably complex but I have 3 models of direct concern, a 'provision', 'period' and 'reportheader'. The code is correctly generating the reports and they are archived in a

Re: Inner classses

2011-01-19 Thread Tom Evans
On Wed, Jan 19, 2011 at 5:05 PM, balu wrote: > Respected sir > > I'm working to create an Online examination system using django. In > that concept there will be Question bank from which the Questions will > be created. I'm trying to implement this but I cannot access the > subclass - "Question" i

Inner classses

2011-01-19 Thread balu
Respected sir I'm working to create an Online examination system using django. In that concept there will be Question bank from which the Questions will be created. I'm trying to implement this but I cannot access the subclass - "Question" inside the "QuestionBank" class. class QuestionBank(model

Re: Pinax: worth installing?

2011-01-19 Thread Jason
I've found the current state of Pinax to be a bit hard to use. Yes, it offers these 'ready-to-use' projects but they do not work out of the box. There are CSRF problems, they don't load the initial sample data properly, and sometimes they just don't load at all. This is the case at least when I u

Django on IIS randomly changing LANGUAGE_CODE

2011-01-19 Thread Rodrigo Cea
I hava a Django production site on IIS 6.0. The LANGUAGE_CODE is set to 'es-cl' There are forms on the site. Sometimes the site seems to switch to English, returning validation errors on dates written in dd/mm/ format. The errors themselves are in English (whereas they're normally in Spanish).

Re: Pinax: worth installing?

2011-01-19 Thread bobhaugen
I've gone a couple of different ways on Pinax: * I have built sites using Pinax pretty much as is, and Pinax heavily customized. * I have also built sites that did not start with Pinax, but added several apps blessed by Pinax and using Pinax conventions. Both approaches worked well. By the way,

Re: slight model change makes app unusable

2011-01-19 Thread bruno desthuilliers
On 19 jan, 10:52, Santiago Caracol wrote: (snip) > Whenever one wants to see the list of all (461) mobile phones in the > admin interface, the development server becomes very slow and > eventually breaks down with a memory error. Below is the class > MobilePhone. What can I do? >     def variant

Re: How to plug in Python: CGI

2011-01-19 Thread ashdesigner
Tonton, Thank you for hint, I will take a look. Anthony On Jan 19, 4:19 pm, Tonton wrote: > so nobody is perfect ! > > is mod_wsgi in apache for windows ? > > i think it is like in linux > one virtual host point to your > wsgi_handler.py but with \ instead > > look this first google result in w

Re: adding fields into another apps forms (in plugin style)

2011-01-19 Thread Shawn Milochik
You can just subclass the form or modelform. Shawn -- 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...@googl

URLField strange error

2011-01-19 Thread galago
When I try to insert that string to urlfield: http://asd[d I get strange exception: Invalid IPv6 URL How to correct it to show message and not error 500? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d

Re: Pinax: worth installing?

2011-01-19 Thread ashdesigner
Dear all (and especially Russel!))) Thank you so much for your efforts to clarify on the subject. Frankly, I didn't expect THAT useful replies, indeed. Lot of things have been given proper places. In a nutshell, and in addition to what has been mentioned above, I am wondering if there is some desc

Re: Pinax: worth installing?

2011-01-19 Thread Ivan Uemlianin
Dear ashdesigner I haven't tried Pinax for a while but last time I did (June 2009) I got the impression that it was an all-or-nothing affair. Pinax was marketing itself as a "social networking site in a box" and if that's what you wanted, it was a reasonable choice. However, it turned out that I

Re: How to plug in Python: CGI

2011-01-19 Thread Tonton
so nobody is perfect ! is mod_wsgi in apache for windows ? i think it is like in linux one virtual host point to your wsgi_handler.py but with \ instead look this first google result in wsgi apache django windows search : http://pradyumnajoshi.wordpress.com/2009/06/09/setting-up-mod_wsgi-for-ap

Re: How to plug in Python: CGI

2011-01-19 Thread ashdesigner
Graham, Thanks, but I'm running Windows. Anthony On Jan 19, 12:24 am, Graham Dumpleton wrote: > On Wednesday, January 19, 2011 12:52:14 AM UTC+11, tonton wrote: > > > now it is seems to be mod_wsgi > > > in apache/conf.d/ yoursite.conf > > >  WSGIScriptAlias / /path/to/your/djangoproject/wsgi_h

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Martin Pajuste
curl -d "name=Bob" -G http://localhost:8000/demo/test -- 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...@go

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Martin Pajuste
-d flag sends the specified data in a POST request to the HTTP server, since you don't supply CSRF token, Django assumes the post is malicious. See more http://docs.djangoproject.com/en/dev/ref/contrib/csrf/?from=olddocs -- You received this message because you are subscribed to the Google Group

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Jirka Vejrazka
> However, when I tried this: > >    $ curl -d "name=Bob" http://localhost:8000/demo/test curl -d sends data using POST method, not GET method (see curl documentation). Django expects CSRF token in all POST requests, check http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ HTH Jirk

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Oh, i've manage to run: SELECT id from table GROUP BY tablefield HAVING (COUNT(tablefield) > 1) using ORM, but that's not what i want. The results vary. If you're interested: z = Comment.objects.all() z.query.group_by = ['message'] z = z.annotate(num_messages=Count('message')).filter(num_messag

Re: len(qs.all()) != qs.count()

2011-01-19 Thread Martin Pajuste
I would say the problem is in your model. Notice in the beginning of the SQL there is "productdescriptions"."id" yet there is no such field in database. Just specify primary_key=Trueon one of your fields

it is user accounts

2011-01-19 Thread vidhya shree
Django comes with a user authentication system. It handles user accounts, groups, permissions and cookie-based user sessions. This document explains how things work. http://123maza.com/75/daily119/ -- You received this message because you are subscribed to the Google Groups "Django users" grou

"CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread scabbage
I'm new to Django. I have installed the latest Django and completed the four-page tutorial. I created a very simple view as below: from django.http import HttpResponse def test(request): return HttpResponse('My name is ' + request.GET['name']) I'm able to navigate to "http:

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Oh, no, that wouldn't work with CharField. Or, maybe I'm doing something wrong. About a queryset - I mistaken aggregate() for annotate(). On 19 янв, 14:52, "[CPR]-AL.exe" wrote: > Wait, wat... o.O I'l try that now, thx. > > > > > > > > > > On Wed, Jan 19, 2011 at 2:50 PM, Tom Evans wrote: >

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Wait, wat... o.O I'l try that now, thx. On Wed, Jan 19, 2011 at 2:50 PM, Tom Evans wrote: > On Wed, Jan 19, 2011 at 11:26 AM, [CPR]-AL.exe > wrote: > > Hmm, yeah, but that still iterates over the objects and filters out > > them by count on the application server, not on the database one :(

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread Tom Evans
On Wed, Jan 19, 2011 at 11:26 AM, [CPR]-AL.exe wrote: > Hmm, yeah, but that still iterates over the objects and filters out > them by count on the application server, not on the database one :( > > I'm bypassing it already in my running project, but I try to avoid > using raw sql as longer as it i

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
But that, again, includes executing raw sql =) And a lot of side- queries, btw. On 19 янв, 14:33, "Cal Leeming [Simplicity Media Ltd]" wrote: > Here's something you could do. > > Execute the raw SQL to bring back just the id's, then whilst iterating over > that, if you need to grab the ORM'd row,

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread Cal Leeming [Simplicity Media Ltd]
Here's something you could do. Execute the raw SQL to bring back just the id's, then whilst iterating over that, if you need to grab the ORM'd row, just do "row_orm = model.get(id=iterated_id_here)" This is what I tend to do for raw sql queries. On Wed, Jan 19, 2011 at 11:26 AM, [CPR]-AL.exe wr

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Hmm, yeah, but that still iterates over the objects and filters out them by count on the application server, not on the database one :( I'm bypassing it already in my running project, but I try to avoid using raw sql as longer as it is possible. So, the question, actually remains open. It should

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread Cal Leeming [Simplicity Media Ltd]
Yeah you should be able to use annotate, something like: from django.db.models import Count res = Book.objects.values('tablefield').annotate(Count('tablefield')).order_by('tablefield') res2 = filter(lambda x: x.tablefield__count > 1, res) The above is probably not going to work first time, but it

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Umm... Don't know, actually. That seems, that it would be okay, too. Is there a way to execute this one using ORM? On Wed, Jan 19, 2011 at 2:04 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > May I ask why you didn't just use: > > SELECT id from table GROUP

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread Cal Leeming [Simplicity Media Ltd]
May I ask why you didn't just use: SELECT id from table GROUP BY tablefield HAVING (COUNT(tablefield) > 1) On Wed, Jan 19, 2011 at 11:02 AM, [CPR]-AL.exe wrote: > Hi there. > > I'm trying to do something like this: > > SELECT * > FROM table > WHERE tablefield IN ( > SELECT tablefield > FROM t

Re: Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
To make it more clear: I have something like a forum and want to find duplicate messages (meaing the message field should be identical) to create a report for the moderator. On 19 янв, 14:02, "[CPR]-AL.exe" wrote: > Hi there. > > I'm trying to do something like this: > > SELECT * > FROM table > W

Is there a way to find objects with duplicate values for some field using ORM?

2011-01-19 Thread [CPR]-AL.exe
Hi there. I'm trying to do something like this: SELECT * FROM table WHERE tablefield IN ( SELECT tablefield FROM table GROUP BY tablefield HAVING (COUNT(tablefield ) > 1) ) Tried it in many ways, but didn't suceed. Is there a way to do it with Django ORM without having to iterate over object

slight model change makes app unusable

2011-01-19 Thread Santiago Caracol
Hello, I have got a model MobilePhone that has a producer, such as "alcatel", a canonical name, such as "b-500 s" and a paraphrase type, such as "a-341 i". Each instance of MobilePhone is supposed to calculate all its variants (such as alcatel b-500 s, alcatel b 500 s, alcatel b-500- s, b-500 s,

Re: Pinax: worth installing?

2011-01-19 Thread Oscar Carballal
O Mar, 18-01-2011 ás 21:37 -0800, Gath escribiu: > Magee, > > Wow! Now thats what we call a response. > > You made me understand this subject more. > > Thanks a lot Magee. > > Gath. > > On Jan 18, 5:32 pm, Russell Keith-Magee > wrote: > > On Tue, Jan 18, 2011 at 9:43 PM, Cal Leeming [Simplici

Re: adding fields into another apps forms (in plugin style)

2011-01-19 Thread Marc Aymerich
On Wed, Jan 19, 2011 at 3:00 AM, Michael Buckley wrote: > I have been looking at the docs, but so far I can't find anything to help. > I am looking to set up some kind of plugin system, so for example I set up > my base user registration form, then I might have another app that when > added to INS

Re: Django API efficient enough for filtering tens of millions of records?

2011-01-19 Thread Thomas Weholt
Bulk inserts are the way the go if you can. When inserting a bunch of data, avoid using the django orm. Do it in plain SQL. The overhead of creating django orm model instances is way too expensive. Alltough it may not be bulk insert the sense Nick mentioned above I wrote DSE [ http://pypi.python.or