Re: Annotations

2009-05-07 Thread George Song
eated n times (once for each Content associated with that writer, tagged with `tag`). You should be able to do something in Python to get the Writer:count() mapping that you want. -- George --~--~-~--~~~---~--~~ You received this message because you are sub

Re: limiting choices for foreign key choices in the admin view

2009-05-07 Thread George Song
On 5/7/2009 9:19 PM, Margie wrote: > Thanks much George, that was a big help. I have some "proof of > concept code below" that simply limits choices to the first four > users, and I have verified that that works. > > class TaskAdmin(admin.ModelAdmin): > >

Re: QuerySet.values() for single object?

2009-05-07 Thread George Song
On 5/7/2009 9:23 PM, Shadow wrote: > If i get a model object with Model.objects.get() > > Is their a way to turn that into a dictionary? Why not just filter for it and use values()? -- George --~--~-~--~~~---~--~~ You received this message becaus

Re: Moving from perl/cgi to Django/Python

2009-05-08 Thread George Song
want to look into: * inspectdb [1] * unmanaged models [2] Good luck, and welcome. [1] <http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb> [2] <http://docs.djangoproject.com/en/dev/ref/models/options/#managed> -- George --~--~-~--~~~---

Re: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2009-05-08 Thread George Song
equence_Number += 1 > TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' {{{ try: sn = Sequence_Number.objects.get(Sequence_Name=itemToSequnce) except Sequence_Number.DoesNotExist: sn = Sequence_Number(Sequence_Name=itemToSequnce) next_number = sn

Re: using id as a model field name ?

