Combining filters on related models

2009-07-09 Thread Ian Clelland
I'm trying to construct a query which combines two filters on a related model, and I'm having no luck. Hopefully somebody can see what I'm doing wrong, and point me in the right direction. I'd like to be able to specify two exclude criteria on a related model, and have both criteria apply to the

Re: Reading data from database tied to another Django project?

2009-07-10 Thread Ian Clelland
On Jul 10, 12:37 pm, Ben Kreeger wrote: > How do I go about accessing that data from P2's database? Do I need to > create a model in P1 and bind it to a certain table in P2's database? > If that's the case, how do I specify access credentials for that > database? Is that in settings.py? If the t

Re: Nested views and urls patterns declaration order

2009-07-13 Thread Ian Clelland
On Jul 13, 8:48 am, Frédéric Hébert wrote: > When I declare the outter view after the inner in urls.py she's never > been called. It's the inner that's got it. > (She's called when I reverse the order of declaration, eg the outter > first) > >  I've pasted the code at dpaste :http://dpaste.com/

Re: SelectMultiple with Static Choices in admin Interface

2009-07-13 Thread Ian Clelland
On Jul 13, 10:03 am, itodd wrote: > Greetings, > > I'm trying to use a SelectMultiple with a set of static choices. I'm > experiencing odd behavior when the number of choices exceeds 10. For > example, take the following Model and ModelForm: > > class Project(models.Model): >     RECIPIENTS = (

Re: Reading data from database tied to another Django project?

2009-07-15 Thread Ian Clelland
On Jul 14, 8:23 am, Benjamin Kreeger wrote: > I was using PostgreSQL at first, but then I found information about > reading data across databases only with MySQL, so I'm using MySQL for > the time being. > > Now, I don't have a database set for P1 yet because it's just > displaying reStructured

Re: running into wall doing templates part of tutorial

2007-04-07 Thread Ian Clelland
further than the line above it? That would certainly cause a python syntax error. Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: trailing slash added to passed form data

2007-04-13 Thread Ian Clelland
t least one space between the value and the "/" character. Something like this: would be valid XHTML. If you don't care at all about XML conformance, you could also just get rid of the "/" and have which is valid HTML, but not XHTML. Regards, Ian Clelland <[EMAIL P

Re: TEMPLATE_CONTEXT_PROCESSORS

2006-07-24 Thread Ian Clelland
ur own views, then you may be using plain Context objects, and your context processors won't be executed at all. -- Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &qu

Re: use data model and database api along

2006-07-29 Thread Ian Clelland
isting database (not that I've actually tried this). Basically, you can use the admin tool to create the models.py file from an existing database, rather than doing it the other way around. Check out the documentation at http://www.djangoproject.com/documentation/legacy_databases/ for a star

Re: Scandinavian characters in .po files and timezones

2006-07-30 Thread Ian Clelland
e in vim, when you are using it interactively. It is not required in a .vimrc file. -- Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Django source editing offtopic

2006-08-01 Thread Ian Clelland
On 8/1/06, toth anna <[EMAIL PROTECTED]> wrote: > What are you using for editing sources? If you're a native vim speaker, I have a version compiled for OSX, using the native Aqua interface, off of my homepage here: http://ian.casa.cavewallarts.com/vim.html Ian Clelland <

Re: translating app-name

2006-08-03 Thread Ian Clelland
y use for models and fields? Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ 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

Re: accessing was_published_today in a template

2006-08-03 Thread Ian Clelland
{% else %} Not today's poll {% endif %} On a list page, you are probably already iterating over the "object_list" variable -- you should be able to access the was_published_today method in a similar manner, for each element of that set. Ian Clelland <[EMAIL PROTECTED]> --

Re: Creating 2 linked models from one page

2006-08-03 Thread Ian Clelland
an instance of A -- although you could certainly make it do that. Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: Directory structure & common functions

2006-08-15 Thread Ian Clelland
import app1.views. Error was: No module > named utils.strings If you want to be able to import files like this, you will need a file in the utils directory called __init__.py. You can leave the file empty, but it has to be there for python to recognise the directory as a package. Reg

Re: Question and a problem about FileField

2006-08-15 Thread Ian Clelland
ith a patch to address this problem ( http://code.djangoproject.com/ticket/2534 ). If this patch is applied to the django source, then your models will work as you expect them to. -- Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received th

Re: upload error | deleting object after it has been uploaded...

2006-08-15 Thread Ian Clelland
at Apache is running under (www-data on my Debian systems, for example). Double-check the directory ownerships and permissions, and see if you can get it to work with a FileField in a simple model. Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~

Re: Custom file handling

2006-08-15 Thread Ian Clelland
ally, our PhotoField class also supports thumbnail generation, although we generate them dynamically, rather than saving them at upload time. Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Re: how to redirect to a new page,but keep the browser's url unchanged

2006-08-16 Thread Ian Clelland
re probably better off leaving them in a media directory, and letting Apache handle them, and just live with the URL bar showing the real location. Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: showing future events only?

2006-08-16 Thread Ian Clelland
its fields, and the exact structure of your urls.py file. -- Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Custom db fields / creation.py

2006-08-17 Thread Ian Clelland
oid having to tinker with the backend source, is to override the get_internal_type method of my custom fields. By default, it returns the name of the class it is called from, but you can override that to return the string "ImageField" and the database table will be created correctly.

Re: notification when an object is deleted

2006-08-17 Thread Ian Clelland
d when the user is deleted, you could alter the ticket table in your database. Just make sure that the user_id column explicitly says "on delete cascade", and the database will take care of deleting tickets automatically. Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~

Re: How to create my own Field Types ?

2006-08-17 Thread Ian Clelland
the value is stored in the database. (Override the get_internal_type method to return "IntegerField" at the very least) Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: check for yourself (((;

2006-08-17 Thread Ian Clelland
Getting more off-topic by the minute, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ 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@googlegr

Re: notification when an object is deleted

2006-08-19 Thread Ian Clelland
nt, like assign the tickets to another user, you will have to write a custom view (and possibly a custom manipulator) to do this. In that case, you would not want to delete users using the built-in admin interface at all, but use your custom view instead. Regards, Ian Clelland <[EMAIL PROTECTED]

Re: Image validation works only once

2006-08-23 Thread Ian Clelland
t the code involved, I'm not sure why you'd be getting an error, but you should be okay if you leave the validation out. ImageFields automatically have isValidImage added to their validator list when the upload form is processed, so you don't need to specify it expli

Re: i18n: Translating default model values

2006-08-25 Thread Ian Clelland
ll have to do it all in python, rather than sql, but you'll at least have the full power of django's orm :) Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Accessing a model from its fields

2006-04-02 Thread Ian Clelland
l from the field that I'm just missing? Or is this this really the easiest way to do this? Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&quo

Re: Admin in mr

2006-04-02 Thread Ian Clelland
t; line if there's nothing else in the class. That should be enough to get model into the admin screens. Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Admin in mr

2006-04-03 Thread Ian Clelland
the admin index uses the verbose_name_plural attribute, rather than verbose_name. Bryan's right, you don't generally have to specify verbose_name, if it's the same as your class name, but until version 2593, you had to specify verbose_name_plural. Update your local copy of m-r, and it should w

Re: ImageField upload_to

2006-04-04 Thread Ian Clelland
last week for both ways of doing this: http://groups.google.com/group/django-users/browse_thread/thread/93c024f1523f5323/6bea5b407797e597 Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: querying for an empty set in m-r?

2006-04-15 Thread Ian Clelland
in Python 2.4: >>> g = (x**2 for x in range(10)) >>> g >>> g.next() 0 >>> g.next() 1 >>> g.next() 4 Check out http://www.python.org/dev/peps/pep-0289/ (Generator Expressions) -- Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~--

Re: collapse fields in admin [magic-removal]

2006-04-15 Thread Ian Clelland
that and it should work. Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ 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.

Re: template problem

2006-04-16 Thread Ian Clelland
you have constructed yourself would be to have a template loader which searched some sort of dictionary of previously-build template objects, but I don't think that's available in django right now. I'd love to be proven wrong, however. That would come

Re: OpenID?

2006-04-16 Thread Ian Clelland
ld save other implementers some time. Well, this thread likely won't stay active on the mailing list for very long; you should look at creating a node on the Django cookbook (at http://code.djangoproject.com/wiki/CookBook) with some sample code. Reg

Re: Custom Manipulator

2006-04-18 Thread Ian Clelland
r is just to pass. The save method has to take the fields from the new_data dictionary, assign them to fields in the original object, and call original.save(). Alternately, I think you could subclass yourmodel.ChangeManipulator, and override the methods in there that you need to change, but I'v

Re: Custom Manipulator

2006-04-19 Thread Ian Clelland
ect_key) original = manipulator.original if request.POST: # code here exactly like for AddManipulator else: errors = {} new_data = original.__dict__ # generate and present form just like AddManipulator Regards, Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~--

Re: django 1.1: nonexistent URLs display 500.html instead of 404.html

2012-02-21 Thread Ian Clelland
ubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: django 1.1: nonexistent URLs display 500.html instead of 404.html

2012-02-22 Thread Ian Clelland
to upgrade. Django 1.3 is almost a year old, and is still the current version -- if you can wait a couple of weeks, you'll see 1.4 released as well. > With the commas missing, all requests to nonexistent URLs returned a > 500 error. > > > On Feb 22, 12:31 am, Ian Clelland wrote:

Re: internationalization makemessage don't work

2012-02-26 Thread Ian Clelland
t; To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com 'django-users%2bunsubscr...@googlegroups.com');>. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Regards, Ian Clelland -- You received this

Re: Using query set in views.py

2012-02-26 Thread Ian Clelland
t; > -- > 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 'django-users@googlegroups.com');> > . > To unsubscribe from this group, se

Re: internationalization makemessage don't work

2012-02-27 Thread Ian Clelland
our INSTALLED_APPS setting contain the apps that should be translated? -- Regards, Ian Clelland -- 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

Re: Questions about UnicodeDecodeError

2012-04-03 Thread Ian Clelland
On Monday, April 2, 2012, Ali Mesdaq wrote: > I did have UTF-8 in the db before but then when I was inserting(done by a > script) values in I would get errors. I really want to avoid doing > conversions before I insert the data so I can maintain the data in the > exact format as it was seen in.

Re: HttpResponse_is_string is removed Django 1.4

2012-04-06 Thread Ian Clelland
jangoproject.com/ticket/16494, and you can see the changes that were made for 1.4 here: https://code.djangoproject.com/changeset/16829) -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: HELP with unicode!!!!!

2012-05-01 Thread Ian Clelland
come back here with some code that you've tried and hopefully we can find a solution Ian > i tried decoding the value as > > val.decode('utf-8') > > ...this helped to reduce a few encodings but gets stuck for > the encoding "\xa0" > Please HELP! >

Re: What is Django's behavior when a request is interrupted?

2012-05-29 Thread Ian Clelland
ooglegroups.com');> > . > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com 'django-users%2bunsubscr...@googlegroups.com');>. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. >

Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-28 Thread Ian Clelland
t; No, if you have the CSRFViewMiddleware installed, then you don't need this line at all. -- Regards, Ian Clelland -- 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@googlegro

Re: model translationissue

2012-07-12 Thread Ian Clelland
tally, I'm sure): once as the first argument, and again as a named parameter. If the argument "_('name')" is supposed to be the field label, then you should pass it explicitly as that keyword art, like this: name = forms.CharField(label=_('name'), max_length=1

Re: Ignore apostrophes using django-postgresql

2012-07-20 Thread Ian Clelland
end email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Regards, Ian Clelland -- You received this m

Catch or raise exception designissue

2012-07-31 Thread Ian Clelland
should never deliberately be creating 500 errors. The only responsible thing to do when a 500 is seen in the logs is to track down the source of it and fix the bug. -- Regards, Ian Clelland > -- Regards, Ian Clelland -- You received this message because you are subscribed to the

Re: Django on legacy Postgres database with encoding WIN1252

2012-10-04 Thread Ian Clelland
this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/EXpvuuttJ64J. > 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. > For more options, v

Re: Disabling CSRF is not working.

2012-10-05 Thread Ian Clelland
send email to > > django-users@googlegroups.com > . > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com . > > For more options, visit this group at > > http://groups.google.com/group/django-users?hl=en. > > --

Re: django.db.models import Q help!

2011-10-21 Thread Ian Clelland
f another object, then just use that! Try something like fi = request.user.get_profile().financial_institution txn = Transaction.objects.extra( where=['(tpin=%s or teller_no=%s or identifier=%s) AND financial_institution_id=%s'], params=[value, str(value), value, fi.id]) --

Re: Using .filter() on a constant expression

2011-10-21 Thread Ian Clelland
)) )) | ( Q(dob_year_max=alive_y2+1) & ( Q(dob_month=1) & ( Q(dob_day=None) | Q(dob_day__lt=1) )) )) -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Database management commands

