__unicode__() method not working in models.py

2008-10-30 Thread Andrew
I am currently working through the django book and I've got to the fifth chapter where I would like to replace the __str__() methods with __unicode__() methods instead. The reason is that my database will hold a great deal of Japanese text, UTF-8 encoded. After declaring the UTF-8 encoding at the

__unicode__() method not working in models.py

2008-10-30 Thread Andrew
I am currently working through the django book and I've got to the fifth chapter where I would like to replace the __str__() methods with __unicode__() methods instead. The reason is that my database will hold a great deal of Japanese text, UTF-8 encoded. After declaring the UTF-8 encoding at the

Re: __unicode__() method not working in models.py

2008-10-30 Thread Andrew
> > Are you declaring the encoding of your source file? > > Try putting > > # -*- coding: UTF-8 -*- > > at the top of your file. > > regards >  Steve Hi Steve, thanks for the reply. Exceptions are raised if you input Japanese characters into a file and fail to declare the coding. That was the fir

Re: __unicode__() method not working in models.py

2008-10-30 Thread Andrew
> I do not know if this will work for Japanese Windows, but for the English > version, the two things I have found that need to be done to ensure a > command prompt properly displays utf-8 > are first: > > chcp 65001 > > in the command prompt to change the active code page to the one that works >

mogileFS for django

2008-09-04 Thread Andrew
Just released a how-to and some code on our blog: http://blog.fluther.com/blog/2008/09/04/mogilefs-for-django/ Praise can be sent directly to me, scathing criticism of the code can be directed to my partner. See you at djangoCon! --~--~-~--~~~---~--~~ You receiv

How do I get image data from my newform into my model?