2009-05-08 Thread George Song
ould change all of my code to something > like: > pk = models.AutoField(... I think it's unlike you'll collide with the built-in `id()`, unless you explicitly do something like id=blahblahblah, but that can happen with anything, not just your models. In other words, don't wor

Re: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2009-05-08 Thread George Song
On 5/8/2009 5:58 PM, Lee Hinde wrote: > On Fri, May 8, 2009 at 5:12 PM, Lee Hinde wrote: >> On Fri, May 8, 2009 at 4:48 PM, George Song wrote: >>> On 5/8/2009 4:32 PM, Lee Hinde wrote: >>>> Hi; >>>> >>>> I get the error below at

Re: How to disable deletion af a model instance

2009-05-09 Thread George Song
ttp://code.djangoproject.com/ticket/11022> Also you might want to think about setting up a group in auth to have finer grained permission control. It's pretty simple to just leave out delete for this specific model. Is there a reason they need to be superusers? -- George --~--~-

Re: Print question

2009-05-09 Thread George Song
but there we go! >> You can print its __dict__ attribute if you're really bored. If it's >> an object you created, correctly override the corresponding magic >> methods (__str__, __repr__, ...) -- George --~--~-~--~~~---~--~~ You received th

Re: timeuntil filter

2009-05-09 Thread George Song
> >> There are {{ earliest_date }}{{ earliest_date|timeuntil }} until the event. > > displays: > > There are 2009-05-17 until the event. Are you definitely passing in `earliest_date` as a `datetime.date` object to the template? -- George --~--~-~--~~

Re: How to disable deletion af a model instance

2009-05-09 Thread George Song
.save() > > When bookFormSet.save() gets executed, I get this output: > > PreDelete called for instance book1 > PreDelete called for instance Reader object > PreDelete called for instance Reader object > > So I guess I am totally confused now. I know I have had a ton of > pr

Re: User Authentication Woes

2009-05-10 Thread George Song
zation_ activity within your project is up to you to implement. In this case, all you have to do is a simple check to see if the right user can see the invoice requested, throw a 403 if not, and allow them to pass if they are. -- George --~--~-~--~~~---~--~---

Re: Field value from queryset as extra_context

2009-05-10 Thread George Song
the h1 seems > a bit redundant seeing as every pub instance in object_list will have > the same name of the town anyway. > > Is it possible to use the queryset to pass the town name as > extra_context so that a variable is available to use in my template? > Is the

Re: Accessing value of a Form.Field in templates

2009-05-10 Thread George Song
still doesn't > work. Did I misinterpret the status of the ticket? It's sometimes hard > for me to understand the history. The ticket doesn't appear to be what you're asking for. I think the easiest way is for you to insert an extra context variable in your view, since

Re: Accessing value of a Form.Field in templates

2009-05-10 Thread George Song
On 5/10/2009 5:32 PM, Martin wrote: > > On 11 Mai, 02:07, George Song wrote: >> The ticket doesn't appear to be what you're asking for. I think the >> easiest way is for you to insert an extra context variable in your view, >> since `GET` and `POST` are verb

Re: After a form submit, getting user info into an attribute while still using generic views?

2009-05-11 Thread George Song
; don't see how to keep the generic view usage in url.py. > > Any other way ? You can easily use the generic view in your own view. It's a pretty common pattern in Django. In this case, you probably just want to pass the user as a extra context variab

Re: How to create a newforms label unattached to an input field?

2009-05-11 Thread George Song
ur own rendering method for that form which takes care of generating the correct label at the right place. 2. Write a custom widget, since widgets are responsible for rendering fields out to the form. -- George --~--~-~--~~~---~--~~ You received this message beca

Re: two models, 1 table

2009-05-11 Thread George Song
ev/topics/db/models/#id8> -- George --~--~-~--~~~---~--~~ 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: modular django site: projects vs. apps

2009-05-12 Thread George Song
y are meant to be independent, then you'll need to take care that they have no dependences on *any* project whatsoever. And preferably not on other apps as well (except maybe django.contrib ones). -- George --~--~-~--~~~---~--~~ You received this message be

Re: session through redirects

2009-05-12 Thread George Song
seeing the same results. Can members > point me to the right direction on how to use sessions through > redirects? Your code appears correct for how you're using `request.session`. Couple things to check: 1. Make sure you've enabled your sessions[1]. 2. Make sure you are getting the `

Re: Help a noob with a stupid question - forms

2009-05-12 Thread George Song
n my opinion, the calendar widget might be a > little confusing. To get you started, here's a widget I wrote and use myself: <http://dpaste.com/43369/> -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: get_or_create not atomic?

2009-05-12 Thread George Song
a row is supposed to be "unique", by whatever criteria, and that criteria is enforced through the DB via proper model definition, the second insert would fail properly. -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: flatpage content not appearing

2009-05-12 Thread George Song
It's answered in the documentation section for flatpages under "How it works": <http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/#how-it-works> -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
odel, but in other situations a mixin might > want a different order. Do you have a proposed solution on how to achieve what you want? How would you express the different "situations" within the mixin? -- George --~--~-~--~~~---~--~~ You received thi

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
n.fields` so you can be dynamic about the field order without having to create additional form classes. I think the ModelAdmin form factory pattern is a pretty good one to follow. -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
apear in. Duh. There you go, problem solved: <http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-order-of-fields> The changes are fast and furious, hard to keep up with everything. -- George --~--~-~--~~~---~--~~ You received this messa

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
On 5/12/2009 12:28 PM, Luke Graybill wrote: > Here is how I've implemented field ordering for 1.0.2 The snippet doesn't appear to be available anymore. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: How do you handle apostrophe and spaces in dynamic url?

2009-05-12 Thread George Song
Foo's goo foos-goo > > I will also need that url to retrieve information on that entry from > the table. Can someone with a lot of experience in web dev confirm > that the above is the best way to handle this situation? <http://docs.python.org/library/urllib.html#ur

Re: Trouble starting up runserver

2009-05-12 Thread George Song
tp://www.velocityreviews.com/forums/t352778-some-errors-when-running-code-in-diveintopython-.html> -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: ForeignKeys to MTI models break admin (as of 10756)

2009-05-15 Thread George Song
an't see immediately wrong with your example, so I'm guessing this > is an unintended consequence. I'll take a look at this; it would be > most helpful if you could open a ticket with your example code. Imagine my surprise when I svn updated tonight. I opened a ticket: <

Re: abstract classes in models

2009-05-15 Thread George Song
g_set.all > > but that doesn't seem to work, i seem to have to do: > class1.thingtype1_set.all and class1.thingtype2_set.all > > does this make sense? am i missing something? > > any help would be appreciated. The pattern you describe should work fine. What exactly isn

Re: abstract classes in models

2009-05-15 Thread George Song
On 5/15/2009 10:08 AM, Rusty Greer wrote: > > > On Fri, May 15, 2009 at 9:57 AM, George Song <mailto:geo...@damacy.net>> wrote: > > > On 5/15/2009 8:18 AM, Rusty Greer wrote: > > > > > > I have something like this

Re: Question: What's the best way to denormalize M2M data?

2009-05-19 Thread George Song
27;m ignorant of. I tried a scrub of Google and the list archives > without much luck, but please forgive me if I'm overlooking something > obvious. You can always explicitly define the m2m model, then you can override the save() on that model if you like, or use signals like any other

Re: Form Wizard and Saving to Database

2009-05-19 Thread George Song
er model attributes, and save the object. If you happen to name your form fields the same as your model fields, then you can just use cleaned_data directly: {{{ form_data = {} for form in form_list: form_data.update(form.cleaned_data) m = Model.objects.create(**form_data) }}} -- George --

Re: ModelForm question

2009-05-19 Thread George Song
lp would be appreciated. Just override otherClass's widget. See: <http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types> -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: Import Error: couldn't locate module Http.Isapi

2009-05-19 Thread George Song
m not sure if you can set an ISAPI filter to run as a specific user, if so, that could be another route. -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Question: What's the best way to denormalize M2M data?

2009-05-19 Thread George Song
On 5/19/2009 9:47 AM, Ben Welsh wrote: > On Tue, May 19, 2009 at 12:18 AM, George Song <mailto:geo...@damacy.net>> wrote: > > > You can always explicitly define the m2m model, then you can override > the save() on that model if you like, or use signals li

Re: Setting tzinfo for DateTimeFields with Postgresql - workaround

2009-05-21 Thread George Song
e access. Hi Glenn, When you get the chance can you review my proposal[1] for fixing DateTimeField in Django? I'm going to try to get this in for 1.2 release. [1] http://code.djangoproject.com/ticket/10587 -- George --~--~-~--~~~---~--~~ You received this

Re: Making queries on manytomany tables

2009-05-22 Thread George Song
27;%s' %(self.title) > > > class Song(models.Model): > title = models.CharField(max_length=128) > albums = models.ManyToManyField(Album) > > def __unicode__(self): > return self.title Probably a compound query: 1. All albums for a given artist 2. All songs whe

Re: how to load data?

2009-05-22 Thread George Song
us to help you more. -- George --~--~-~--~~~---~--~~ 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: Plugin technology

2009-05-23 Thread George Song
ally internal to the specific plugin domain, so depending on your needs, you can enforce it a number of ways: simple documentation of the superclass, putting in a stub of NotImplemented, etc. -- George --~--~-~--~~~---~--~~ You received this message because you are s

Re: Plugin technology

2009-05-23 Thread George Song
gin that could be injected to my > main template. If you're using Marty's pattern, why don't you just pass the mount point as a context variable to your template, then you can easily loop through the plugins that way, right? -- George --~--~-~--~~~---

Re: use of HttpResponseForbidden(), etc.

2009-05-23 Thread George Song
On 5/23/2009 9:07 AM, ken keller wrote: > When my view returns: > > return HttpResponseForbidden() > > the browser doesn't show the non-200 status. How are you determining that the browser is not receiving a 403 status? -- George --~--~-~--~~~

Using 'django-filter' on a field with choices

2009-09-21 Thread Almost George
I'm using the very cool django-filter (via: http://github.com/alex/django-filter) and either can't seem to wrap my head around the docs, or maybe just need a little boost. When I show the filter form on an object list page, for a FK field I get the dropdown that includes a "-" which kind of

Re: Using 'django-filter' on a field with choices

2009-09-21 Thread Almost George
On Sep 21, 8:54 am, Almost George wrote: > I'm using the very cool django-filter > (via:http://github.com/alex/django-filter) > and either can't seem to wrap my head around the docs, or maybe just > need a little boost. > > When I show the filter form on an object

Merge models?

2009-09-22 Thread Almost George
Wondering if there is already work being/been done on making it easy to merge models. It may be much easier than I think, but I thought I would ask anyway. Here's my specific scenario: On a site where users contribute a good deal of content, someone might come across a piece of content that coul

Re: Setting tzinfo for DateTimeFields with Postgresql - workaround

2009-09-28 Thread George Song
Sounds about right to me. Hopefully I'll have more time after this month to pick this up again. On Aug 16, 6:24 pm, Ramiro Morales wrote: > Hi George, > > On Thu, May 21, 2009 at 7:56 PM, George Song wrote: > > > Hi Glenn, > > > When you get the chance can you

Complicated Form "Workflow" - Need ideas/direction

2009-12-14 Thread Almost George
I have a working site, and the admin works fine for what I'm doing. I have 3 primary models: an Event, an Attendee, and a Venue. In the admin, an Event created *must* have at least one Attendee, and must, obviously, have a Venue (location). I'd like to open up the site for user submissions (users

Re: Complicated Form "Workflow" - Need ideas/direction

2009-12-14 Thread Almost George
On Dec 14, 2:23 pm, Shawn Milochik wrote: > What you're trying to do is simple enough to write out in flowchart form on a > sheet of paper. You should do that, then write some code, then ask for help > with specifics when you get stuck, or are trying to decide between different > approaches.

Re: Complicated Form "Workflow" - Need ideas/direction

2009-12-14 Thread Almost George
On Dec 14, 3:04 pm, Shawn Milochik wrote: > Okay, here are a few ideas: > > 1. If you hate pop-ups, but aren't opposed to a little AJAX, then you could > do it that way. > > 2. You could do it with a multi-screen, 'wizard-like' set of templates. > > 3. You can keep state using session variables

Re: form class

2010-04-23 Thread George Sakkis
d forms? > Should I study it, further? You don't *have to* use forms, you can hand-code all the html to be rendered and do the validation manually. However django forms are not limited to static ones; for an example of how to generate dynamic forms check out http://jacobian.org/writing

Re: www.djangoproject.com

2010-07-01 Thread George Sakkis
nder Lucid from two different computers and IPs. I just tried Chromium under Lucid and it does connect. So indeed there's something funny going on with the Firefox/Ubuntu combo. George -- You received this message because you are subscribed to the Google Groups "Django users"

break/continue for templates

2010-07-04 Thread George Sakkis
t(a=[1,2,3], c=[2,4,5], b=[3,5,7])}, the output is: a: 1 a: 2 a: 3 3 is divisible by 3 c: 2 c: 4 c: 5 c: No value divisible by 3 b: 3 3 is divisible by 3 Tested (lightly) on Django 1.2 / Python 2.6; please let me know if you hit any bugs or unexpected behavior. Cheers, George [1] http://dj

Re: break/continue for templates

2010-07-05 Thread George Sakkis
ided this sort of thing is because I must > have done that sort of work in the view :) To be honest, I never *had to* do it (in the strict sense) either but apparently others did ([1-4]). As for the "just put it in the view" argument, remember that until last month this was the respons