2011-10-28 Thread Ian Clelland
;, and you can see the engine used by all of your tables. -- Regards, Ian Clelland -- 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

Re: Long usernames in auth_user?

2011-10-28 Thread Ian Clelland
g, even though they are rarely encountered. 320 characters suffices for any valid email address. -- Regards, Ian Clelland -- 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@go

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Ian Clelland
# yes, it is special I believe that in some cases, the exists() query can be optimized to return faster than a count() aggregation, and I think that the intent of the code appears more clearly. Ian -- Regards, Ian Clelland -- You received this message because you are subscribed to the Goog

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Ian Clelland
On Wed, Nov 2, 2011 at 10:46 AM, Tom Evans wrote: > On Wed, Nov 2, 2011 at 5:30 PM, Ian Clelland wrote: > > On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote: > >> > >> # This is my current solution > >> if get_special_objects().filter(pk=obj.pk).c

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Ian Clelland
ated, or you might end up with 70M objects, or anywhere in between. Again: odd, undocumented, and potentially surprising behaviour, and I'd recommend explicit over implicit, especially in this case. -- Regards, Ian Clelland -- You received this message because you are subscribed

Re: How can I serve static files while requiring Django-based access permissions?

2011-11-08 Thread Ian Clelland
> > Zak > > -- > 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