2008-10-09 Thread Andrew
I'm upgrading to 1.0 from .97. Previously I had retrieved the cleaned data from my form, and called mymodel.save_FIELD_file() with the cleaned data, but that doesn't work anymore in 1.0. Without resorting to a modelform (since I need to do custom validation, like specific filetype, size and files

data clean issue [pls help to check]

2009-02-27 Thread andrew
Hi, all , CODE: view.py - def user_login(request): if request.method == 'POST': form = UserLoginForm(request.POST)# get the form from POST if form.cleaned_name(): #

Re: data clean issue [pls help to check]

2009-02-27 Thread andrew
Hi, Roseman Thank you very much for the explaination, problem solved! Applause & Cheers! On Feb 27, 10:10 pm, Daniel Roseman wrote: > On Feb 27, 12:37 pm, andrew wrote: > > > > > Hi, all , >

Dynamic Form?[Newbie]

2009-03-05 Thread andrew
Hi , Dear all: I had searched this forum but with limit information about dynamic forms . Model: - class Product(models.Model): name = models.CharField(max_length=30) # Product Name type = models.IntegerField(max_length=3

Re: Dynamic Form?[Newbie]

2009-03-05 Thread andrew
What do you want to buy? Product A [radio button] Product B [radio button] Product E [radio button] Could you guys pls kindly help? I am Newbie :( On Mar 5, 5:29 pm, Malcolm Tredinnick wrote: > On Thu, 2009-03-05 at 00:13 -0800, andrew wrote: > > Hi , Dear all: > > >     I

Re: Dynamic Form?[Newbie]

2009-03-05 Thread andrew
amic > forms. Those forms where generated from data entered by the user in a > previous step. > > It can be a bit "messy" if you don't take care, but works. > > andrew wrote: > > Hi , Dear all: > > >     I had searched this

[Newbie] how to output value like this?

2009-03-20 Thread andrew
Hi ,all I encounter a issue lasting 3 days, any help will be highly appreciate. view: market_volumn={} for m in marketTypeList: market_volumn[m]=MarketVolumn.objects.filter (marketType=m).order_by('week') print market_volumn in the console ,the print result like this:

Re: how to output value like this?

2009-03-21 Thread andrew
Thanks you for your detailed solution. I just didn't know the existence of market_volumn.ITEMS so I didn't know how to output the "volumn", shame on me of poor python knowledge . Anyway ,problem solved! applauds! On Mar 21, 5:22 pm, Malcolm Tredinnick wrote: > On Fri, 2009-03-20 at 23:53 -0700,

How redirect lightweight webserver messages?

2009-07-17 Thread Andrew
Hi, I run Django light web server with command line "python manage.py runserver". I must redirect to another stream web server output messages, the ones like "[17/Jul/2009 12:35:58] "GET /home/foo/ HTTP/1.1" 200 1061

Weird character shifting in mod_python

2009-07-30 Thread Andrew
We get these incredibly bizarre errors every once and a while where a single character of python gets transformed. The code itself isn't changing, and the area where it pops up changes each time. Any ideas? MOD_PYTHON ERROR ProcessId: 28165 Interpreter:'' ServerName: '*' Do

[Newbie]List Mapping in Template?

2009-04-26 Thread andrew
We know that power MTV of Django. Here is my question. I have 3 list of "Thing", fruit,bread,wine, but they share a same structure of template,I want to render them to on template like this: view: fruitList = thing.objects.filter(type='1') breadList = thing.objects.filter(type='2') wineList =

How can I add a page into Admin Site?

2009-05-08 Thread andrew
Hi, guys all: Django powered by a fancy admin backend with secured control. In my app, there needs to be an other backend which responsible for more complex functions(views) .To do this on my own ,I had to create auth,view,url etc. Is there a way that I could CREAET A NEW Template NOT OVE

Security with a solo Administrator?

2009-05-11 Thread andrew
Hi,all I'm designing a series of admin pages that only one admin can logon ,I think there is no need to setup a single table to store only one entry which contain "name""password" . So , I think ,is this way safe enough to ensure secure my admin access? def login_admin(request): i

Re: i have a question about model

2009-05-23 Thread andrew
I recommand used "print [modal]" in the views and see what happend in the terminal. PS: you'd better try replace : def __str__(self): return self.SampleID with: def __unicode__(self): return self.SampleID On May 22, 11:55 pm, Herta wrote: > hi, everyo

Django and release mode

2009-05-29 Thread Andrew
Hi, I want to launch web server process in release mode. But executing from shell "python -O manage.py runserver" doesn't affect web server process, that is launched in debug mode. Also setting settings.DEBUG = True doesn't affect launch mode, but this was expected. Any sugg

Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Andrew
Hello, is there any way to use custom template tag inside {if} or ifequal tag? I have custom tag "getpreference" which accepts one parameter and returns string value or empty "" string. I want to check if value is not empty inside {if} or maybe {ifequal} tag, how do I do that? {% if getpreferen

Re: Is it possible to use custom template tag inside another tag?

2009-10-03 Thread Andrew
Anyway, I thound that's not possible, so I will need to create specific custom tag for this. On Oct 3, 2:07 pm, Andrew wrote: > Hello, > > is there any way to use custom template tag inside {if} or ifequal > tag? > > I have custom tag "getpreference" which ac

need help with saving/updating model record via admin interface

2009-10-28 Thread Andrew
tion') Product.price = getattr(self, 'price') if getattr(self, 'image'): Product.image = images.resize(getattr(self, 'image'), settings.THW2, settings.THT2) #strange, why does it update record without calling save() ??? #super(Product, self).s

Django 1.1.1 - Can't get form validation working

2009-11-02 Thread Andrew
have tried everyting initially thinking it was my Ubuntu dev environment but I ran it on debian etch with django version 1.0.3 and got the same thing. Any help greatly appreciated. Thanks Andrew Here is the scenario I am doing a simple registration form... I have a form... as you can see I have &quo

Re: Django 1.1.1 - Can't get form validation working

2009-11-02 Thread Andrew
.html_error_list }} {% endif %} Password (again): On Nov 2, 12:55 pm, Andrew wrote: > Hi, > I am well used to working with Django, however I am stuck on a basic > issue at present if anyone can spread some light. Note I have no > compile errors and

Re: Django 1.1.1 - Can't get form validation working

2009-11-02 Thread Andrew
Thanks Guys, I understand about the form issues...I was just tinkering... However yes it was the comma's I had at the end of the fields in my form. They didn't throw errors for the face its a sequence as you said Karen. Thanks Karen and David for such a quick response... Andrew On Nov

Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Andrew
piler ? Thanks Andrew ( desperate to get my ...eeek...days back ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Andrew
Thanks guys for all the commentsIm on ubuntu on eclipse and there was no local history alas Thems the breaks when you omit to submit ;-) ... to source control... I used UnPyc to disassemble the .pyc and I am now rewriting the python using the assembly as a guide. Good think I did mainfram

Output data across models in XML

2010-05-19 Thread Andrew
cing 'store' with 'store.name' and 'store__name' to no avail -- how can I get the XML serializer to return a data member of the 'store' object instead of just a pointer to that object? If it's not possible with serializer, what's the best way to do it? Tha

Re: Trouble installing satchmo

2010-03-22 Thread Andrew
Go to: http://groups.google.com/group/satchmo-users On 15 мар, 20:10, Jonathan Hayward wrote: > I'm trying to get satchmo up and running from the instructions > athttp://bitbucket.org/chris1610/satchmo/downloads/Satchmo.pdf, and when I > get to 2.1.3 (installing PIL manually as a workaround), th

Announcing the birth of Fluther.com

2007-06-27 Thread Andrew
ime discussion, questions filtered for you, and IM integration. Now that we have finally completed it we're climbing out from our cave and wondering if the site can fly, and how we help attract people to it. Any comments or advice? Andrew McClain --~--~-~--~~~---~--

Re: Announcing the birth of Fluther.com

2007-06-28 Thread Andrew
Thanks for the compliments, Leif! We're running a LAMP VPS (currently with ServerAxis). We use memcache (right now our traffic doesn't warrant mutliple servers or squid). We use the built-in django default user paired with a custom userprofile as detailed in the b-list article. Thanks for lookin