Re: break/continue for templates

2010-07-05 Thread George Sakkis
On Jul 5, 2:25 pm, Torsten Bronger wrote: > Hall chen! > > George Sakkis writes: > > [...] > > > To be honest, I never *had to* do it (in the strict sense) either > > but apparently others did ([1-4]). As for the "just put it in the > > view" argumen

Re: www.djangoproject.com

2010-07-14 Thread George Sakkis
Glad I could help :) > > I'm using Weave too, don't think that's a coincidence. Another Weave user here, and I confirm both the problem and the solution. Thanks a lot for solving this, it was driving me crazy! George -- You received this message because you are subscribe

Re: www.djangoproject.com

2010-07-15 Thread George Sakkis
7;t write down the offending entry in my case but I think it was the same or similar to yours. In any case, I can confirm that by setting it the problem is reproduced. Trying to reverse engineer the pattern of the offending values, I believe that the issue is the string length: any value up to 16 by

Re: www.djangoproject.com

2010-07-15 Thread George Sakkis
On Jul 15, 1:14 pm, Tom Evans wrote: > On Thu, Jul 15, 2010 at 11:02 AM, George Sakkis > wrote: > > On Jul 15, 4:55 am, Danny Adair wrote: > > >> Hi, > > >> I had the exact same problem, and I had _not_ installed Weave. > >> The offending confi