Re: Forbiden 403 error

2011-11-16 Thread Ian Clelland
on out of CSRF protection, then you can do that too -- it's not baked into Django that deeply. You will need to change your settings, and remove the CSRF middleware from MIDDLEWARE_CLASSES. That will completely remove this feature from your project. (and, of course, remove all of the security benef

Re: string indices must be integers, not str

2011-11-21 Thread Ian Clelland
ttings.DEFAULT_FROM_EMAIL[settings.CONTACT_EMAIL_TO]" looks like you're trying to use a string to index into another string variable. Ian -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: django.conf.urls import question

2011-11-28 Thread Ian Clelland
ing the tutorial for the development version. (There used to be a big warning about this at the top of all every page in the development docs, but it seems to have disappeared.) Try following the tutorial starting at https://docs.djangoproject.com/en/1.3/intro/tutorial01/ instead, and see how far you

Re: Boolean test on queryset

2011-11-28 Thread Ian Clelland
u 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. > For more options, visit this group at http://groups.google.co

Re: Retrieve object model admin userid & password?

2011-11-30 Thread Ian Clelland
; Yes, yes and yes. If you have console access, you can also do this: manage.py changepassword username_goes_here That will allow you to reset anybody's password; superuser or otherwise. -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Grou

Re: unit tests and 'system' tests with history

