Re: How do you rollback a transaction outside the context of a request?

2010-04-15 Thread Bill Freeman
ase interaction after the failing save, which is a get in the beginning of the function on the next time through the loop, fails with: current transaction is aborted, commands ignored until end of transaction block Perchance I also need to create a savepoint and do savepoint_rollback? Bill On Th

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-15 Thread Bill Freeman
have ascii representations. Or something is trying to use a utf-8 string under the presumption that it is ascii. Rendering to the web should probably be rendering utf-8. Are there custom template tags involved? Bill On Thu, Apr 15, 2010 at 11:54 AM, zayatzz wrote: > Hello > > I rec

Re: How do you rollback a transaction outside the context of a request?

2010-04-15 Thread Bill Freeman
mmit_on_success's wrapper will have called commit. I'm assuming that the rollback will only roll back to the most recent commit, so I won't be loosing things from previous successful iterations of the loop that calls the wrapped function. So I don't need to become involved in savep

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-15 Thread Bill Freeman
The problem is reported at line 78 of the template, which uses a tag named "result_list". That isn't one of the standard tags. Where does it come from? Can you provide the source code? Bill On Thu, Apr 15, 2010 at 1:59 PM, zayatzz wrote: > Header is like that: > >

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-15 Thread Bill Freeman
I don't find it on http://docs.djangoproject.com/en/1.1/ref/templates/builtins/ . It may be provided by one of your installed apps. What {% load ... %} tags are there in the template? On Thu, Apr 15, 2010 at 2:32 PM, Daniel Roseman wrote: > On Apr 15, 4:54 pm, zayatzz wrote: >> Hello >> >> I r

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-15 Thread Bill Freeman
m unaware of any of those needing to convert anything to ascii. Alan, can you expand the local vars in a few interesting stack frames, like the bottom several, and maybe the one in options.py further up, and send just the stack trace part again? Bill On Thu, Apr 15, 2010 at 2:54 PM, Daniel Roseman

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-15 Thread Bill Freeman
ption, you may be able to figure out why it thinks it has to convert something to ascii (which is probably the default string encoding, use sys.getdefaultencoding() to find out). Probably something is applying str() to a unicode object. I'm sorry that I can't provide a shortcut. Perhaps someo

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-16 Thread Bill Freeman
t you're doing, or a couple of hours if you need to read a bunch of documentation. [ * I've got 2.4 (for zope/plone), 2.5, 2.6, 2.7, 3.0, and 3.1 on my laptop. ] Bill On Fri, Apr 16, 2010 at 2:29 AM, zayatzz wrote: > Okay. I will try to test it in the way suggested by Bill and Ka

Re: Chase Paymentech