Notification of Model Changes

2010-08-24 Thread Almost George
This is probably a very old question, but I wasn't able to find an obvious answer - sorry if I overlooked anything. I have a model with a "status" field (using Choices) that defaults to "pending" and has other options like "closed", "active", etc. I would like to implement email notifications of

Re: Notification of Model Changes

2010-08-24 Thread Almost George
On Aug 24, 2:15 pm, Shawn Milochik wrote: > If you override __init__() and store the value of that field in a > temporary value, such as self.old_status, then the instance will have > both self.status and self.old_status for comparison later. > > I hope this fits your use-case. > > Shawn Sounds

GeoDjango installer not working

2010-09-09 Thread George Silva
Hello guys, The GeoDjango installer for windows is not working. When I try to execute it I get an error, saying that file is possibly corrupted. Is it me or is the file damaged? Thanks -- George R. C. Silva Desenvolvimento em GIS http://blog.geoprocessamento.net -- You received this

Re: Are AutoField primary keys re-used after deleting an object from the db?

2010-10-09 Thread George Silva
I'm pretty sure that OID is not reused. It's database behavior to control this and my guess is that Django does not use old object ids. Futhermore there is a simple test that you can do: Create a new object, delete it. Create a new object and check it's id. George On Sat, Oct

Guidelines for changing the default encoding of a Django site