Re: Announcing the birth of Fluther.com

2007-06-29 Thread Andrew
milar). Does that answer your questions? Should we make the privacy policy more explicit? Best, Andrew On Jun 29, 4:42 pm, "David M. Besonen" <[EMAIL PROTECTED]> wrote: > the interface looks good and appears to function well. > > On Wed, June 27, 2007 4:03 pm, Andrew w

Re: django app for managing sending email to users...

2007-08-10 Thread Andrew
erent thread because initiating a connection to the SMTP server from a web request takes a LONG time -- it looks like the page hangs. Again, happy to help. Andrew McClain On Aug 8, 10:38 am, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > Hi, > > On 8/8/07, James Tauber <[EMA

Re: SESSION_SAVE_EVERY_REQUEST creates new session?

2008-01-06 Thread Andrew
We're looking into this as well! 10K session rows in one day. Have you noticed the records being in multiples of seven? Also, in our slow query log we've noticed django performing a selection on the entire session table with no WHERE clause. Clues in the puzzle... On Jan 4, 11:51 pm, SmileyChri

Dev server hangs based on Site settings?

2008-01-10 Thread Andrew
I'm seeing some very strange behavior on my development box... If I have the current site (the one returned by Site.get_current_site()) set to the same address as my development server, the server will hang. The server with run, but stalls when I try to make a request -- it doesn't even print out

How do _you_ handle versioning your CSS/JS files?

2008-01-16 Thread Andrew
There are a bunch of articles about versioning your CSS/JS so you can set an infinite expires header; most of them revolve around some PHP code that takes either an SVN revision or unix timecode and munges the include header, like: So. I'm not thrilled about throwing some PHP into the mix; sur

Re: best practices for a production site

2008-01-20 Thread Andrew
This also may be a good time to consider a distributed version control system (Like bazaar or mercurial)... we're just about to finish porting to bazaar after running up to several situations just like yours. One benefit of DVCS is that branching is easier than SVN...making feature-level branches

What's the best way to simulate a request?

2008-07-07 Thread Andrew
Here's the situation: I'm creating an RESTful internal API as an app in our project. Our 'main' app (we'll call it main) is a client of the API app. Since we're building the API piece by piece as we use it, the emphasis on all of this is simple simple simple -- with our eye on eventually opening

SVN revision for 0.96?

2007-05-29 Thread Andrew
Anyone know? We were working off the django SVN 0.96pre, but we've made some patches and would rather just do an SVN update to 0.96. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: SVN revision for 0.96?

2007-05-29 Thread Andrew
2007. andrew On May 29, 1:01 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote: > Is the question "What's the URL for the 0.96 release?" > > browse:http://code.djangoproject.com/browser/django/tags/releases/0.96 > > checkout: > svn cohttp://code.djangoproje

Should file uploads work in 0.96 admin?

2007-05-31 Thread Andrew
ad_to path, correct? many 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@googlegroups.com To unsubscribe from this group

Re: Should file uploads work in 0.96 admin?

2007-06-02 Thread Andrew
ImageField(upload_to="/static/images/") caused django to write files to /static/images (ignoring MEDIA_ROOT, silly me) ImageField(upload_to="images/") works. On Jun 1, 3:20 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Am Freitag, 1. Juni 2007 01:35 schrieb Andrew: >

apache memory requirement ballparks?

2007-06-04 Thread Andrew
rk. Relatedly, what is everyone using to load test their ajax apps? We've been using JMeter to limited success... any other thoughts are appreciated. Annecdotes, links to articles, or informed guesses are all appreciated. We're not trying to get an answer, just data to make

Re: apache memory requirement ballparks?

2007-06-04 Thread Andrew
27;d stock if full of RAM, but we're evaluating VPS right now, so we're just trying to see what's feasible. On Jun 4, 3:03 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 6/4/07, Andrew <[EMAIL PROTECTED]> wrote: > > > What are some ballpark memory

{% spaceless %} doesn't work?

2007-10-14 Thread Andrew
According to http://www.djangoproject.com/documentation/templates/#spaceless, {% spaceless %} should remove _all_ whitespace between tags, not insert a single space between them... So why does http://dpaste.com/22430/ turn into http://dpaste.com/22431/ ? --~--~-~--~~~---

Re: do you use pydev for django development?

2007-10-14 Thread Andrew
So much of models are generated on the fly, I usually count it as luck if I get any code completion at all. I don't think any other IDE will help you here. On Oct 14, 8:03 am, lmierzej <[EMAIL PROTECTED]> wrote: > hi, > I need advise... > i've started using pydev for django development > but it h

Re: {% spaceless %} doesn't work?

2007-10-14 Thread Andrew
Ah! Perfect! Good ol' .96! On Oct 14, 1:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-10-14 at 19:38 +, Andrew wrote: > > According tohttp://www.djangoproject.com/documentation/templates/#spaceless, > > {% spaceless %} should remove _all_ wh

Is it possible to create a related model from within another save() method?

2007-12-15 Thread Andrew
I've implemented a generic "change" model for some of my models. Ideally what I'd like is to be able to either mark or subclass a model, and when changes are made to a specific field, a copy is saved in the related "change" object stack -- such that when the post_save signal is sent out from my ba

Re: Is it possible to create a related model from within another save() method?

2007-12-15 Thread Andrew
That's a good thought, but unfortunately that's not the way multiple inheritance works... only the first method in the chain gets called. On Dec 15, 6:54 am, Michael Elsdörfer <[EMAIL PROTECTED]> wrote: > > class Description(ChangeImplementor, models.Model): > > I might have a flaw in my logic,

How do you serialize a newform.errors dictionary?

2007-12-19 Thread Andrew
This is code that was working until sometime circa rev 6500... Assuming we have a newform object named form with errors in it: import django.utils.simplejson as json json.dumps(form.errors) gives: : is not JSON serializable In the shell, and fails silently in view code. If we do: json.dumps

Re: How do you serialize a newform.errors dictionary?

2007-12-19 Thread Andrew
EDIT: json.dumps(force_unicode(form.errors)) works but triggers the dictionary-to-html conversion. On Dec 19, 3:41 pm, Andrew <[EMAIL PROTECTED]> wrote: > This is code that was working until sometime circa rev 6500... > > Assuming we have a newform object named form wi

Re: Serious Question... Web2.0

2006-09-30 Thread Andrew
We're using Django + AJAX + Mochikit. Works like a charm. a --~--~-~--~~~---~--~~ 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 fr

Re: Dojo vs Mochikit for Django dev?

2006-10-18 Thread Andrew
We use mochikit exclusively after playing with Dojo (it slowed our page loads way down for some reason). Mochikit doesn't give you components like Dojo does, nor does it give you any of the object-oriented scope tools that Dojo has, but the documentation is top notch. Mochikit also gives you bette

How to find all objects in a model that don't have a many2one relationship defined?

2006-10-28 Thread Andrew
I've had this working in raw SQL, but I'm refactoring and trying to django-ify things a little bit. I thought it would be simple, but I'm stuck. I have a Post model and a Rating model. The Rating model has a one-to-many relationship with Post, a one-to-many relationship with User, and a score. (

Re: How to find all objects in a model that don't have a many2one relationship defined?

2006-10-28 Thread Andrew
Sorry, that was a mistype in the original post. Should read: Post.objects.exclude(rating__user = user) mostly works, but it *also* excludes all Posts that have not been rated by *any* users yet (don't have rows in the Rating table). So I need a way to word the exclusion in a way that works, or

How do I import a module in a subdirectory of an app?

2006-06-24 Thread Andrew
Say I have a file structure like this: mysite myapp __init__.py models.py views.py testdir foo.py import mysite.myapp.testdir.foo doesn't work. Why? Is testdir not in my pythonpath? Am I missing something? Thanks in advance. --~--~-~

Graphviz Model Diagrams

2006-07-17 Thread Andrew
I started a simple little app to display a Graphviz diagram based off the Django models. It's simple and not so purty, but it's a start. It also requires graphviz to be installed and in the path. http://www.exit66.com/diagram.zip Install to to your Django server like any other app and the url

Re: get many from multiple levels of one-to-many relations

2006-07-18 Thread Andrew
Here's how I did it for a similar situation I had. class MyCategory(models.Model): category = models.CharField(maxlength=50) parent_category = models.ForeignKey('self', blank=True, null=True, related_name='sub_categories') def all_items(self): data = list(self.ite

Updating Related Objects

2006-08-17 Thread Andrew
Sorry if there is an obvious answer to this, but I couldn't find it. Based off of the following: class ObjectA(models.model): name = models.CharField(length=20) class ObjectB(models.model): name = models.CharField(length=20) a = models.ForeignKey(ObjectA, related_name="bs") In the

Re: Updating Related Objects

2006-08-17 Thread Andrew
Not sure what I was smoking but accessing the object from the all() method doesn't work either. Is it possible to change an object through the ForeignKey? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: Updating Related Objects

2006-08-17 Thread Andrew
I ended up saving the object, but I was trying to update the tree of objects without saving so I could offer a preview type of functionality (there are some background calculations done on the objects). --~--~-~--~~~---~--~~ You received this message because you a

{% include %} tag: documentation?

2006-08-17 Thread Andrew
Is there any more in-depth documentation about how the include tag works? I'm developing a site which has a few different modules that I want to plug into an aggregate "main" page. Each of the modules I've written into its own template; I now want to combine them into the main page. My first th

Addingg to admin nice selector for editing ForeignKey fields in case of relatively large number of items (adopted from SelectFilter2.js)

2006-09-01 Thread Andrew
Hi, I adopted nice SelectFilter2.js for single item selecting with search in change forms in case of relatively large lists. Here is my changes against current sources (0.96-pre). It's seems work for me. # add file SelectFilter3.js to ..\admin\media\js (adaptation of SelectFilter2.js) ---

RegexURLResolver initiation question

2013-05-16 Thread andrew
nse was executed 6. the RegexURLResolver initiation question is observed by Eclipse debugger Thanks, Andrew -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email

RegexURLResolver initiation question

2013-05-16 Thread andrew
/', urlconf)" in WSGIHandler.get_response was executed 6. the described question will be observed in Eclipse debugger Thanks, Andrew -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Question about imports..Python Dejango and Models

2011-08-06 Thread Andrew
, Andrew On Aug 6, 11:38 am, Hayyan Rafiq wrote: > are  you referring to the models.py which is present in every app created by > python manage.py startapp books ?? > > # Create your models here. > from django.db import models > > class Publisher(models.Model): >     name = mod

Re: Template tag: how to output success message above input field

2011-08-14 Thread Andrew
. You could process the post and redirect back to the page containing the form if you want to. Regards, Andrew On Aug 14, 5:52 pm, doniyor wrote: > Hey Guys, > > i need a litle help in working with forms. i have a button and i want > to output a success text above the button if the

Re: Am I missing a design pattern? My views code somehow isn't as elegant as it should be...

2016-10-23 Thread Andrew
in > the service layer. > > Extending a little bit and talking about pythonic code, > `IPInfo.get_result()` should not exist. Simply use the `result` > attribute or convert it to a read only property. Or, if this class > came to life just because the `get_result()` method, convert it to a &g

Shouldn't there be a library already for how to render your JS Frontend code into HTML and then insert your Django templates with jinja2 very easily?

2020-06-18 Thread Andrew
ewear? If this hasn't been done, someone should make it happen... If enough attention comes by for a better idea, I'd love to help collaborate! My GitHub page: https://github.com/Andrew-Chen-Wang -- You received this message because you are subscribed to the Google Groups "Django user

database API from external tools?

2008-10-24 Thread Andrew Chapman
Hi everyone, Very much a Django newbie here, I'm trying to evaluate a few things before diving right in. I was all set to write something in Ruby Rails, but the reason for looking at Django is because I also need python access to all the same data that the web app is dealing with. The Django

Re: database API from external tools?

2008-10-26 Thread Andrew Chapman
Russell Keith-Magee wrote: > On Sat, Oct 25, 2008 at 3:55 AM, Andrew Chapman <[EMAIL PROTECTED]> wrote: > >> My question is how to package up and deploy the Django python code for >> external tools to access the database? I'm hoping to have the Django app >>

Re: database API from external tools?

2008-10-27 Thread Andrew Chapman
James Bennett wrote: On Sun, Oct 26, 2008 at 9:19 PM, Steve Holden <[EMAIL PROTECTED]> wrote: Here's a specific example of a piece of code that uses a web app's models. It should get you started - just dive in and write some code! The tricky bit is providing the settings without u

Error was: 'module' object has no attribute 'Form'

2008-11-30 Thread Andrew Arrow
Trying to get the example from http://docs.djangoproject.com/en/dev/topics/forms/ to work. I copied and pasted: from django import forms class ContactForm(forms.Form): subject = forms.CharField(max_length=100) message = forms.CharField() sender = forms.EmailField() cc_myself =

Development server crash with no error message

2008-12-08 Thread Andrew Fong
last request I made before it crashed, but without any exceptions or errors, it's very hard to debug. Does anyone have any tips on getting some more useful output out of a crash? -- Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Problem with django tagging: how to add tags??

2008-12-09 Thread Andrew Davison
> I am using django tagging and have problems adding tags to an object. > > There are 2 methods that enable adding a tag: > - add_tag() > - update_tags() > > -- > for tag in parse_inputs(form.cleaned_data['tags']): > Tag.objects.add_tag(tag) >

Re: Development server crash with no error message

2008-12-10 Thread Andrew Fong
I'm using MySQLdb, cmemcache, PIL, and the django.contrib.gis stuff. On Dec 8, 2:58 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Dec 9, 8:50 am, Andrew Fong <[EMAIL PROTECTED]> wrote: > > > When I'm poking around in my Django app, my development ser

Query using actual table values

2008-12-19 Thread Andrew Fong
I'm looking for the Django equivalent of the following: SELECT * FROM table WHERE table.x1 = table.x2 Pretty sure someone has asked this before but I had a hard time finding anything. I don't really want to write raw SQL if it can be avoided. --~--~-~--~~~---~--~-

Re: Templates Cant find the CSS file

2009-01-12 Thread Andrew Trotter
that page, as I have no idea whether you're in a dev or prod environment. Cheers, Andrew 2009/1/12 pyramid...@gmail.com > > Im trying to get the template to load the CSS, but it does not load, > the server output shows a 404. > > in templates directory i have > >

Re: Is Django development active?

2008-07-20 Thread Andrew Ingram
James Bennett wrote: > On Sun, Jul 20, 2008 at 6:57 AM, Hussein B <[EMAIL PROTECTED]> wrote: > >> I got that illusion due the slow official releases cycle... >> > > Be careful with this logic, because it is misleading. For example: > Britain has not had a new Prime Minister since June 2007

Re: Problems With The Tutorial

2008-08-28 Thread Andrew Kou
If you've created a project using django-admin.py, when you run 'python manage.py runserver', make sure you're actually in the directory where manage.py script is. . - Andrew Kou On Aug 27, 3:42 pm, Sonny <[EMAIL PROTECTED]> wrote: > When I type ' python manage.

Python literal to equivalent model with efficient updates

2008-09-08 Thread Andrew Ingram
and I want to define the foreign key models inline rather than referencing the primary key. Any insight would be greatly appreciated. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: ANN: Updated Django Cheat Sheet

2008-09-10 Thread Andrew Durdin
ere in an earlier draft, but there just wasn't room. They're not too hard to remember, though, hopefully? Off the top of my head: counter, counter0, revcounter, revcounter0, parentloop, first, last. You could write them all on a single post-it note and stick them to y

Re: using save() on FormWizard

2008-09-17 Thread Andrew Ingram
In the done() method you are provided with a list of the validated forms so you can just do: for form in form_list: form.save() before returning your response 2008/9/17 Martin <[EMAIL PROTECTED]>: > > Greetings, > > i'm playing with FormWizard and i'm having some problem saving each > step

Re: ANN: Updated Django Cheat Sheet

2008-09-22 Thread Andrew Durdin
On Sep 21, 8:23 am, "Nikos Delibaltadakis" <[EMAIL PROTECTED]> wrote: > Shouldn't ForeignKeyField to be just ForeignKey? > Am I missing something? No, you're absolutely correct -- thanks for spotting the error! We'll get a correct

Re: ANN: Updated Django Cheat Sheet

2008-09-22 Thread Andrew Durdin
out). Grab it from http://www.mercurytide.co.uk/whitepapers/django-cheat-sheet/ 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@google

GeoDjango / GIS Garbage Collection Error

2008-09-23 Thread Andrew Fong
oesn't seem to be breaking anything in the app, but it is really annoying. -- Andrew P.S. This seems to be the same problem as here, except with GeoDjango instead of wxPython: http://mail.python.org/pipermail/python-list/2003-March/192239.html --~--~-~--~~~---~--

Re: ANN: Updated Django Cheat Sheet

2008-10-07 Thread Andrew Durdin
Issue 4 is out with a correction to the arguments for DecimalField in the Form Fields section. Thanks to Doug Van Horn for pointing out the error. Download it from http://www.mercurytide.co.uk/whitepapers/django-cheat-sheet/ Andrew --~--~-~--~~~---~--~~ You

pre_delete, post_delete signals for contrib.contenttypes

2008-10-07 Thread Andrew Fong
when you delete B. However, model A itself is still removed from the database. Any opinions about adding such a deletion signal for A? -- Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&

Re: Using Javascript

2008-10-08 Thread Andrew Ingram
use a django-served template for your JS file. 2008/10/8 Johnny <[EMAIL PROTECTED]>: > Hi everyone, > > I'm writting a Web App using Django and I got problems to make appear or > deasappear some content. > > Here is the code I was using to write a part of the windows: > > >

Reorder a queryset/list with respect to another list

2008-10-08 Thread Andrew Ingram
of objects with respect to the list of Ids. I know Django templates have reorder functionality, but that just sorts by a property, what I'm looking for is a bit more complex. Is there anything at the Python level I should be using? Thanks, - Andrew Ingram --~--~-~--~~---

Re: Reorder a queryset/list with respect to another list

2008-10-09 Thread Andrew Ingram
Malcolm Tredinnick wrote > Here's one way that comes to mind: When you do the selection based on > the id's, use the in_bulk() queryset method. That returns you a > dictionary mapping each id value to the object with that id (see below > for how to do this without in_bulk() if that's not convenien

Re: Created Form - now code works to edit object but add gets NoneType' object is not callable

2009-01-15 Thread Andrew Mckay
On 15-Jan-09, at 9:35 AM, Peter Bailey wrote: > Anyway, I have created a Form for a Survey object that I use. If I go > to my edit page for a Survey, everything works perfectly. If I go to > do a simple add new (like right out of the docs), I always receive an > error "NoneType' object is not cal

Re: How to obtain an intermediate ManyToMany object?

2009-01-15 Thread Andrew Mckay
On 15-Jan-09, at 8:49 AM, JonUK wrote: > how do iterate the LightboxPhotograph objects for a given instance of > LightBox? lightbox.lightboxes should work http://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward Cheers -- Andy McKay ClearWind Consulting:

Re: How to obtain an intermediate ManyToMany object?

2009-01-15 Thread Andrew Mckay
On 15-Jan-09, at 10:09 AM, JonUK wrote: > Thanks, but that gives me: > > AttributeError: "'Lightbox' object has no attribute 'lightboxes'" Doh' sorry, reading it again, you've already got the relationship from LightboxPhotograph to Lightbox, so thats lightbox.lightboxphotograph_set http://do

Q about cache backend for sessions and clustering

2009-01-18 Thread Andrew Ingram
for the first request won't be returned until the session data has been written successfully - which means there are no sync issues. Is the same true of the memcached-based backend? i.e is the response delayed until there is some confirmation that the cache has been written to? Regards, A

Composite Indexing

2009-01-19 Thread Andrew Fong
I'm using contrib.contenttypes and have added the following to my model: content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey() When examining the DB (I'm using MySQL), I find that content_type is indexed but object_id

Enhanced versions of simple_tag?

2009-01-20 Thread Andrew Ingram
rders(user_id,number): return Order.objects.filter(user_id=user_id).limit(number) like this: {% latest_orders request.user.id 5 as orders %} Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

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

2009-01-20 Thread Andrew Ingram
there's a nice elegant way of doing this in Django because the only approach I can think of is very unappealing. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Context and Variable.resolve

2009-01-21 Thread Andrew Ingram
7;).resolve(context), but I'm not so sure about how to tackle the strings and numbers. I guess some regexps could be used to do some basic branching. Any thoughts would be appreciated. Regards, Andrew Ingram --~--~-~--~~~---~--~~ You received this message be

  1   2   3   4   5   6   7   8   9   10   >