Re: Context and Variable.resolve

2009-01-22 Thread Andrew Ingram
Hm, I thought that's what I had tried, obviously I was doing something slightly wrong. Oh well, it works now. Thanks for your help :) bruno desthuilliers wrote: > As often with Python, the simplest thing to do is to fire a Python > shell and explore the problem: > > from django import

Problem with django-tagging and with_all/with_any

2009-01-22 Thread Andrew Ingram
un this: Banner.tag_objects.with_all(('listing','joe')) It returns the banner, when by my understanding it shouldn't. It's returning the same result as: Banner.tag_objects.with_any(('listing','joe'

Re: I don't even know where to begin writing this template-tags

2009-01-22 Thread Andrew Ingram
That works great, thanks! bruno desthuilliers wrote: > http://www.djangosnippets.org/snippets/1293/ > This may help: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
5 and I'm using the very latest revision of trunk. PIL is installed and working. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
Thanks for your response Karen, I've tried the workaround in the ticket and I get this error: Exception Type: AttributeError Exception Value: 'InMemoryUploadedFile' object has no attribute 'width' I have a vague recollection that this was actually working before I did the lat

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
I've just tried saving the model using the approach followed in Django's unit test and the database gets populated correctly, this reinforces the likelihood of it being an admin-related issue. Regards, Andrew Ingram, Karen Tracey wrote: > http://code.djangoproject.com/ticket/

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
I reverted Django to revision 9756 (just after aggregation was merged in) and everyone works fine, so evidently a commit made in the last few days has caused this issue. Regards, Andrew Ingram On Jan 23, 6:40 pm, Andrew Ingram wrote: > I've just tried saving the model using the

Re: ImageField, width_field, height_field not working

2009-01-23 Thread Andrew Ingram
mmit. > > Regards, > Malcolm > I've narrowed it down to revision 9766: "Fixed #10044: You can now assign directly to file fields (`instance.filefield = somefile`)." http://code.djangoproject.com/ticket/10044 It's late now, but I'll update the ticket tommorro

reverse foreignkey "add" method using multiple INSERTs

2009-01-27 Thread Andrew Ingram
ather than just using a single INSERT with all the objects. I'm no expert on whether this is optimal or not, I just want to be sure that this behaviour is deliberate rather than an oversight. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this mes

Setup_environ before or after forking?

2009-01-27 Thread Andrew Fong
it matters, I'm currently running MySQL 5.0.5 as the DB. Thanks! -- Andrew --~--~-~--~~~---~--~~ 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@googlegroup

Re: Debugging infinite loops

2009-01-27 Thread Andrew Fong
Check out http://docs.python.org/library/logging.html for logging. There's also some Django logging middleware floating around that might be useful -- just Google for it. On Jan 27, 11:45 am, defone wrote: > Hi, > > I'm seeing occasionally bug that is causing an infinite loop. What is > the best

Has anyone looked into writing an SSH backend for file uploads?

2009-01-29 Thread Andrew Ingram
hines to connect to which would allow you to upload to all the machines at once (but even if there's one that only allows you to upload to one machine that would still be useful). Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message becau

Re: Has anyone looked into writing an SSH backend for file uploads?

2009-01-29 Thread Andrew Ingram
On Jan 29, 1:19 pm, Christian Joergensen wrote: > What if one of the machines was unresponsive at the time of the upload? One option would be to have all the files uploaded locally, but the handler would additionally copy to the other locations. The other would just to be to have some exception

Re: Django Forms in HTML 4.01 Strict

2009-01-29 Thread Andrew Ingram
ion for why it has yet to be done (nobody has agreed on the best way to do it) Regards, Andrew Ingram --~--~-~--~~~---~--~~ 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: Someone using django trunk for production?

2009-01-31 Thread Andrew Ingram
7;re broken if used in the admin module after revision 9765. That's the only issue I'm aware of with trunk. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Error saving a Model with a custom image field

2009-02-02 Thread Andrew Ingram
dimensions for example) doesn't work and will cause an exception. I've rolled back to revision 9765 for the time being. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: problem with simple shopping cart

2009-02-02 Thread Andrew Ingram
lear why iterating over it isn't working. What I would do is have a Cart model which contains a set of Products (I tend to create a CartItem model as well for storing other info such as quantity). Normally you'd just save this to the db and store the cart id in the session. T

Re: Error saving a Model with a custom image field

2009-02-02 Thread Andrew Ingram
etc The problem I've mentioned is fairly new (last couple of weeks) so it sounds unrelated. I would try leaving a ticket on the project page for django-thumbs making sure you tell them the same stuff you've said here. Regards, Andrew Ingram --~--~-~--~~~---~

Re: Looking to give presentation on Django at work

2009-02-09 Thread Andrew Ingram
have you looked on djangosnippets.org? 2009/2/9 jeffself : > > Is there a presentation available that I can use? Would like to skip > the whole building of the presentation myself if possible. If there > isn't one, I may create an "open-source" presentation myself and make > it available for ot

Re: comparisons with java framework

2009-02-11 Thread Andrew Ingram
the time to develop a cross-platform build script for the docs is one thing but it's pretty arrogant to dismiss it outright. The Django devs are perfectly entitled to ignore Windows as far as docs go, but please don't make assumptions about the abilities and needs of your users. Re

Re: comparisons with java framework

2009-02-11 Thread Andrew Ingram
ex If this is the case then maybe all we need is better instructions on building the documentation to be added to the Django site. - Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&qu

Re: Multiple different user profile objects - Django code design help

2009-02-19 Thread Andrew Ingram
t models with user.order_account or user.newsletter_account. Regards, Andrew Ingram Gok Mop wrote: > I'm struggling with how to design something, and I'm pretty sure > somebody has an easy solution. > > I need to store different information about different classes of > user

Call for horrible (or nice) models.py files

2009-02-21 Thread Andrew Godwin
eir own unit tests. So, that's the call. Anyone up for it? Andrew --~--~-~--~~~---~--~~ 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.co

Re: Call for horrible (or nice) models.py files

2009-02-21 Thread Andrew Godwin
mple of that, I guess.) Pickling is the other option, but it's a) not editable by people - and migrations are often edited by them and b) not always available (due to the inherent security flaws it has). Hope that makes it somewhat clear... Andrew Alex Gaynor wrote: > > I'm int

Re: Call for horrible (or nice) models.py files

2009-02-21 Thread Andrew Godwin
rms of code; the current version of the new parser is less than 250 lines, and most of that is a massive dictionary of tokens, and quite a lot of whitespace. It's kind of a gain in that respect; there's not much code (far less than all the special cases would have needed), and it l

Manually parsing a URL and returning the view name and args

2009-02-27 Thread Andrew Ingram
these later and use them to return the correct URL. Is there a straightforward way to use django's url parser to take a URL and return the information I need? Presumably to turn them back into a URL I just need to use the reverse functionality somehow

Re: Manually parsing a URL and returning the view name and args

2009-02-27 Thread Andrew Ingram
That's a good point, I'll solve the problem by setting up redirects. Still it's nice to know about the resolve function. Regards, Andrew Ingram 2009/2/27 Ned Batchelder : > > I'm curious why you think view names and arguments will remain unchanged > in the f

ManyToMany reverse query

2009-03-12 Thread Andrew Turner
bjects.filter(friend=user) where user is the 'Dave' user object, but they are giving spurious results. Can anyone help me out? Regards, Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: ManyToMany reverse query

2009-03-12 Thread Andrew Turner
2009/3/12 Malcolm Tredinnick : > Aah... sorry. Too quick on the draw, there. :-) > > This does what you're after: > >        User.objects.filter(userprofile__friends=user) > > UserProfile.objects.filter(friends=user) is correct if you want the > respective UserProfile objects back, but it sounds l