2010-11-16 Thread George Sakkis
imple. For the sake of the discussion let's ignore the migration of any already stored utf-8 data in the database; I'm mostly interested in what should I be looking for in the Django codebase, as well the database and web server configuration changes if necessary. George [1] http://st

Re: Django Graphics

2010-12-02 Thread George Silva
t; To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- George R. C. Silva Desenvolvimento em GIS http://blog.geoprocessamento.net --

Field.to_python() clarification

2010-04-01 Thread George Sakkis
ts.org/snippets/1478/) use essentially a best-effort approach, "try to decode it and if it fails assume it is already decoded", which is generally error prone. I have a different approach that doesn't use SubfieldBase and expects unconverted values to be passed in to_python(), so I

Re: Is any thing for python like .jar files for java.

2010-04-04 Thread George Cox
on.org/library/zipimport.html gjvc -- George Cox -- 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 djang

Re: insert or update

2007-08-21 Thread George Vilches
Lic. José M. Rodriguez Bacallao wrote: > how can I know programatically if an operation in a model is an insert, > update or delete? > I just want to extend the admin log to log any action in my application > models. Right now, > admin app only log actions executed by itself. Part of your quest

Re: insert or update

2007-08-21 Thread George Vilches
Lic. José M. Rodriguez Bacallao wrote: > how can I vote? There's no official voting mechanism for the non-Django developers right now, it's mostly just based on putting a comment on the Trac ticket or in the mailing list saying that you would use this functionality for such and such a reason.

Re: insert or update

2007-08-21 Thread George Vilches
r_f_d wrote: > As far as insert or update, just overide the save method within the > class. It is something that must be done for each class, but what I > have done (for essentially the same purpose) is override save() on > each model I need to log the action for like so: > > def save(): > #

Re: management.py application commands and one off scripts

2007-08-22 Thread George Vilches
ctory = setup_environ(settings) from django.db.models.loading import get_models loaded_models = get_models() if sys.argv and len(sys.argv) > 1: __import__(sys.argv[1]) else: print 'test_shell.py ' That work for you in the meantime? Should give your script equivalent capabilities

Re: Marty Alchin's AuditTrail

2007-08-22 Thread George Vilches
Kai Kuehne wrote: > Hi, > > On 8/22/07, perrito666 <[EMAIL PROTECTED]> wrote: >> Hello people, i have found a situation where AutidTrail comes very >> handy, but it does not work out of the box on my model, it says here >> http://www.djangoproject.com/weblog/2007/aug/19/djangoroundup/#comments >>

Re: non-event driven method called?