2010-04-20 Thread Bill Freeman
Beware! There are a number of security vulnerabilities you can have when handling credit card numbers. There is something called PCI (Payment Card Industry, if I'm not mistaken) compliance, the intent of which is to try to avoid some of the big credit card number stealing hacks that have been in

Re: Multiple instance of the same app

2010-04-20 Thread Bill Freeman
Why not add a "site" field to the model(s)? You can filter for the current site by hand, or have individual model managers for the various sites that you select at the top of the view (maybe in a decorator?). On Mon, Apr 19, 2010 at 1:49 PM, Kepioo wrote: > Hi Ben- i actually want all the climbi

Re: temp url with time limit

2010-04-23 Thread Bill Freeman
;t match, the request has been tampered with, treat it as expired. Bill On Fri, Apr 23, 2010 at 10:36 AM, Nick Serra wrote: > Just create a model that stores the url and the expiration time. If > the url is hit past the expiration time, delete it, if it's still > within the time

Re: Filtering for an object that is modified in memory loses those modifications?

2010-04-23 Thread Bill Freeman
will compose and execute an update query on the database to set the fields in the row according to the attribute values of the instance. Bill On Fri, Apr 23, 2010 at 3:15 PM, Margie Roginski wrote: > I have a situation where I have a handle to a db object and I've > modified a field in i

Re: How to use CommaSeperatedIntegerList with CheckboxSelectMultiple

2010-04-26 Thread Bill Freeman
installed somewhere intresting, like just before you form.is_valid() call and step on in. But I'm sure that other development environments interface can also use it well.) 2. Start a new thread and provide a lot more detail, including code snippets and exact validation error messages. Bill

Re: OS X install, not in home directory?

2010-04-26 Thread Bill Freeman
the install. (You can do this in a subshell and not affect other operations.) Bill On Sat, Apr 24, 2010 at 9:36 AM, pjmorse wrote: > On Apr 24, 3:03 am, Rob wrote: >> Maybe this is more of a general python question, but when I run `sudo >> python setup.py install` it insists

Re: OS X install, not in home directory?

2010-04-27 Thread Bill Freeman
list uses (or used) a Mac, and he's way smarter than me. But really, the better way to do this kind of stuff is probably virtualenv. Bill On Tue, Apr 27, 2010 at 4:38 AM, Rob wrote: > > Thanks, but none of those suggestions seem to work.  I'm not going to > worry about thi

Re: django tinymce/filebrowser issue

2010-04-28 Thread Bill Freeman
spent a long time setting breakpoints in firebug, but it was an initialization issue (the plugin stuff was hard to debug). Bill On Wed, Apr 28, 2010 at 9:01 AM, Bobby Roberts wrote: > not sure how to do that...  i'm not really getting any javascript > errors or anything. > > On Apr

Re: Saving the query object for later

2010-04-28 Thread Bill Freeman
Presumably the user entered data into a form to perform the search. I'd save the form field values, possibly slightly pre-processed. Remember to include stuff that you're pulling out of, for example, request.user. Then you can change the details of your search function, your database schema, and a

Re: django tinymce/filebrowser issue

2010-04-28 Thread Bill Freeman
here's one of these at every stack level. On Wed, Apr 28, 2010 at 10:38 AM, Bobby Roberts wrote: > hey bill i'm getting this traceback: > > > NoReverseMatch at /tinymce/filebrowser/ > > Reverse for 'filebrowser-index' with arguments '()' a

Re: background-image

2010-04-28 Thread Bill Freeman
url() must be given a url, not a file path. You need to put the image somewhere that is being served by apache, or by the development server (usually a subdirectory of 'media/' or similar) and then use the corresponding url. For example, when running the devolopment server in /home/me/djprojects/

Re: forms question in django 1.1

2010-04-28 Thread Bill Freeman
I do notice that you have 'player_option' in the fields tuple, while there is no such model field, but instead a field named 'player_options' (plural). If that's actually in the source, I'd fix it before looking any harder. On Wed, Apr 28, 2010 at 10:32 AM, knight wrote: > I have the following f

Re: background-image

2010-04-28 Thread Bill Freeman
r/2010 17:49:54] "GET /media_sito/images/sf300.jpg HTTP/1.1" 404 > 2032 > > Any sugg. > > Thanks > Luca > > On 28 Apr, 17:07, Bill Freeman wrote: >> url() must be given a url, not a file path.  You need to put the image >> somewhere that is being served

Re: Saving the query object for later

2010-04-28 Thread Bill Freeman
The request may have references to objects that will no longer exist, or may be inappropriate when rerun later. I can't promise that it won't work, but I believe that pickling the request is at best a fragile solution. To save just the required parameters won't take much code, especially if you r

Re: Saving the query object for later

2010-04-29 Thread Bill Freeman
enerate the >> Queryset that way. >> >> Peter >> >> On 4/28/10 12:28 PM, "Bill Freeman" wrote: >> >> >> >> > The request may have references to objects that will no longer >> > exist, or may be inappropriate when rerun later.

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-29 Thread Bill Freeman
to send to the pages cms folks. Bill On Thu, Apr 29, 2010 at 3:28 PM, zayatzz wrote: > Buh... took me a while to get around to do it. After first installing > the django trunk it revealed another problem first though. Not sure if > this can be the cause or not? > > The problem was d

Re: Trouble constructing raw SQL requiring multiple LIKE statements

2010-04-29 Thread Bill Freeman
I think that there's an extra "samples.description LIKE" in there (occurs twice). But, should you want to do this with the ORM, assuming that samples is a model (or could be made one, see the legacy database stuff in the docs), I think that it could be done with Q objects using description__contai

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-04-30 Thread Bill Freeman
elector, perhaps) and see if the value is bad there. If bad, the problem looks to be in the ORM. I can't tell more from the stacktrace, since the relevant variable values are objects, and the strings are inside them and not displayed in the frame varables. And, of course, I can't easily

Re: Problem with letters like ÄÖÕÜ in django adm in