Re: Django critter helps us code at the speed of light.

2009-03-12 Thread Andrew McCloud
My first time using illustrator. My original goal was to make a nice wallpaper but couldn't get illustrator to behave. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Django critter helps us code at the speed of light.

2009-03-12 Thread Andrew McCloud
http://bit.ly/djangocritter --~--~-~--~~~---~--~~ 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 djan

Re: ManyToMany reverse query

2009-03-12 Thread Andrew Turner
In case this isn't very clear due to my poor explanation, say I have three users: Bob, Jane and Dave. Now, Jane calls Dave a friend Bob calls Jane a friend Bob calls Dave a friend Asking who Bob calls a friend will obviously return Jane and Dave. But if I ask who is a fan of Dave, I want to ret

Re: ManyToMany reverse query

2009-03-12 Thread Andrew Turner
r) > > Regards, > Malcolm Thanks for the reply. User.objects.filter(friend__user=user) seems to be returning the people who 'user' calls a friend, not those who calls 'user' a friend...? Hope that makes more sense than it sounds. Basically, I

Username Blacklist

2009-03-17 Thread Andrew Turner
'blog', it will conflict with other urls. What is the best way to prevent certain usernames being registered in order to avoid any conflict with other urls? Is there some sort of built in 'blacklist'? Regards, Andrew --~--~-~--~~~---~--~~ You recei

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
ns listed before the profile ones, but I'd like to prevent someone registering one of these names, as it would then be impossible for them to view their profile. What's the best way to 'actively validate' them given that I am using django-registration? Andrew --~--~-~-

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 Alex Gaynor : > django-registration's views take a custom formclass, just subclsas the > default form and add a clean_username function to do the validation as > usuall.  If you want to get really clever about how you do it you could > import the Django resolver, test if "/%s/" % usernam

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
Just for the record, I have created the following class (subclassing RegistrationFormUniqueEmail):- class RegistrationFormNonBlacklisted(RegistrationFormUniqueEmail): def clean_username(self): if self.cleaned_data['username'] in settings.BLACKLISTED_USERNAMES: raise forms.

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 P M : > why don't you use > ABSOLUTE_URL_OVERRIDES = { >    'auth.user': lambda o: "/user/%s/" % o.username, > } > > so username will not collide with application name !!! > Greetings. > Puneet Because I wanted the user's home page to be of the form http://mydomain.com/username !! --~-