2007-08-23 Thread George Vilches
James Bennett wrote: > On 8/23/07, John Menerick <[EMAIL PROTECTED]> wrote: >> Yeah, I was thinking of running a script in daemon mode, but I would prefer >> to keep the code inside the django instance to keep everything simpler. >> simpler as in the same settings for deployment, less hassle deplo

Audit Trail updates (was Re: Marty Alchin's AuditTrail)

2007-08-27 Thread George Vilches
perrito666 wrote: > Ah thank you, ill keep an eye, so far the only think I did to it was a > small hack to handle the error raised by trying to copy a fk to the > audit table but it is a not very clean hack. > Perrito. Took me an extra couple of days, but I've got all my modifications to AuditTr

Re: Keeping track of the original values for a record...

2007-08-29 Thread George Vilches
Jure Čuhalev wrote: > On 8/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Since there isn't a load() method on a model... I'm thinking I somehow >> have to do this on the manager..but not sure ... any tips would be >> great. >> >> When I load a record, either via get() or by looping throug

Re: 'admin_list' is not a valid tag library

2008-01-29 Thread George Herndon
roject.com/ticket/653#comment:6 George Herndon [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To u

variations in referencing related models

2008-03-06 Thread george . kappel
This seem a little awkward so I want to make sure I am not missing anything in view code list = MyModel.objects.filter(client__description = 'ACME') list = MyModel.objects.select_related().order_by('clients_client.description')) in template code mymodel.client.description The awkward part is

Re: Another installation problem

2008-05-05 Thread George Vilches
Or run Debian testing. Why switch distros or even distro flavors if you don't have to? :) Python 2.5 and most of the packages that are needed for Django are fine straight from apt on testing/unstable. gav Tom Novelli wrote: > Debian Etch is meant to be stable, not up to date (except for secu

Re: Custom management command

2008-05-14 Thread George Vilches
On May 14, 2008, at 5:23 PM, Alex Morega wrote: > > On May 14, 2008, at 23:37 , J. Pablo Fernández wrote: >> I've made a custom management command like this: >> [...] >> but it is not being picked up. ./manage.py help doesn't list it and: >> >> $ ./manage.py import_vortaro >> Unknown command: 'i

Re: Just started the tutorial and already getting Errors.

2008-05-14 Thread George Vilches
Jason Ourscene wrote: > First i had my python issue, got that settled and now in the first > django tutorial I create my poll model and add the def __unicode__ > method and im getting an error. heres the code, and the error: > > Code: http://pastie.textmate.org/197323 > and my error: http://pasti

Re: moving from MySQL to PostgreSQL on a "live" site ..

2008-05-20 Thread George Vilches
Hanne Moa wrote: > I have a filter that makes django's json-dumps more human-readable, by > adding a newline after every occurence of "}},". Running such a filter > first would make for short and snappy lines for the rewriting filter: > > python manage.py dumpdata | prettifyjson | fixbooleans > p

Adding extra fields in the Admin interface

2007-03-26 Thread George Sakkis
t worth the pain ? I find Django's admin interface perhaps its main killer feature and I'd hate to lose it if it turns out it's not extensible enough. George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

Re: Data change history

2007-10-01 Thread George Vilches
his field will then be available in your history and for all of your searching and reporting on the Audit model. I did just write this off the cuff, so let us know if the threadlocals part works out for you. Good luck, George --~--~-~--~~~---~--~~ You received thi

Re: How to keep track of iterations through a for loop in my template?

2007-10-01 Thread George Vilches
Greg wrote: > Hello, > I have a table in my template that will contain an x number of rows > depanding on what I get back from the view. I want my table row > background color to rotate between red and white. As of now, I don't > know how to keep track of each iteration through my for loop to se

Re: Relating model to itself.

2007-10-16 Thread George Vilches
Dmitriy Sodrianov wrote: > Hi to all! > > Can anyone help me, why none of the following code works: > > class Task(models.Model): > parent = models.ForeignKey(Task) > > Try: class Task(models.Model): parent = models.ForeignKey('Task') It will do the lookup lat

QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
want, but without the WHERE clause. This whole thing also has implications on using .select_related(depth=N) parameters. The further you select_related() depth-wise, your count may expand or shrink even more erratically. So, is this a bug? If it isn't, can someone explain the diffe

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
[EMAIL PROTECTED] wrote: > On Wed, Oct 31, 2007 at 11:09:49AM -0400, George Vilches wrote: >> Stated simply: >> queryset.select_related().count() with no filter criteria generates a >> wrong query across a ForeignKey relationship. > > Hi, > > do you ge

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
ed someone more intimate with the Django internals to verify if this is expected behavior. Do you see how my needs still fit within the concept of the ORM? Also, do you see how there's likely still a bug here of some sort? I'm as much interested as isolating th

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
to simplify things with ForeignKeys) just caused people to try to think about the relationships here, and that's not what was really the problem. For that, I apologize. Thanks, George Karen Tracey wrote: > On 10/31/07, *George Vilches* <[EMAIL PROTECTED] > <mailto:[EMAIL PRO

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
jects.select_related().filter(item_group__id__gte=-1).distinct().count() 2L >>> Assembly.objects.select_related().filter(item_group__id__gte=-1).count() 6L Or (I just saw your follow-up e-mail), is all of this a moot point since something like this is going to be made totally invalid

Re: QuerySet.count() inaccurate across ForeignKey relationships

2007-10-31 Thread George Vilches
Karen Tracey wrote: > On 10/31/07, *George Vilches* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Or (I just saw your follow-up e-mail), is all of this a moot point since > something like this is going to be made totally invalid in the future? &g

OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
ere the likely place to go about fixing it is in qs-rf. Or, you can tell us that we're wrong about our assumption that OneToOneFields should be bidirectional, because of XXX, and we'll respect your decisions. You know what's better for Django than us, by far. :) Thanks, George Malco

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
Alright, I guess it's not offlist. Sorry for the extra chatter folks. George Vilches wrote: > (Off-list because this mostly doesn't apply to non qs-rf people) > > Thank you for the clarification on OneToOneFields and required > relationships. We've been working wit

Re: OneToOneField direction? (was Re: QuerySet.count() inaccurate across ForeignKey relationships)

2007-11-01 Thread George Vilches
Karen Tracey wrote: > On 11/1/07, *George Vilches* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > [snip] > > For reporting purposes though, we would like to be able to > .select_related() on User, and get a cached copy of each of the OneToOne

Re: Design Q: Foreign keys from object.values()

2007-01-10 Thread George Davis
Great -- thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECT

Re: Removing SQL From Templates

2007-01-12 Thread George Davis
> I like having access to the models attributes, such as > get_absolute_url, we use things like this quite a bit in our templates You could relatively painlessly 'flatten' the attributes of the model instances in place before rendering template, i.e. spam.get_absolute_url = spam.get_absolute_u

Time delta problem

2006-05-08 Thread George Sakkis
; to '838:59:59' (http://dev.mysql.com/doc/refman/5.0/en/time.html) so that it can represent time intervals greater than 24 hours or even negative. When I run a query on the view through a Django app, I get a ValueError "hour must be in 0..23". Is there a way

Re: Decoupling fields from forms

2006-05-10 Thread George Sakkis
in interface I still want to show > the field as regular DateField widget, not a range; also the backend > knows nothing about how to map a DateRangeField to a table column). Any > ideas on how to decouple the field from its widget(s) ? > > Thanks, > George Given that there were no repl

Property fields

2006-05-12 Thread George Sakkis
Is there a way to combine python properties with Django fields so that one can essentially use both regular (persistent) and callable fields transparently ? If the previous sentence didn't make any sense, here's a simplest example: from django.db.models import Model, IntegerField class Foo(Model

Re: Dilemma: code duplication or complexity?

2006-05-12 Thread George Sakkis
> Hi, > > I'm working on a ticket management system (a la Trac) > for in-house applications for my company. I stopped reading here... why reinvent the (trac)wheel ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: Property fields

2006-05-13 Thread George Sakkis
Malcolm Tredinnick wrote: > On Sat, 2006-05-13 at 01:33 +0000, George Sakkis wrote: > > Is there a way to combine python properties with Django fields so that > > one can essentially use both regular (persistent) and callable fields > > transparently ? If the previous sen

<    1   2   3   4   >