2011-11-30 Thread Ian Clelland
run in a few minutes. > > > Thanks for any suggestions > > > -- > 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 t

Re: models.Q raising exception

2011-12-01 Thread Ian Clelland
ango_models ... GameProfile.objects.get( django_models.Q(nick=nick) | django_models.Q(user=self.user), world=self.world, ) to see if the problem goes away. If it does, it's almost definitely a redefined name. -- Regards, Ian Clelland -- You

Re: Query with no-correspondence results

2011-12-06 Thread Ian Clelland
0) from mydatabase_votecontext left join mydatabase_vote on (mydatabase_vote.context_id = mydatabase_votecontext.id) where thing='Carrot' and user='Me' There still might be a way to do it with the ORM; but you can definitely use raw sql for this. -- Regards, Ian Clelland -- You received this messa

Re: Query with no-correspondence results

2011-12-07 Thread Ian Clelland
e WHEREs (not filtering by user or thing), it still > presents without nulls (or 0.0) > Is there other way you can see? > Again, thanks > On 6 Dez, 21:48, Ian Clelland wrote: > > On Tue, Dec 6, 2011 at 1:35 PM, Reinout van Rees >wrote: > > > > > Ah! Now I get

Re: Django E-Commerce Framework

2011-12-08 Thread Ian Clelland
modular. > > -- > 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.c

Re: Django E-Commerce Framework

2011-12-08 Thread Ian Clelland
modular. > > -- > 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.c

Re: Query with no-correspondence results