2010-05-02 Thread Bill Freeman
f8') By the way, what database are you using, and how is it configured to store strings? Bill On Sat, May 1, 2010 at 3:21 PM, zayatzz wrote: > Well i put this if and following import & trace to several places, but > all i got was the 500 error and pdb prompt did not show up. >

Re: models as a package

2010-05-02 Thread Bill Freeman
Does your __init__.py import the otehr files, or does it import the models from them? If the former, then model Foo in foo.py of the models package of app bar must be referred to as bar.models.foo.Foo, whereas in the later case, as with having everything in a models.py file, bar.models.Foo will wo

Re: how to exclude objects with manytomany

2010-05-02 Thread Bill Freeman
Do you want, as your first posting says, to select players not on your team, that is, have a queryset that returns such, or do you want a single or multi-select field on a form having those players, as playing with self.field['members'] in your second post would seem to imply? You need the first i

Re: override a form field, to allow usernames with '@'

2010-05-04 Thread Bill Freeman
creation and saving, rather than calling the super-class save method). Bill On Tue, May 4, 2010 at 1:19 AM, Felippe Bueno wrote: > Btw, > > I read about django don't accept @ in usernames, but I can create a User > using > User.create_user(m...@email.com, m...@email.com, mypassword)

Re: Insert model data into every page (base.html)

2010-05-05 Thread Bill Freeman
See: http://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors On Wed, May 5, 2010 at 10:06 AM, Martin Tiršel wrote: > Hello, > > I need to insert some data from database onto every page, so I inserted them > into base.html. Until now, I was using generic views but it doesn'

Re: Django App and Memory Mgmt

2010-05-06 Thread Bill Freeman
, or have your own object structure that you know how to render for the requester. Much more coding than the dom, but you don't need the whole document in memory at once. Bill On Thu, May 6, 2010 at 3:34 PM, Ross wrote: > Reading more it sounds like the memory usage issue, particularly for

Re: Updating profiles

2010-05-11 Thread Bill Freeman
Is AUTH_PROFILE_MODULE set correctly in settings.py? On Tue, May 11, 2010 at 6:43 AM, django_jedi wrote: > OK, I'm baffled.  I must be missing something right in front of my > face... > > I'm trying to create a form that will allow users to update their > profiles.  No matter what I try, I get a

Re: Updating profiles

2010-05-11 Thread Bill Freeman
Yep. Probably should have been called AUTH_PROFILE_CLASS. On Tue, May 11, 2010 at 7:29 PM, CrabbyPete wrote: > should be > > AUTH_PROFILE_MODULE = 'app_name.Profile' > > On May 11, 10:15 am, Bill Freeman wrote: >> Is AUTH_PROFILE_MODULE set correctly in settings

Re: Shows indendation error

2010-05-13 Thread Bill Freeman
h the next multiple of ts columns. Bill On Thu, May 13, 2010 at 10:10 AM, Jirka Vejrazka wrote: > Ravi, > >  the "default" lines where you just uncommented existing lines (like > the "include admin") start with spaces, the lines you've created start > w

Re: Update Query

2010-05-13 Thread Bill Freeman
Update still takes exactly one argument: self. I'm still not completely clear on what the OP is trying to do so I'll guess that for a given User object (id == 11) you want to adjust a set of attributes not known apriori, but available as key - value pairs from an itterator I'll call 'd.items()':

Re: Update Query

2010-05-13 Thread Bill Freeman
.objects.filter(pub_date__year=2007).update(headline='Everything > is the same') > > Regards > Scott > > > On May 13, 3:14 pm, Bill Freeman wrote: >> Update still takes exactly one argument: self. >> >> I'm still not completely clear on what the

Re: Update Query

2010-05-14 Thread Bill Freeman
t I could go look at the code, but I've got a sneaking suspicion that that it's a worker method used in the implementation of filter, exclude, etc. So, the only way that I know to run a SQL UPDATE is with custom SQL. (I'm pretty sure that you can't do it with extra().) Bill On

Re: Update Query

2010-05-14 Thread Bill Freeman
" below, and do: User.objects.filter(id=11).update(**d) Bill On Fri, May 14, 2010 at 10:30 AM, Tom Evans wrote: > On Fri, May 14, 2010 at 3:26 PM, Bill Freeman wrote: >> Actually, there would be a real advantage to doing update in the >> DB rather than instantiating the model, chang

Re: Django CSV module encoding issue