Re: Username Blacklist

2009-03-17 Thread Andrew Turner
2009/3/17 Dougal Matthews : > or just have the other pages above the users in the url conf and register > the other usernames yourself so nobody else can and they wont be viewable > anyway. > Dougal Yep, that's what I was doing originally, but I like the complicated way

RelatedObject Cache

2009-03-17 Thread Andrew Fong
whether the related object has already been cached? Been looking through the source code, but I can't find where related_objects are stored. Thanks in advance to anyone who can help! -- Andrew --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: RelatedObject Cache

2009-03-17 Thread Andrew Fong
And there it is! Thanks Alex! On Mar 17, 2:18 pm, Alex Gaynor wrote: > On Tue, Mar 17, 2009 at 5:08 PM, Andrew Fong wrote: > > > Hello all, > > > Quick question. Given these models ... > > > class A(models.Model): pass > > > class B(models.Mod

Re: Access logs?

2009-03-18 Thread Andrew Ingram
Django doeesn't do any request logging, it should be handled by your web server's own logging (usually apache). There's nothing special about Django that would cause it to be treated any differently. - Andrew Theme Park Photo, LLC wrote: > Is there an existing Django applica

Escaping forward slashes in URLs

2009-06-25 Thread Andrew Fong
Question: When is it necessary to escape a forward slash? I'm dealing with these two situations in my templates -- assume the next context variable is a URL of some sort. http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

Re: MemoryError on bigs list of items

2009-06-25 Thread Andrew Fong
would do anything to cause a MemoryError. It should actually help, since if you're restarting the process after just 1 request, any memory leaks won't have time to build up. -- Andrew On Jun 25, 1:15 pm, Frédéric Hébert wrote: > Hi there, > >  I'm facing with a curious prob

Using a dynamically created ImageField filename prior to save?

2009-06-30 Thread Andrew Turner
my view to force it to use the correct name, but this feels a bit messy to me. What's the best way to get the correct value for the slug field prior to saving it to the database, given that the filename is 'randomly' generated? Cheers, Andrew --~--~-~--~~--

Re: Using a dynamically created ImageField filename prior to save?

2009-07-01 Thread Andrew Turner
2009/6/30 Andrew Turner : > Hi, > > This is an issue which, I believe, is related to Ticket #10788 > (http://code.djangoproject.com/ticket/10788). > > The following code snippet used to work with Django 1.0.2, but with > the latest svn version the slug is not being set to th

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
re the super(Photo, self).save() line. Would it be possible to define the hashed filename in the save method, and then pass it to the upload_to argument of the ImageField? Thank you for your reply, Andrew --~--~-~--~~~---~--~~ You received this message because you

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/2 Andrew Turner : > Would it be possible to define the hashed filename in the save method, > and then pass it to the upload_to argument of the ImageField? In answer to my own question, this seems to work:- def get_path(instance, name): return instance._my_filename class

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
2009/7/2 Andrew Turner : > 2009/7/2 Andrew Turner : >> Would it be possible to define the hashed filename in the save method, >> and then pass it to the upload_to argument of the ImageField? > > In answer to my own question, this seems to work:- > > def get_path(

Re: Using a dynamically created ImageField filename prior to save?

2009-07-02 Thread Andrew Turner
On Jul 2, 12:29 pm, Andrew Turner wrote: > Talking to myself again, I've changed the save method slightly:- > >     def save(self): >         if not self.slug: >             name = hashlib.sha1(str(random.random())).hexdigest()[:16] >             self._my_file

Best way to handle HEAD method

2009-07-02 Thread Andrew Fong
eturn the response I would for a GET and then modify it somehow? Thanks in advance! -- Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djan

Re: Tracking a bad import

2009-07-02 Thread Andrew Fong
tively, use pdb (http://docs.python.org/library/pdb.html) -- Andrew On Jul 2, 12:00 am, goodwinb wrote: > Fixed it by reinstalling all of my packages. > > On Jul 1, 8:48 pm, goodwinb wrote: > > > > > I am setting up a server and when I run manage.py syncdb I get the > >

Re: FileField/ImageField and the sites framework

2009-07-02 Thread Andrew Fong
Need more data here. This ventures from strictly Django into deployment setups. Why exactly can't you just use a common MEDIA_ROOT? Are your sites on different boxes? -- Andrew On Jul 2, 2:19 pm, smcoll wrote: > i have a project running multiple sites.   One of the apps in the > pr

Re: Using a dynamically created ImageField filename prior to save?

2009-07-06 Thread Andrew Turner
2009/7/5 Mirat Can Bayrak : > I have another question. You are naming images as hash of random number. > There is a small chance to produce same name i think. It is not good way to > give name ha? The slug field has a unique=True argument, so if the same file name does happen to be produced, it

Re: Best way to handle HEAD method

2009-07-06 Thread Andrew Fong
. Any idea where to start looking? -- Andrew On Jul 2, 7:16 pm, Graham Dumpleton wrote: > On Jul 3, 4:55 am, Andrew Fong wrote: > > > > > > > How exactly should I handle a HEAD request in Django? > > > So ... assuming my view looks like this... > > > de

SQLite and Null Character

2009-07-06 Thread Andrew Fong
7;abc' I've tried using both the sqlite3 library included with Python and the pysqlite2, but I still get this error. I'm not sure whether this error is specific to SQLite3, the python-interface, or Django. This all seems to work fine in MySQL however. -- Andrew --~--~-~--~

Re: SQLite and Null Character

2009-07-06 Thread Andrew Fong
e a binary blob literal. At any rate, this looks like an SQLite (or possibly a Python-SQLite adapter) question, not a Django one. Thanks for the help though. -- Andrew On Jul 6, 12:54 pm, Alex Gaynor wrote: > On Mon, Jul 6, 2009 at 11:52 AM, Andrew Fong wrote: > > > I'm using

Re: Best way to handle HEAD method

2009-07-07 Thread Andrew Fong
allback(request, *callback_args, **callback_kwargs) File "/home/andrew/djprj/helpers/request_handler.py", line 77, in __call__ raise NoMethodError(request.method) NoMethodError: The HEAD method is not allowed for this path The relevant code in helpers/request_handler.py is

Re: changing apache mod python

2009-07-07 Thread Andrew Fong
ge is installed. To correct this, run the command: sudo dpkg-reconfigure python-foo for each python-foo package providing an affected module. """ -- Andrew On Jul 7, 7:43 am, Miguel wrote: > Thank you Aaron. I will try to follow your pieces of advices. Fortunately it > is

Re: changing apache mod python

2009-07-07 Thread Andrew Fong
kages dir (or symlinked into), then you'll just manually have to move it to some other directory in your Python path (e.g. /usr/lib/python2.6/dist-packages). Make sure to remove all the old pyc files in there though! -- Andrew On Jul 7, 9:10 am, Andrew Fong wrote: > Don't know if you

Re: Dynamic App Creation

2009-07-07 Thread Andrew Fong
SimpleDB might work too. -- Andrew On Jul 7, 8:37 am, Darren Mansell wrote: > Hello. I'm looking into making a Django app that allows you to create Django > models. > > The idea is that you should be able to add fields and user workflows using a > web page that then creates

Re: Generic views problem

2009-07-07 Thread Andrew Fong
Do you have any Poll objects in the database? If not, add some using the admin interface. Assuming you do however, can we see your index view function? The one from step 3 of the tutorial under "Write views that actually do something". -- Andrew On Jul 7, 6:39 am, "Owen Jeremiah

Re: using domain name as parameter..

2009-07-07 Thread Andrew Fong
request.get_host() On Jul 7, 9:42 am, Mirat Can Bayrak wrote: > i am building a site that like  blogger.com i mean i have to use subdomains > as parameters :\ Is there any docs about django about doing this? or any > ideas? thank you very much. > > -- > Mirat Can Bayrak --~--~-~--~---

Re: Django charset problem

2009-07-17 Thread Andrew Fong
Try fetching the data via Django's shell. What do you get then? Also, how did you configure MySQL to work with UTF-8? Did you modify your my.cnf file so UTF-8 is the default? Or did you change your database's settings manually? Or something else? -- Andrew On Jul 17, 5:33 pm, La

Flushing the cache during testing

2009-07-17 Thread Andrew Fong
cache but after poking around in Django's caching code, I haven't seen any explicit support for flushing. Does anyone have any ideas? -- andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django u

Re: Get Top 10 Books by Rating and User

2009-07-20 Thread Andrew Fong
) book = models.ForeignKey(Book) Try this: from django.db.models import Sum Book.objects.filter(rating__user__is_staff=True).annotate(score=Sum ('rating__score')).order_by('-score')[0:10] -- Andrew On Jul 20, 9:22 am, The Danny Bos wrote: > Hey there, > > I'm

Re: Get Top 10 Books by Rating and User

2009-07-20 Thread Andrew Fong
The relevant documentation btw: http://docs.djangoproject.com/en/dev/topics/db/aggregation/ http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships On Jul 20, 10:18 am, Andrew Fong wrote: > Assuming your models are like this: > > class Book(mod

Re: Get Top 10 Books by Rating and User

2009-07-20 Thread Andrew Fong
;t be more helpful here. -- Andrew On Jul 20, 10:30 am, The Danny Bos wrote: > I'm not able to use anything over Django 1.0.2. > Does SUM work for this version, I'm getting the error: > > Could not import #.views. Error was: cannot import name Sum > > Is there another w

Re: Django charset problem

2009-07-20 Thread Andrew Fong
e client, but if you have no need for any other encoding, you should probably just edit the my.cnf and have it use utf8 as the default for everything. Relevant code here: http://andrewfong.wordpress.com/2009/06/07/utf8-unicode-in-mysql/ -- Andrew On Jul 20, 10:25 am, Larry wrote: > HI Andr

Re: Django charset problem

2009-07-20 Thread Andrew Fong
Well, you already set the character set correctly on the database, so thing should just work now. If it's not, you probably just need to restart MySQL. Lemme know if you're still having trouble. -- Andrew On Jul 20, 6:58 pm, Larry wrote: > Hi Andrew, > > Thank you very much.

Re: How I run background processes

2009-07-21 Thread Andrew Fong
stead of just one. Am I correct in saying that's what you're concerned about? If so, a simple solution would be to just wrap that part of the code in a transaction. This will ensure Machine B doesn't get a response back from the database until Machine A finishes updating it. Aside f

Re: Django site on Apache

2009-07-21 Thread Andrew Fong
ogies if you already read this, but I recommend starting here. http://www.djangobook.com/en/2.0/chapter02/ And then reading the chapter on deployment here: http://www.djangobook.com/en/2.0/chapter12/ -- Andrew On Jul 21, 9:19 am, Kannan wrote: > >Only you can help yourself, and

Re: TransactionMiddleware not working

2009-07-21 Thread Andrew Fong
Just double checking, but are you using a DB that supports transactions? On Jul 21, 8:16 am, Parag Shah wrote: > Hello, > > Hello, > > I am using TransactionMiddleware to get per request transactions working in > my Django project. However, it does not seem to be working. > > I have a view in wh

Prefetch user profiles

2009-07-27 Thread Andrew Fong
select_related does not seem to follow the OneToOneField back to the User though. It appears to be a one-way relationship. Does anyone have any ideas on how to make this happen short of directly modifying the User model in contrib.auth? -- Andrew --~--~-~--~~~---~--~---

Unsubscribe

2009-08-29 Thread Andrew Holt
Hi, Sorry the the FAQ, but how do I unsubscribe from this group ? I have sent mail, as per the instructions, I have gone to google groups and django is not listed, and still I am getting mail. Thanks, Andrew = Andrew Holt Email: andrew.h...@4asolutions.co.uk De

Re: download file

2009-09-02 Thread Andrew McGregor
> Hello can you tell me where i can find example how to download file > with django CURL? http://pycurl.sourceforge.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Parsing / Deserializing a JSON String

2009-09-02 Thread Andrew McGregor
s?  Is there > another method I should be using? I am obviously a bit of a newbie at > this so any help would be greatly appreciated. Are you manually deserialising the data? http://pypi.python.org/pypi/simplejson/ -- Andrew McGregor 07940 22 33 11 --~--~-~--~~~--

Re: Is valid {% ifequal model.name "Mymodelname" %}??

2009-09-02 Thread Andrew McGregor
lp me? As part of your select could you tag the name as a hard coded column name and then check for it as a regular field? SELECT 'Mymodelname' AS `name`, other, fields, * FROM Mymodelname WHERE ... Not sure how you do it as a QueryS

Re: Parsing / Deserializing a JSON String

2009-09-02 Thread Andrew McGregor
On Wed, Sep 2, 2009 at 6:47 PM, Eric wrote: > > Im using the Django deserialization method shown here: > > http://docs.djangoproject.com/en/dev/topics/serialization/ > ok, try pasting your json (the original, not your re-typed version) here: http://www.jsonlint.com/ -- Andrew

Re: djangol_tables

2009-09-03 Thread Andrew McGregor
a 3rd party module? If so, have you installed it? If you have, have you added it to sys.path so Django knows where to find it? -- Andrew McGregor 07940 22 33 11 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: Same application with different URLs

2009-09-04 Thread Andrew McGregor
Different apache processes could be out of sync and running different django configs, thus giving different outcomes. -- Andrew McGregor 07940 22 33 11 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django us

proper place to put startup code

2009-09-10 Thread Andrew Gwozdziewycz
ch does all the initialization setup. Thoughts, ideas? Thanks, Andrew -- http://www.apgwoz.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

Re: Proper way of importing projects modules

2009-09-10 Thread Andrew Gwozdziewycz
This whole discussion is pretty much what virtualenv solves http://pypi.python.org/pypi/virtualenv Basically, for each package that you wanna reuse, install it into the virtualenv for the project your working on. It works great. On Sep 10, 2:00 pm, Brian Jones wrote: > Well, it's not a solution

Re: Is Auth really dependent on Sites?

2009-09-10 Thread Andrew Gwozdziewycz
On Sep 10, 3:05 pm, Joshua Russo wrote: > I wanted to remove the Sites app because it's not needed at the moment, but > when I ran the unit tests for the project the Auth unit tests use Sites > functionality. If I'm using Auth should I leave sites? I really just wanted > to clean up the Admin ind

Error creating test database

2009-04-02 Thread Andrew G.
I have a django app that is built against an existing database. In the database, there are a couple tables used as the many-to-many relation lookup table. However, I have mapped models to the many-to- many lookup table, since I have a need for accessing these entries directly. Since the tables

Re: Error creating test database

2009-04-02 Thread Andrew G.
g table intact. This will duplicate data > though - are these highly accessed tables? > > I think. > > -Adam > > On Apr 2, 9:23 am, "Andrew G." wrote: > > > I have a django app that is built against an existing database.  In > > the database, there are a cou

Re: Error creating test database

2009-04-03 Thread Andrew G.
arams) pysqlite2.dbapi2.OperationalError: table "part_positions" already exists The django project I am working with is mapped to an existing database, so this only causes a problem when tests are run, since the test system creates its temporary database. On Apr 2, 7:42 pm, Russell Keith

Re: Error creating test database

2009-04-06 Thread Andrew G.
wrote: > On Fri, Apr 3, 2009 at 4:25 PM, Andrew G. wrote: > > > The following code in a fresh project/app will cause the database > > creation to fail. > > > class Position(models.Model): > >    description = models.CharField(max_length=20, blank=

Re: Error creating test database

2009-04-06 Thread Andrew G.
Specifying "through" instead of "db_table" did not raise any errors, but it caused the relevant field in the admin change form to disappear! On Apr 3, 4:52 pm, Karen Tracey wrote: > On Fri, Apr 3, 2009 at 4:25 PM, Andrew G. wrote: > > > The following code in a

Cannot get admin to order rows properly

2009-04-06 Thread Andrew Grossman
I am trying to specify multiple columns for Django to order row in the admin change list by, but it seems to only be interested in ordering by the first column. Am I doing something wrong here? --~--~-~--~~~---~--~~ You received this message because you are subs

Re: Cannot get admin to order rows properly

2009-04-06 Thread Andrew Grossman
models.py: -- from django.db import models class Position(models.Model): order_first = models.IntegerField(db_index=True) order_second = models.IntegerField() description = models.CharField(max_len

Re: Cannot get admin to order rows properly

2009-04-06 Thread Andrew Grossman
admin.py: -- from django.contrib import admin from models import * class PositionAdmin(admin.ModelAdmin): list_display = ('description', 'order_first', 'order_second') ordering = ('order_first'

Re: Cannot get admin to order rows properly

2009-04-06 Thread Andrew Grossman
Result: http://i659.photobucket.com/albums/uu319/tsqd/djangoorder.png (google groups seems to have issues with these links) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: Cannot get admin to order rows properly

2009-04-06 Thread Andrew Grossman
http://i659.photobucket.com/albums/uu319/tsqd/ djangoorder.png"/> --~--~-~--~~~---~--~~ 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

Re: Cannot get admin to order rows properly

2009-04-06 Thread Andrew Grossman
Thank you. On Apr 6, 1:27 pm, Karen Tracey wrote: > On Mon, Apr 6, 2009 at 11:13 AM, Andrew Grossman wrote: > > > > > I am trying to specify multiple columns for Django to order row in the > > admin change list by, but it seems to only be interested in ordering > &

Selecting date formats for aggregate calculations from database with Django

2009-04-09 Thread Andrew C
I would like to do aggregate calculations based on month for a datetime field. I am currently using the extra() function to format the date like: ...extra(select="strftime('column', '%m/%Y') as t").values ('t').annotate(SUM(foo)) and it works great for sqlite3. In sqlite3 I can use strftime(),

Re: Clean URL Design: List Views and Details Views

2009-04-16 Thread Andrew Ingram
ifferent view functions. You end up with some limitations but you keep fairly short and logical URLs. Regards, Andrew Ingram 2009/4/16 Marcin Mierzejewski : > > Hi Aidas, > >> 7. Using the controlling words before the type of list: >>     /by-popularity/products/ >&

Re: Search and urls

2009-04-21 Thread Andrew Ingram
rch/ part. The site we are building uses search as a filter, so any listing page can have ?q=foo added to perform a search within the list. As an added bonus, by using a query parameter it makes it possible to track search usage in Google Analytics without hacking around. Regards, Andrew Ingram --

[Querysets] Trying to determine status of an order based on the properties of its order items

2009-04-23 Thread Andrew Ingram
this should only be running on small sets of items and orders because it'll be getting the orders for individual orders rather than for everyone, but an efficient solution is still preferred. Any ideas would be appreciated Regards, Andrew Ingram --~--~-~--~~~---~--

Re: FileField error

2009-04-27 Thread Andrew Smith
It depends if you are running under the dev server or not. If you are then yes, you need to add that path to your urls to serve as static files. I fyou are running under apache then you should be letting apache handle serving static files. Have a look at the documentation on apache deployment to se

<    1   2   3   4   5   6   7   8   9   10   >