2011-12-08 Thread Ian Clelland
On Thu, Dec 8, 2011 at 12:45 PM, wgis wrote: > Ian Clelland, it worked! Thanks a lot for your perseverance > > Tom's secret sauce it's not working, unfortunately =( > Just (Carrots, Flavour, 3.0) > I guess since some 'contexts' don't have an associated th

Re: Can a template extend a template?

2011-12-13 Thread Ian Clelland
html", RequestContext({"base_template": base_template...})) Template: (my_template.html) {% extends base_template %} (In a real app, I would use a base class for the view which would set the base template for every request automatically, or I would do it in a context proces

Re: Django 1.2.1 strange problem

2011-12-15 Thread Ian Clelland
transaction will be committed to the database, and if the view raises error, the transaction will be rolled back automatically. In almost every case, this behaviour will be exactly what you want. -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups &

Re: Can I escape or delimit the "{{ }}" template braces?

2011-12-19 Thread Ian Clelland
On Monday, December 19, 2011, J. Marc Edwards < marc.edwa...@nimbisservices.com> wrote: > I'd like to write a paragraph on my page that describes the {{ }} syntax, but the template interpreter is interpreting the braces. I think what you need is the {% templatetag %} tag -- it outputs template tag

Re: Django orm and no primary key

2012-01-10 Thread Ian Clelland
filter() rather than get, if you can't ever assume uniqueness - Similarly, if you have to update records, use update() rather than save(). It sounds like you want to use aggregate queries on this table anyway, so you (hopefully) shouldn't run into any issues. Oh, and don't r

Re: Please help with complex aggregation/annotation issue

2012-01-19 Thread Ian Clelland
7;], MessierMarathon.objects.filter(messier_number=x['messier_number'], nominations=x['nominations'])[0].image) for x in highest_counts) You might be better off writing raw SQL for it, though; you could probably get it all with one (convoluted) query. -- Regards, Ian Clell

Re: saving in a view