2010-05-14 Thread Bill Freeman
Two choices: 1. Use apostrophe instead of a left or right signle quote when filling out the form. ;^) 2. Encode the description as utf-8 before writing it. description is almost certainly a unicode string. It gets coerced to be a bytes string when passed to python's (not django's) csv writer.

Re: Installing 3rd party django applications on a shared environment

2010-05-18 Thread Bill Freeman
I'll be that you can have a private site-packages directory, or whatever you want to call it, which you can add to sys.path. You can manipulate sys.path in your manage.py, but if you don't need to override basic django stuff that is imported before settings.py is read, you could do the manipulatio

Re: Installing 3rd party django applications on a shared environment

2010-05-18 Thread Bill Freeman
Because the incantation is ". activate", not "./activate". "." is a shell command a.k.a. source, which reads the file and executes it in the current shell. It is not a command to run as a sub-process. On Tue, May 18, 2010 at 1:15 PM, ryan west wrote: > Hey Tom, > > Any idea why ./activate would

Re: reverse() with multiple possibilities: Is there a way to retrieve all?

2010-05-18 Thread Bill Freeman
Make one of the urls pass an argument using parentheses in the pattern. Then make that an option argument in the view function. Reverse will return one if you supply the argument, and the other if you don't. But why not use named patterns and reverse by pattern name? In either case you have to

Re: trying not to do any operations in template, but not sure i can avoid it.

2010-05-19 Thread Bill Freeman
You could put a method on your basket object which calculates the shipping. Then if the basket object is included in the context, you can trivially call it. Or perhaps better, fix up you all_purchases iterable to append it. Something like: def add_shipping(purchaces_iterable): for i, p i

Re: trying not to do any operations in template, but not sure i can avoid it.

2010-05-20 Thread Bill Freeman
On Thu, May 20, 2010 at 4:24 AM, shofty wrote: > thanks for the swift response. > > On May 19, 10:05 pm, Bill Freeman wrote: >> You could put a method on your basket object which calculates the shipping. >> Then if the basket object is included in the context, you can

Re: Importing ImageField from file or - better - generating it from another ImageField

2010-06-01 Thread Bill Freeman
Perhaps see the django-filebrowser product. It may have things that you don't need, but makes thumbnails, and associates them with an image field, so it is at least a sample of what's involved. Bill 2010/5/31 Ricardo Bánffy : > Hi folks > > I am having huge problems wrapping

Re: AJAX request does not seem to have request.user

2010-06-02 Thread Bill Freeman
get a response. (COMET, on the other hand, is different.) Bill On Tue, Jun 1, 2010 at 10:16 PM, Carl Nobile wrote: > I have modified my admin site so that a state/province will be loaded > through an AJAX call when the country is chosen. I had > @login_required(redirect_field_name='

Re: AJAX request does not seem to have request.user

2010-06-02 Thread Bill Freeman
On Wed, Jun 2, 2010 at 9:35 AM, Carl Nobile wrote: > Nothing has changed at all. I was just going through the steps to > migrate my code base to Django 1.2.1 and this stopped working. If I > comment out the decorator everything works just fine minus the > protection of cause. The internal wrapper

Re: form.as_p, as_table variation

2010-06-03 Thread Bill Freeman
orders for different model forms on the same model (I make it match the fields set from the Meta class in my application). Bill On Thu, Jun 3, 2010 at 11:05 AM, Thomas Allen wrote: > How can I create my own form renderer, like as_p, as_table, etc? I see > that the form class provides _htm

Re: form.as_p, as_table variation

2010-06-03 Thread Bill Freeman
Actually, you might try adding them in your form's __init__ method, again, after calling the superclass method. I've done this with choices on a field. Since self.fields is a deep copy, you might be safe setting an attrs attribute on the field's widget: self.fields['fieldname'].widget.attrs.up

Re: Custom tag weird behaviour

2010-06-04 Thread Bill Freeman
e the 1 to a 0. Bill On Fri, Jun 4, 2010 at 12:42 PM, __alex__ wrote: > Hi all, > > I've been trying to figure this out for hours and hours, but I simply > can't understand how to make it work. > > Now, we have a very simple custom template tag. Let's say that w

Re: Template issue, maybe?

2010-06-04 Thread Bill Freeman
People are more likely to have ideas if you give us your Apache configuration stanzas, particularly the WSGIScriptAlias and, if used your WSGIDaemonProcess and WSGIProcessGroup directives, any directory stanzas you have for serving the media, admin-media, and any other static content trees. All pr

Re: How to pass List to Form Meta Class

2010-06-07 Thread Bill Freeman
Note: The order of fields in the Feta class fields object does not affect the order of fields on the page. If the set of fields is truely dynamic, you will need, I believe, to use internal interfaces of the forms machinery, which are not guaranteed to remain the same from one Django version to the n

Re: Upgrading Python from 2.4 to 2.6 - can I just copy site-packages folder?

2010-06-08 Thread Bill Freeman
out. This is all much more work than just installing stuff fresh, in these bold new days of distribute and pip install. Bill On Tue, Jun 8, 2010 at 10:32 AM, Alex Robbins wrote: > You don't want to just copy site-packages. If you have any compiled > modules (pyyaml, PIL, etc) they

Re: ASCII problem strikes again - Caught DjangoUnicodeDecodeError while rendering...

2010-06-08 Thread Bill Freeman
al DB configuration), you could raise an exception if it is not, while holding lots of interesting stuff in local varuables so that they could be examined in the stack trace. Bill On Tue, Jun 8, 2010 at 3:19 AM, zayatzz wrote: >> Guarantee the problem is with your __unicode__ method on the Ga

Re: Change password in administration page

2010-06-10 Thread Bill Freeman
. You are perfectly welcome to have a view for editing profiles that isn't part of the admin app, where you could have whatever password management option you want, but the admin stuff just uses basic django model capability to display that box. Bill On Thu, Jun 10, 2010 at 9:13 AM, stanl

Re: syncdb always indicates there are no fixtures

2010-06-11 Thread Bill Freeman
On Fri, Jun 11, 2010 at 6:19 AM, tsmets wrote: ... > > Any help on how to run python scripts directly to create my data > sets ? > What I do now is fine but could be better automated ? > ... One possibility is to write yourself one or more management commands which you could invoke by hand,

Re: How does buildout determine paths needed? (for django-page-cms)

2010-06-29 Thread Bill Freeman
plates, or just css, images, and js, but I wouldn't be surprised. The pages templates are examples, IIRC, and you make your own to stick in project_root/templates/pages/ . Bill On Tue, Jun 29, 2010 at 8:56 AM, John Griessen wrote: > I made a buildout with the config below that didn't wo

Re: Should I start to use Mako from beginning?

2010-06-30 Thread Bill Freeman
y: start with the default, then consider changing things that don't work for your purpose. Bill On Wed, Jun 30, 2010 at 11:34 AM, AllenDang wrote: > I'm new to django, it's amazing! But after I did some research from > google, I found out that some people say that the defa

Re: Valid objects are returning an http 404 response

2010-07-01 Thread Bill Freeman
Does it happen when running the development server? If so, you get a lot more debugging info right up front (access to variables in each stack from, for instance). If it's still not clear you can use the trace as a guide as to where to put a pdb.set_trace() (possibly in an if that makes it only t

Re: UnicodeDecodeError: 'utf8' codec can't decode

2010-07-01 Thread Bill Freeman
What's in the database probably isn't legal UTF-8. It is easily possible to have a sequence of characters in some other encoding which only results in the wrong characters if treated as UTF-8, but it is also possible to violate the UTF-8 structure with such a sequence. PostgreSQL, if set for UTF-

Re: Valid objects are returning an http 404 response

2010-07-01 Thread Bill Freeman
gt; information. > > On Jul 1, 9:28 am, Bill Freeman wrote: >> Does it happen when running the development server?  If so, you get >> a lot more debugging info right up front (access to variables in each >> stack from, for instance).  If it's still not clear you ca

Re: Arbitrary Properties from code

2010-07-01 Thread Bill Freeman
mood = Emotion.objects.get(mood='thoughtful') The above raises DoesNotExist if the emotion hasn't been defined. If you want to raise a different one, then catch this one and raise your own. Then use mood in your query on the person's emotions. On Thu, Jul 1, 2010 at 10:31 AM, Doug Warren wrote

Re: www.djangoproject.com

2010-07-01 Thread Bill Freeman
You might have a poisoned DNS cache. Since this is Windows, you could try rebooting, but there could be other DNS caches between you and a good name server. On Thu, Jul 1, 2010 at 3:37 PM, FC wrote: > On Jul 1, 3:41 pm, Carsten Fuchs wrote: >> Hi all, >> >> Am 01.07.2010 19:40, schrieb FC: >> >