2012-01-27 Thread Ian Clelland
k that you are going to need some lines that actually update the 'this' and 'customer' object. You would do that like this: this.number = this.number + 1 or customer.reference = number Then, when you save the objects (and just use "customer.save()", the force_update=True i

Re: Django 1.6.0 over python 3: mysql?

2012-12-06 Thread Ian Clelland
port [2] [1] https://github.com/petehunt/PyMySQL [2] http://mysql-python.blogspot.ca/2012/09/a-brief-history-of-mysqldb.html -- Regards, Ian Clelland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: Using composition in Django

2011-04-16 Thread Ian Clelland
SQL like this: CREATE TABLE "employee_employee" ( "id" serial NOT NULL PRIMARY KEY, "person_id" integer NOT NULL, "address_id" integer NOT NULL ) ; which is probably closer to what you're expecting. -- Regards, Ian Clelland -- You received this

Re: Unidirectional relations

2011-04-20 Thread Ian Clelland
their parent, without the parent having a child_set attribute. I think Mike has the right idea; using a separate 1:many table to avoid explicit fields on the child model, but, of course, SQL being what it is, it is still possible to construct a query that joins the tables and reconstructs the l

Re: how to call user-defined database functions through the Django query syntax?

2011-04-20 Thread Ian Clelland
.filter(title__icontains="test").extra(where='oe_matches(structure.smiles, "[C;!H0]")') You could encapsulate the extra() call in a function call that annotates a QuerySet that you pass to it, but it's 'outside' of the ORM at that point. -- Regards, Ian Cl

Re: Debugging a unittest

2011-04-20 Thread Ian Clelland
only the one test that you specify will actually be run. -- Regards, Ian Clelland -- 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, sen

Re: compressing uploaded file

2011-04-20 Thread Ian Clelland
to them to compress it. > > When I try to do this: > > file.write(zlib.compress(file.read())) Don't do that -- I'm pretty sure that writing a file that you already have open for reading will produce undefined results. (Also, I'd try to stay away from using 'file&

Re: 500 message with POST

2011-05-02 Thread Ian Clelland
sts. I believe that Django will issue the redirect anyway, buy the user agent is *not* supposed to just blindly post the data to the new URL without some sort of user interaction. To eliminate this as a possible error source, try putting the trailing "/" on the URL in the command line: $

Re: Decimal * Float problem

2011-05-11 Thread Ian Clelland
k* into a float; you should use .quantize() instead. -- Regards, Ian Clelland -- 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 e

Re: Encrpting urls to hide PKs

2011-05-12 Thread Ian Clelland
omes back to the confirmation view. If your tokens are actually random, and large enough (say, 64 bits), then anybody trying to guess them will be wasting their time. -- Regards, Ian Clelland * By looking at the database IDs, people can gauge how heavily the system is being used, or if they s

Re: Email app is breaking long lines, any fix?

2011-05-17 Thread Ian Clelland
ailMessage, set the headers yourself, and call send() on it. (Also, 'text/us-ascii' is not a registered MIME type; you probably want to say something like 'text/plain; charset=us-ascii') [1] http://docs.djangoproject.com/en/1.3/topics/email/#the-emailmessage-class -- Rega

Re: json serialization question

2011-05-27 Thread Ian Clelland
from django.utils import simplejson as json ... records = models.Residents.objects.extra( where=[], params=[...]) data = json.dumps(records.values('fname','lname','pt')) return HttpResponse(data, mimetype='application/json') records.values

Re: SystemError from django.conf.settings

2011-05-30 Thread Ian Clelland
0.9.7.2), but I don't want to mess > around with the production environment too much, or risk breaking the > live sites. > If the error is in one of the python core modules, then it may have been fixed recently; but I haven't seen any reports of failures in tupleobject.c other th

Re: Trouble with simple aggregation

2011-06-08 Thread Ian Clelland
ticle.objects.values('category').annotate(count=models.Count('id')) ? The idea being that you group the objects by category, and then count the number of distinct ids within each category. The docs mention that the default ordering can get in the way of this sometimes,

Re: 'ValuesListQuerySet' object has no attribute 'META'

2011-06-09 Thread Ian Clelland
tring "META" doesn't even occur in the db package, so I can't imagine how simply wrapping a QuerySet in a list() call could trigger an exception like that. Can you post the rest of the code around this, or at least more of a traceback, unless that is really all that there is? And

Re: 'ValuesListQuerySet' object has no attribute 'META'

2011-06-10 Thread Ian Clelland
, and its accompanying META attribute. Check to see if that's the case, and rename your list() view if it is. -- Regards, Ian Clelland -- 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@

Re: storing django object into javascript array

2011-06-10 Thread Ian Clelland
from django.utils.simplejson import dumps ... school_list = dumps([school.name for school in city.school_set.all()]) and then add school_list to the context variables that are passed to the template. Then in the template, you can just use {{ school_list }}, and it will be a properly

Re: forms messing up css, help?

2011-06-11 Thread Ian Clelland
gt; > email = forms.EmailField() > > > message = forms.CharField() > > > name = forms.CharField() > > > > > #urls.py > > > urlpatterns = patterns('', > > > ... > > > (r'^contact-form/', views.contact)

Re: Could not decode to UTF-8 column 'cpostal'

2011-06-13 Thread Ian Clelland
ieval) 4. If you can get the right data out of the database in the python shell, then can you save it from there as well? If everything above works, then try doing this: > object_from_database.save() and see if you get the same error. If so, posting a traceback from that might help pinpoint th

Re: storing django object into javascript variable/array

2011-06-15 Thread Ian Clelland
JavaScript, so what you're going to have to do is come up with a sample of what you'd *like* to see as the template output, and hopefully we can help you with the Django template code to produce that output. [Also, it really doesn't help to be posting and reposting the same questi

Re: Unit-Testing Dilemma

2011-06-20 Thread Ian Clelland
t; 3. Break up your API calling code into more testable units to truly > > isolate your independent code from the API calling code. It'll be much > > easier to catch problems in the API integration code. > > -- > You received this message because you are subscribed to the

Re: Possible bug in form validation

2011-06-20 Thread Ian Clelland
here, but it is not used internally by the form machinery. > > However, this is looking like a legitimate bug to me. > > http://dpaste.com/hold/556603/ > > I've updated with a working example, as http://dpaste.com/hold/556805/ -- Regards, Ian Clelland -- You received this

Re: Unit-Testing Dilemma

2011-06-21 Thread Ian Clelland
e the tests without touching the > actual view logic, so testing what the API receives makes the most > sense to me. > If this is all for a refactoring, then you're probably on the right track there -- instrument the existing object for testing, rather than restructuring the view f

  1   2   >