Re: www.djangoproject.com

2010-07-02 Thread Bill Freeman
he browser location bar doesn't seem to work, making me presume that the site is in an apache or equivalent). Another nifty tool for diagnosing DNS problems is nslookup, but, again, I can't tell you what to use on windows. Bill On Fri, Jul 2, 2010 at 2:19 PM, mhulse wrote: >> try reb

Re: drupal and django being friends

2010-07-02 Thread Bill Freeman
I suspect that you can do what you want with mod_rewrite, but there is a learning curve. Bill On Fri, Jul 2, 2010 at 11:39 AM, garagefan wrote: > So i realize this isn't a specific django question but more of a > python question and setting up the config file for the server. > &

Re: UnicodeDecodeError: 'utf8' codec can't decode

2010-07-06 Thread Bill Freeman
of the DB settings, is invalid, then it's not Django's job to fix it for you. N.B.; There's no guarantee that that web page correctly identified its encoding either. Bill On Mon, Jul 5, 2010 at 8:52 AM, Yateen wrote: > Thanks Bill. > > Do you mean even Postgres also sho

Re: gettext with latin1 chars.

2010-07-06 Thread Bill Freeman
Just for fun, try specifying the non-ASCII strings as unicode strings and let us know how you make out. On Tue, Jul 6, 2010 at 10:09 AM, Alexander Brill wrote: > Hi, > > I got some translation strings set up. But they aren't translated if > the translation string contains a non-ascii character. >

Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread Bill Freeman
I agree that the "as" clause makes me expect it to render nothing, but it has worked this way at least back to 1.0, so I guess changing it is not an option. On Wed, Jul 7, 2010 at 11:55 AM, ringemup wrote: > Er, that was sloppy of me.  Actual output: > > >  a >  a >  b >  b >  a >  a > > > On J

Re: Is {% cycle ... as ... %} supposed to output a value?

2010-07-07 Thread Bill Freeman
You could perhaps put it in a span with display:none; . Or you can always create your own template tag with the desired behavior. The source for the existing tag is in .../django/template/defaulttags.py . On Wed, Jul 7, 2010 at 12:25 PM, ringemup wrote: > I guess that's a workaround.  It would b

Re: Query raises a DoesNotExist error

2010-07-07 Thread Bill Freeman
My bet is that FullProfile.objects.get is raising the error because there is no profile with that email address. You might expect this to be caught by the "try" and raise a validation error instead, but since you have no "except" clause, its not going to happen. On Wed, Jul 7, 2010 at 1:22 PM, Ni

Re: Accessing the current user's first name

2010-07-20 Thread Bill Freeman
#x27;m looking at is your profile model) isn't likely to win "best practice" accolades. Bill On Tue, Jul 20, 2010 at 10:08 AM, reduxdj wrote: > HI, > > So I tried for an hour or so to access  the current user's first name, > so I can send out a personalized invitatio

Re: DecimalField, how to accept $ character

2010-07-20 Thread Bill Freeman
Example, no, but you could create a custom field, based on the DecimalField, which a custom validator that checks for and removes a leading dollar sign. I think that django snippets has a good chance of having examples of "currency" fields, and if not, Satchmo has one. Perhaps they do the dollar s

Re: Accessing the current user's first name

2010-07-20 Thread Bill Freeman
ate from the database, though caching could make this look as though it is working). > > On Jul 20, 10:33 am, Bill Freeman wrote: >> You don't say what model this is.  Since it doesn't exactly match >> django.contrib.auth.models, I'm going to guess that you may

Re: Accessing the current user's first name

2010-07-20 Thread Bill Freeman
I'm not sure that we are understanding one another. In an earlier post you mentioned the phrase "current user". I interpreted that to be the user which had "logged in" to the site, using django.contrib.auth (such as to be able to use the admin, though certainly not all such users need be given ad

Re: Free web-hosting sites that support Django ?

2010-07-21 Thread Bill Liao
On Wed, Jul 21, 2010 at 9:28 PM, Ron Barak < google_maps_forum.comve...@9ox.net> wrote: > Hi, > > I'm starting to learn Django, and was wandering if there were any free > web-hosting sites that would support modern Python (e.g. > 2.5) and > Django ? > > Once the site I have in mind is developed an

Re: Two apps with same url's in one project.

2010-07-23 Thread Bill Freeman
ut that the generic views url generation uses reverse(). Bill On Thu, Jul 22, 2010 at 3:48 AM, maciekjbl wrote: > Hi, > > I wrote two apps in same project. There're quite similar, and this is > the problem here. They have two idetical urls.py files : >

Re: UnicodeDecodeError: 'utf8' codec can't decode

2010-07-23 Thread Bill Freeman
do the appropriate encoding and decoding. Bill On Thu, Jul 22, 2010 at 8:58 AM, Yateen wrote: > Ok, I did some changes and things look to be working. > > My intention was to receive URLs, parse them to get the base URL, put > them in database (Postgres), and then through a http q

Re: formset question?

2010-07-23 Thread Bill Freeman
That's because list have no attribute "forloop". forloop is for use inside a {% for ... %} tag, where {{ forloop.counter0 }} works just fine. On Fri, Jul 23, 2010 at 1:30 PM, ydjango wrote: >  I tried {{labels.forloop.counter0}} . It did not work. where labels > is a list. > > -- > You re

Re: how to create a custom django template filter(please help)

2010-07-26 Thread Bill Freeman
.py". The tutorial at python.org really is worthwhile. I also believer that the directory containing these files must be named "templatetags". I don't know, from reading your question, whether you got that part. Bill On Mon, Jul 26, 2010 at 8:56 AM, Joseph wrote: > hi &g

Re: Calculate distance between 2 latitude/longitude Point

2010-07-28 Thread Bill Freeman
angle, as seen from the center of the sphere, and typically in radians. Bill 2010/7/28 Alexandre González : > Hi! I'm using the Django GEOS API [1] in my project to see the distance > between two users. > I get the coordinates from google maps in latitude/longitude mode and I need >

Re: Best way to find near people

2010-07-29 Thread Bill Freeman
well. Bill 2010/7/29 Alexandre González : > Hi! > I'm searching near people in my app. I'm doing it a this way: > 37             people = Person.objects.all().exclude(user=request.user) > 38 > 39             near_people = list() > 40             for person in people: >

Re: Re: Best way to find near people

2010-07-30 Thread Bill Freeman
A couple of possible optimizations: First, because cos is single valued over the range of possible angles (as measured from the center of the earth, 0 <= d <= PI) distance is monotonic with cos distance. So you can pre-calculate the cos of the distance, and compare the innder expression to that:

Re: CheckBoxInput widget: check_test

2010-08-06 Thread Bill Freeman
There is a CheckBoxSelectMultiple widget in django.forms, suitable for use with a forms.ModelMultipeChoiceField, and probably with other stuff.Doesn't it do what you need? Or are you just reinventing the wheel. And, of course, your code as shown doesn't work because Cat and Category are not b

Re: CheckBoxInput widget: check_test

2010-08-06 Thread Bill Freeman
uff you do paste in. On Fri, Aug 6, 2010 at 3:26 PM, lingrlongr wrote: > @Bill > > Thanks.  I just stumbled across that widget.  I know models.Model > weren't there, I was trying to simplify thinking we'd all know they > were there.  I guess, never assume ;) > > Looks l

Re: Loop over a form's choices (radio button) and render it

2010-08-11 Thread Bill Freeman
r, an instance of which is passed to bound_field.as_widget() to capture teh name, data (values) and attrs. If there's an 'id' attr, you also have to dumy up an enhanced version for each checkbox. About 80 lines of code, if I can count the blank lines for prettyness. Bill On Wed,

Re: Overriding the widget of a custom form field in admin

2010-08-13 Thread Bill Freeman
I suspect that you must refrain from setting self.widget if widget is in kwargs. On Thu, Aug 12, 2010 at 1:22 PM, omat wrote: > Hi All, > > I have a custom TagField form field. > > class TagField(forms.CharField): >    def __init__(self, *args, **kwargs): >        super(TagField, self).__init__(*

Re: Loop over a form's choices (radio button) and render it

2010-08-16 Thread Bill Freeman
Ok. I have permission from my boss, and have cleaned it up a bit. See: http://djangosnippets.org/snippets/2151/ Bill On Sat, Aug 14, 2010 at 7:25 AM, Andreas Pfrengle wrote: > Hello Bill, > > thanks for your answer. However, I've never written a template filter > yet. Woul

Re: deserializing json

2010-08-20 Thread Bill Freeman
Have you tried looking at the raw data to see if it is what you expect (capture to a file or pdb.set_trace() is your friend)? Have you tried (assuming relatively recent python, >= 2.6 I think) loads from the json module? Bill On Fri, Aug 20, 2010 at 8:16 AM, irum wrote: > Hi, > I am

Re: Loop over a form's choices (radio button) and render it

2010-08-23 Thread Bill Freeman
Andreas, I'll give it a try, but it won't be soon. Other projects are hot. Bill On Sun, Aug 22, 2010 at 9:07 AM, Andreas Pfrengle wrote: > Hello Bill, > > thanks for the code. It took half the weekend, but finally I built > upon this to get a radiobutton-iterato

Re: Pass extra data in post_save?

2010-08-30 Thread Bill Freeman
sed in the signal. Bill On Sun, Aug 29, 2010 at 9:12 AM, bruno desthuilliers wrote: > On 27 août, 18:07, AK wrote: >> From what I can tell in the documentation, a post_save signal only >> passes sender, instance, created, and using.  I would love to use this >> signal to upd

Re: PIL on 10.6 = PAIN

2010-08-31 Thread Bill Freeman
kage installation scripts usually take care of this, but it sometimes needs to be done by hand, if you're just, for example, unpacking a tarball. I don't know the equivalent for osx. Good luck. Bill On Tue, Aug 31, 2010 at 12:41 PM, keynesiandreamer wrote: > Howdy! > > I h

Re: how to add a non-field text property to forms in a formset

2010-09-01 Thread Bill Freeman
This seems to me to be a job for the template. The forms documentation has a section on custom rendering which shows you how to iterate through the fields, or access them by name. You would insert whatever HTML construct was appropriate for your text, providing a context variable giving its conte

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread Bill Freeman
n the view and pass it as a boolean in another context variable to use in an if tag (or calculate in a model or form method that is easy to call from the template code). Or I may be totally misunderstanding the original problem. Bill On Wed, Sep 1, 2010 at 9:48 PM, bobhaugen wrote: > On S

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread Bill Freeman
erence in the template. So, is this what you want, and if so have you tried it, and if so what don't you like about the result? Bill On Thu, Sep 2, 2010 at 3:06 PM, bobhaugen wrote: > Bill, > > Thanks a lot for sticking with this question. > > On Sep 2, 1:44 pm, Bill Freeman wr

Re: how to add a non-field text property to forms in a formset

2010-09-02 Thread Bill Freeman
ure it with a named argument rather than extracting ti from kwargs.) Does that fit? Bill On Thu, Sep 2, 2010 at 4:08 PM, bobhaugen wrote: > On Sep 2, 2:54 pm, Bill Freeman wrote: >> Let's start by agreeing on common terminology.  "property" has >>  a meaning in Python sli

Re: Template syntax

2010-09-02 Thread Bill Freeman
Don't use [] subscripting, use dot. The template engine tries using the thing after the dot in various ways, including as a dictionary key and as a list index. So, for example: {% ifequal param1_trunc.i "-" %} On Thu, Sep 2, 2010 at 5:11 PM, Bradley Hintze wrote: > Hi, > > Django says that t

Re: django-twitter-oauth connection refused

2010-09-03 Thread Bill Freeman
There was an email from twitter to it's users, yesterday or the day before, saying that they've changed their auth API. I think it was a change to requiring OAUTH, but you may want to check whether port or SSL changes have occurred. On Fri, Sep 3, 2010 at 10:08 AM, ashy wrote: > Hi All, > > I am

Re: django-twitter-oauth connection refused

2010-09-03 Thread Bill Freeman
No. I'm not actually using twitter anywhere. I just remember the email saying that the API changed on Tuesday, so I'm not surprised if things that worked before are broken now. On Fri, Sep 3, 2010 at 10:26 AM, ashwin morey wrote: > Hi Bill, > > Did you try using django-t

Re: django-twitter-oauth connection refused

2010-09-07 Thread Bill Freeman
dvice). Bill On Mon, Sep 6, 2010 at 12:39 AM, ashy wrote: > Hi All, > > Now I am getting 'Cannot send request' exception. > Exception Location:  /usr/lib/python2.6/httplib.py in putrequest, line > 802 > Some problem with httplib. Any ideas? > > thanks >    ashwin

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