Is it possible to aggregate a field define in an extra method?

2009-10-08 Thread DavidA
I'm trying to understand how to use aggregation with "computed columns", that is, columns that are expressions defined in the extra() method, but it seems these aren't available in downstream parts of the query: class Trans(models.Model): parent = models.ForeignKey('self', null=True,

Re: Unable to delete inline model in admin that contains a FileField (...attribute has no file associated with it)

2009-09-25 Thread DavidA
__unicode__(self): try: return self.document.url except: return u'File deleted' Thanks, -Dave On Sep 25, 10:36 am, Karen Tracey <kmtra...@gmail.com> wrote: > On Fri, Sep 25, 2009 at 9:05 AM, DavidA <david.avraami...@gmail.com> wrote: &g

Unable to delete inline model in admin that contains a FileField (...attribute has no file associated with it)

2009-09-25 Thread DavidA
I'm getting this error when I try to remove an inline model instance in the Django admin: Traceback: File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File

Re: Advice on form to create new object that has foreign key field

2008-12-13 Thread DavidA
The problem is that trade is required so is_valid will fail. On Dec 13, 5:01 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On Dec 13, 9:30 pm, DavidA <david.avraami...@gmail.com> wrote: > > > > > I have two models, Trade and Fill. A Trade can have

Advice on form to create new object that has foreign key field

2008-12-13 Thread DavidA
I have two models, Trade and Fill. A Trade can have many fills. Fill has a FK to Trade: class Trade(models.Model): trade_date = models.DateField(auto_now_add=True, editable=False) side = models.CharField(max_length=12, choices=SIDE_CHOICES) inst = models.ForeignKey(Inst) class

Re: Problem loading custom PostgreSQL function at syncdb time.

2008-12-10 Thread DavidA
This sounds suspiciously similar to the problem I had with initial SQL scripts in MySQL. In my case I was inserting rows into a table and one of the string fields contained %. I had to "escape" the % (using %%). I'm guessing that the SQL isn't directly executed but somehow evaluated in the

Re: Reducing the number of my view's database queries

2008-12-08 Thread DavidA
If I undestand the problem correctly, in MySQL you could do this in one query as: select m.*, (select min(created) from model2 where id = m.model2_id) as first_created, (select max(created) from model2 where id = m.model2_id) as last_created from model1 m ; I don't know how that

Re: Is the initial value of a form field available in the template?

2008-12-01 Thread DavidA
> I think the basic issue is that there are some fields in the object > that I'd like to display but not have editable, and it's not at all > clear to me how to make that happen in the form processor. The values > are dynamic, so they can't be in the template. I often have this need so I created

Re: Flatpage App vs. Static Template

2008-11-21 Thread DavidA
I do something like you are suggesting: I actually write my "flat" pages in Markdown since I prefer it to HTML, and I keep the contents in a file instead of the database, so I can edit them with Emacs. Then I just route these special pages to a trivial template that uses the markdown filter to

Re: MySQL deadlocking issues

2008-11-19 Thread DavidA
kind of DB backend? or did you just add that logic to the > particular view that was giving you trouble? > > Ian > > On Wed, Nov 19, 2008 at 1:40 PM, DavidA <[EMAIL PROTECTED]> wrote: > > > Unrelated to Django, but we occasionally get deadlocks in MySQL due to > &g

Re: MySQL deadlocking issues

2008-11-18 Thread DavidA
Unrelated to Django, but we occasionally get deadlocks in MySQL due to separate tasks running at the same time and accessing some tables in common. We recently added logic to catch the exception, wait a second or two, and retry it a few times before we give up. Most of the time, that fixes it. I

Re: Can I perform calculations directly in django tags/filters?

2008-11-18 Thread DavidA
You can do it in a custom eval-like tag: @register.tag() def evalpy(parser, token): try: tag_name, expression = token.split_contents() except ValueError: raise template.TemplateSyntaxError, "%r tag requires a single argument" %

Re: how can i get the object comments are attached to after post?

2008-11-16 Thread DavidA
>From a quick scan of the source code, I don't think the object is passed into the template, but you can get the related content object directly from the comment (which is passed into the template). Just use the content_object field of the comment like this: {{ comment.content_object.slug }}

Re: Django new comments framework error

2008-11-13 Thread DavidA
I just got bit by this too and it turned out that I had done an install of Django-1.0 on top of an older Django install. In the site- packages directory there was both a django/contrib/comments/urls.py (from 1.0) and a django/contrib/comments/urls/ directory which contained __init__.py and

Re: Django effects Python time/datetime and gives wrong time after DST update

2007-03-12 Thread DavidA
Thanks. I am on trunk, 4227 so I don't have this fix. On Mar 12, 10:53 am, "Ramiro Morales" <[EMAIL PROTECTED]> wrote: > On 3/12/07, DavidA <[EMAIL PROTECTED]> wrote: > > > > > I found a workaround but I'm not sure what the ramifications are. I > > c

Re: Django effects Python time/datetime and gives wrong time after DST update

2007-03-12 Thread DavidA
I found a workaround but I'm not sure what the ramifications are. I commented out this line in django.conf.__init__.py: os.environ['TZ'] = self.TIME_ZONE On Mar 12, 10:19 am, "DavidA" <[EMAIL PROTECTED]> wrote: > I have some scripts that run tasks and use Django DB model

Django effects Python time/datetime and gives wrong time after DST update

2007-03-12 Thread DavidA
I have some scripts that run tasks and use Django DB models. They have been running an hour late today after all the DST changes (here in the US). I've traced it down to any call to Django is shifting my time back an hour (like it was before this weekend's shift). So the time as reported by

Hiring Django/Python Developer

2007-02-06 Thread DavidA
Hi All, I'm the CTO of a medium-sized hedge fund in Greenwich, CT and have been the sole developer for our internal software projects. There's too much on my plate for me to handle by myself and I'm looking to hire a full-time Django/Python developer. I've been an avid reader and occasional

Re: order_by with Foreign Keys

2007-01-12 Thread DavidA
I found this patch which fixes it. I've been using it for a while now: http://code.djangoproject.com/ticket/2210 Honza Král wrote: > this works fine, but if you forget the select_related() it will result > in a cross join which is probably the last thing you want from your > database... > > I

Re: What is the FloatField type returned when accessing the field value ?

2007-01-06 Thread DavidA
Chris, I seem to recall running into this same issue using MySQL on Windows. What version of MySQLdb are you using. If I'm remembering this correctly, I was using an older version of MySQLdb which mapped DB float/numeric fields to str and then I updated it and the newer version mapped them

Re: Why so slow?

2007-01-05 Thread DavidA
Is it possible your Apache server is doing reverse DNS lookups on the GET requests and the lookup is failing for the client machine? I seem to remember older versions of Apache having this on by default. You can turn it off with this in your httpd.conf file. HostnameLookups off Of course,

Re: Types of projects Django is not well suited for?

2006-12-26 Thread DavidA
Saurabh, The other thing I was going to say was that what I really found helpful about Django was the community and how patient and helpful they were. And then I read the other replies to your question. I don't know why everyone is giving you such a hard time. Sure, you could have phrased your

Re: FloatField bug ?

2006-12-26 Thread DavidA
ak wrote: A bit more info: print user.tariff.monthly_fee.__class__, user.balance.__class__, user.tariff.monthly_fee, user.balance, user.tariff.monthly_fee/3 > user.balance displays: 180.00 1846.85 True while 180/3 = 60 which is ofcourse less than 1846.85 so it should display False in the

Re: Types of projects Django is not well suited for?

2006-12-26 Thread DavidA
Saurabh Sawant wrote: How about the types of web applications for which Django is not well suited for? Saurabh, I've been using Django for almost a year now and would have to say its worked very well for most every type of application I've tried with it. To name just a few: - the

Re: "Decimal not JSON serializable"?

2006-12-18 Thread DavidA
JHeasly wrote: > Hello all, > > I'm following the "Serializing Django objects" documentation and have a > view pretty much verbatim from the docs: > > def my_json_view(request): > data = serializers.serialize("json", Location.objects.all()) > return HttpResponse(data,

Re: null ordering in mysql

2006-12-14 Thread DavidA
MC wrote: > Problem: > I order dates and null values in ascending order under MySQL. To my > surprise, null values are listed first, then actual dates. Turns out > that in MySQL, null values are LOWER than non-null values, whereas > Postgresql is the reverse. As outlined here >

Re: ImageField: Unique with number, not underscore?

2006-12-13 Thread DavidA
oliver.lavery wrote: > > class Photo( Model ) > def save( self ): > c = Photo.objects.all().filter( name = self.name ).count() > if c > 0: > self.name += '_' + str( c + 1 ) > Model.save( self ) This won't work as you expect. The first file named 'foo' will be saved

Re: no-database models?

2006-12-04 Thread DavidA
[EMAIL PROTECTED] wrote: > We're driving right past each other on the information > superhighway. > Thanks for your advice, Russ. It still seems to me that a > many-to-many relationship between days and events would be desirable, > for the same reasons that all many-to-many relationships are

Re: Why not Django

2006-12-01 Thread DavidA
Alan Green wrote: > On 12/1/06, James Bennett <[EMAIL PROTECTED]> wrote: > > > Now, does anybody want to talk about Django? > > Yes! > > Is anyone writing financial or money-handling applications in Django? > Any particular issues or "gotchas" the world should know about? Sort of. I work at a

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-01 Thread DavidA
I'd like to see this type of support in the main branch, not separated. It seems that better support for floating point is just a deficiency in Django today and the aggregation need crops up everywhere - not just in scientific applications. My needs for aggregation are simply for reporting: e.g.

Re: Question about select_related and query caching

2006-10-23 Thread DavidA
Michael Radziej wrote: > DavidA: > > > > DavidA wrote: > >> I have some models that look like this > >> > >> class Analyst(models.Model): > >> name = models.CharField(maxlength=20, unique=True) > >> > >> class

Re: Question about select_related and query caching

2006-10-20 Thread DavidA
DavidA wrote: > I have some models that look like this > > class Analyst(models.Model): > name = models.CharField(maxlength=20, unique=True) > > class Strategy(models.Model): > name = models.CharField(maxlength=20) > description = models.CharField(maxl

Re: Alternate colors - when returing a list.

2006-10-20 Thread DavidA
[EMAIL PROTECTED] wrote: > It's really a fine point, and I probably will use cycle next time > something like this rolls around, but I don't like it putting an > unnecessary class in there. > > If I could {% cycle even, "" %} or something, I'd probably be > completely sold. I recently migrated

Question about select_related and query caching

2006-10-20 Thread DavidA
I have some models that look like this class Analyst(models.Model): name = models.CharField(maxlength=20, unique=True) class Strategy(models.Model): name = models.CharField(maxlength=20) description = models.CharField(maxlength=80) class Inst(models.Model): strategy =

Re: getting max and min

2006-10-20 Thread DavidA
Frankie Robertson wrote: > Yes, dropping down is a good thing. You'll never be able to do > everything with django's simple ORM. Raw SQL is a 'good thing', > honest. Once we get SQLAlchemy we can drop to that some of the time > but until then SQL is the way forward. Slightly OT, but... I'm

Re: getting max and min

2006-10-19 Thread DavidA
Russell Keith-Magee wrote: > On 10/19/06, zenx <[EMAIL PROTECTED]> wrote: > > > > I want to get the maximum and the minimum values of various numbers. Is > > the following method the best way to do it? > > The most efficient way would be to use SQL; this way, the min and max > would fall out as

Re: Todo application -- where it is?

2006-10-19 Thread DavidA
Guillermo Fernandez Castellanos wrote: > That's it, thanks! > > G > > On 10/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Here is a link to the Django Powered Sites: > > > > > > http://code.djangoproject.com/wiki/DjangoPoweredSites#Variousapplications > > > > Look for WorkStyle.

Re: sorting QuerySets

2006-10-10 Thread DavidA
Tom Smith wrote: > With about a million records I can't imagine doing it any other way... > > I want to find my top 100 words (by product_count) then sort them > alphabetically to make a tag cloud... > > thanks... If you are only dealing with 100 records after the query, then its not a big

Re: creating models / performance issue

2006-10-04 Thread DavidA
va:patrick.kranzlmueller wrote: > I have a model with blog-postings, assigned to a specific user - the > user is stored in the table "posting" via foreignkey. > > the user is part of a grade, part of a school and part of a state - > all of which have overview-pages. > so, to get all the postings

Referencing the current URL in a view

2006-10-03 Thread DavidA
I have a number of views where function args (parsed from the URL conf) and/or query string arguments are used to filter the results that are displayed in a template. The template includes paging and sorting which need to use a URL that points back to the view using the same arguments, but I'm

Re: Why I'm giving up on Django

2006-09-29 Thread DavidA
[EMAIL PROTECTED] wrote: > > Here's my anecdote on that. > > Even though it was literally staring me in the face, it took me AGES to > discover that the error dump page is actually interactive and has > little sections that expand and collapse. > I kept running into error messages which told me

Re: date format other than YYYY-MM-DD

2006-09-29 Thread DavidA
viestards wrote: > thanks, suppose I have to do it this way. I just hoped to have a > sollution that works in admin pages too. I also ran into this problem so I did it that hard way: I created a custom model DateField and a custom form DateField. (I call them RelaxedModelDateField and

Re: SlugField is not unique?

2006-09-27 Thread DavidA
Gábor Farkas wrote: > hi, > > i've just checked and SlugField does not imply unique=True. > > i somehow always assumed that it does. > > so before i go and add the unique=True to all my SlugFields, > > is there any reason to have non-unique SlugFields? > > as far as i understand, SlugFields are

Re: two models -> one form -> addmanipulator

2006-09-22 Thread DavidA
Ulrich Nitsche wrote: > hi, > > i have two models (tables) concerning user data which belong together. > Now I would like to use one single form to display and edit these > values. > Is there a way to use one changemanipulator to do this? > Or if this is not possible is there a way to use

Re: variable multiple filter question

2006-09-20 Thread DavidA
Luis P. Mendes wrote: > But if he chooses to apply five filters, there will have to be five > filter methods appended, or five key=values pairs as arguments. You can do something like this: from django.db.models import Q def my_view(request): query = Q() for i in range(1, 13):

Re: ChangeManipulator for model with multi-field key (unique_together)

2006-09-18 Thread DavidA
DavidA wrote: > I have a model whose identity is defined by two fields: a foreign key > field and a boolean field. I'm trying to use a ChangeManipulator for it > but am stuck because ChangeManipulator assumes there is a single > primary key field. > > Has anyone run into

ChangeManipulator for model with multi-field key (unique_together)

2006-09-18 Thread DavidA
I have a model whose identity is defined by two fields: a foreign key field and a boolean field. I'm trying to use a ChangeManipulator for it but am stuck because ChangeManipulator assumes there is a single primary key field. Has anyone run into this? Can someone suggest a workaround? Thanks

Re: Comments framework

2006-09-13 Thread DavidA
Guillermo Fernandez Castellanos wrote: > I am thinking of using the comments framework for a project, although > besides the FreeComment there's no real documentation about it that I > have found besides the source. This might help:

Re: Re:

2006-09-11 Thread DavidA
Adam Kelly wrote: > In the view: > rows = zip( *[ ( thing.name, thing.color, thing.weight ) for thing in > object_list ] ) > > In the template: > {% for row in rows %} > > {% for item in row %} > {{item}} > {% endfor %} > > {% endfor %} To generalize this a bit more, you could do: rows =

Re: error with inspectdb using oracle (v0.95)

2006-09-11 Thread DavidA
world_domination_kites wrote: > --- > But then, alas: > --- > Traceback (most recent call last): > File >

Re: Filter question

2006-09-05 Thread DavidA
primitive wrote: > Is it possible to use a string (coming from an request object) as a > keyword to filter? I keep getting errors, but I don't know how to > convert these strings into types that filter will understand. Sure, Python allows you to pass a dict as a set of keyword arguments, so you

Re: Finding entries with multiple tags

2006-08-29 Thread DavidA
[EMAIL PROTECTED] wrote: > That works easily when you're just looking up one Tag. What I'm trying > to figure out is the best way to search for multiple tags and return > only the Posts common to all of those tags: Joe, My bad. I misunderstood your question. I think the only way to do this (in

Re: Finding entries with multiple tags

2006-08-29 Thread DavidA
Gary Wilson wrote: > [EMAIL PROTECTED] wrote: > > > def tags(request, url): > > > # Don't need the last item in the list since it will > > > # always be an empty string since Django will append > > > # a slash character to the end of URLs by default. > > > tags =

Re: viewing generated SQL without running the query

2006-08-29 Thread DavidA
Gary Wilson wrote: > I see that there is a _get_sql_clause() method, but is there a function > that will return the constructed query string? You can just do the same construction that's done in django/db/models/query.py: >>> from danet.blog.models import Post, Tag >>> qs =

Re: FreeComment doesn't work with slugs?

2006-08-24 Thread DavidA
Derek Hoy wrote: > Some of the slug examples use slug as PK. Funnily enough, your blog > example does :) > http://davidavraamides.net/blog/2006/05/11/yet-another-django-blog/ Yes, and that's how I learned about the problem. If you would have stumbled upon this later post, you would have seen

Re: FreeComment doesn't work with slugs?

2006-08-23 Thread DavidA
[EMAIL PROTECTED] wrote: > I've been refactoring some stuff to use slugs, and it looks like > FreeComment needs an object.id > > Is this correct or have I missed something? > > Derek The FreeComment model assumes the primary key of the object it refers to is an integer, so you can't make the

Re: Is this a transaction use case?

2006-08-23 Thread DavidA
[EMAIL PROTECTED] wrote: > Hi all, > > i have the following scenario for a real-estate search engine: > > "Ad" table where i define the properties of the ad such as created_on, > expires_on, user_id and is related with a 1-1 FK to the "Property" > table which defines stuff such as sq_feet,

Re: How to support of alternate date formats for DateField

2006-08-10 Thread DavidA
Steven Armstrong wrote: > On 08/10/06 20:25, DavidA wrote: > > Steven Armstrong wrote: > >> I've had similar problems and solved them like this: > >> > >> myproject/validators.py > >> %<-- > >> from dj

Re: How to support of alternate date formats for DateField

2006-08-10 Thread DavidA
Steven Armstrong wrote: > I've had similar problems and solved them like this: > > myproject/validators.py > %<-- > from django.utils.translation import gettext_lazy as _ > from django.core.validators import * > import re > > my_ansi_date_re = re.compile('put regexp

How to support of alternate date formats for DateField

2006-08-09 Thread DavidA
I'm sure I'm just misunderstanding how manipulators and validators work, but I can't see the right way to do this: I want to support more formats for a DateField then just '-MM-DD' (which is checked in DateField by isValidANSIDate). It seems like I can add *more restrictive* validators but

Re: How to get a subset of records from a subset?

2006-08-08 Thread DavidA
PythonistL wrote: > To explain: > Let's suppose we have a command > > HistoryList=historys.get_list(id__exact='2',order_by=['-PostedDate']) > > that command extracts a few records and from them I would like to use > for further processing all without the first or last record. > How can I do that

Re: Weird slowdown with dev server behind nat

2006-08-02 Thread DavidA
Malcolm Tredinnick wrote: > Um, Dave? The original poster was using the development server. Apache > doesn't get a seat at the table here. :-) Er ... in my best Emily Litella impression: "Never mind" --~--~-~--~~~---~--~~ You received this message because you

Re: Weird slowdown with dev server behind nat

2006-08-02 Thread DavidA
Akatemik wrote: > > In my experience, when you encounter non-obvious but fairly consistant slow > > downs in net traffic, the first thing to check is DNS. > > > > In this case, I'd make sure that each of the DNS cache servers that the > > client > > consults to resolve the address of your

Re: Database API question: I am not able to return a QuerySet

2006-07-31 Thread DavidA
Suriya, You will probably have to do this in custom SQL or using extra(). Your query requires a subselect to get the "current B's" (B's with max(date) for each A). Here's the SQL that I think you need (if I understand the problem correctly): select * from _A join _B on _B.a_id = _A.id where

Re: Syncdb generates non-unique foreign key constraints

2006-07-14 Thread DavidA
As soon as I hit "Post" I realized this should be in django-developers. I'll do that now... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Syncdb generates non-unique foreign key constraints

2006-07-14 Thread DavidA
I've been having a problem rebuilding my database from scratch via syncdb. I've tracked it down to duplicate constraint name. Here is the output from manage.py sql for my app: ALTER TABLE `data_rawinst` ADD CONSTRAINT `inst_id_referencing_data_inst_id` FOREIGN KEY (`inst_id`) REFERENCES

Re: after_acreate after_change

2006-07-05 Thread DavidA
Malcolm Tredinnick wrote: > You've drifted a bit from the original topic here, though, haven't you? Um, yes. Guilty as charged... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Null values in Foreign Keys?

2006-07-04 Thread DavidA
One related question on nullable foreign keys: does the Django ORM always use inner/left joins for select_related() calls? If so, null FKs will cause rows to be excluded from a query so you may have to handle these with direct SQL. Personally, I often create an "unknown" row in a table (and do a

Re: after_acreate after_change

2006-07-04 Thread DavidA
Malcolm Tredinnick wrote: > On Tue, 2006-07-04 at 02:11 +0000, DavidA wrote: > I'm not sure a created() method is going to be the right API, since this > event has very transitory relevance, but your example does suggest we > may need something extra here at some point. I agree

Re: after_acreate after_change

2006-07-03 Thread DavidA
Malcolm Tredinnick wrote: > On Mon, 2006-07-03 at 08:54 -0700, Glenn Tenney wrote: > > Perhaps instead of relying on the behavor of the object's ID not > > existing until it's been created, that should become a method. > > something like Model.created() returning true/flase or Model.is_created >

Re: Checking For Existing Rows

2006-06-27 Thread DavidA
You could just check the count of that many items (since its unique it should always be 1 or 0): if Photo.objects.filter(flickr_id=photo("id")).count() == 0: # create the object ... But its my understanding that Python exceptions are not as heavy weight as they are in languages like

Re: resolve_variable in custom filter

2006-06-23 Thread DavidA
RajeshD wrote: > Don't know if a filter can do what you need. But you could turn this > into a tag instead of a filter: > > {{ highlight search obj.field }} Thanks. That worked nicely. It would be nice, however, if filters had access to the template context so you could do more sophisticated

resolve_variable in custom filter

2006-06-23 Thread DavidA
I'm trying to write a filter that will highlight substrings in text that matched a search pattern. I was hoping to do something like this: {{ obj.field|highlight:search }} where 'search' is a template-context variable that is the string the user was searching for and the highlight filter

Re: Comments: Failed lookup for key [id] in ''

2006-06-22 Thread DavidA
Patrick J. Anderson wrote: > {% load comments.comments %} > > > {% for p in latest %} > {% get_free_comment_count for blog.post object.id as comment_count > What could be the reason for failed lookup on key[id]? Shouldn't that be 'p.id' rather than 'object.id' in the

Re: MS SQL Django suport is stable?

2006-06-21 Thread DavidA
mamcxyz, I've had pretty good luck with Fedora Core 4. Here are my (terse) notes from setting up Django and my blog on FC4 a couple of weeks ago. Note that FC4 already had MySQL 4.1.x and Python 2.4.1 and Apache 2.0.54 (with mod_python) so I just went with them. On Windows I use MySQL 5 but I

Re: hello & question (sorting related cmodels)

2006-06-13 Thread DavidA
Bram, You can add this to your model: class Meta: ordering = ('name',) Here is the documentation: http://www.djangoproject.com/documentation/models/ordering/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: A little help with a filter

2006-06-01 Thread DavidA
Chris, If I understand your problem, its that you want to do an "and" across multiple rows, which is not a simple query (and I'm not sure how to do in the model API). To be more clear, your Sub_Item table relates through a many-to-many relationship to ObjectItem so the SQL to get all Sub_Items

Re: Wiki or Blogs done with django

2006-06-01 Thread DavidA
Jarek Zgoda wrote: > I second that. Actual code may vary, but domain model (and its > representation as Django data model) would remain constant, as long as > software will be performing similar tasks. Well, maybe. I think its really hard in any real application to have a one-size-fits-all data

Re: Django and daemon?

2006-05-31 Thread DavidA
Russell Blau wrote: > Ahh, thanks, it always helps to take the blinders off. The only downside is > that I have to learn how to use yet another software package. ;-) An alternative that stays inside Django is to setup a trigger in cron (or NT's Task Scheduler) that gets a URL every few

Re: What server configuration to use

2006-05-26 Thread DavidA
I'm running my Django blog (http://davidavraamides.net) on Fedora under VMWare GSX 3.1. I have it configured for 256M (the physical box has 1GB). There is another Fedora guest running phpBB similarly configured. My typical load across all VMs is about 3%. It works great. Both are running Apache +

Re: views

2006-05-26 Thread DavidA
Mary, If I'm understanding you correctly you can simply use the 'values' method of the DB-API to query the value of the field for all rows: >>> from danet.blog.models import Post >>> Post.objects.values('slug') [{'slug': 'yet-another-django-blog'}, {'slug': 'fun-at-home-and-zoes-first-birth

Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)

2006-05-25 Thread DavidA
> Ok. So if work, what reason you have for ditch it for Apache? There were really four reasons I moved from IIS to Apache: 1) Virtual hosting: although you _can_ do virtual hosting on IIS, you really need IIS6 on Win2k3 to support the host header fields. The default IIS on XP Pro doesn't allow

Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)

2006-05-25 Thread DavidA
I should have clarified: I use Apache2 on Windows (and Linux for that matter). As Ian pointed out, Apache2 is multi-threaded and works very well on both Linux and Windows. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: I need instructions in best way to use django under IIS shared hosting (Python is installed)

2006-05-25 Thread DavidA
I've used Python with IIS for the MoinMoin wiki (where do they get these names?). They have a good doc on configuring IIS for Python: http://moinmoin.wikiwikiweb.de/HelpOnInstalling/InternetInformationServer#head-890abdbd0d21bf874ce794be87067abf433a51d7 I've done it. It works fine. And then I

Re: There is no v0.92 or v0.95 release of Django

2006-05-17 Thread DavidA
I just googled: django 0.95 site:www.djangoproject.com and found one other thing that could be potentially confusing: http://www.djangoproject.com/documentation/tutorial1/ The sample output under "The development server" section shows: Django version 0.95 (post-magic-removal). Of course, that

Re: DSN useful for database settings?

2006-05-09 Thread DavidA
Can't you just accomplish the same goal by adding a couple of lines to your settings file? Assuming you had an environ variable DSN set like this: DSN=ENGINE=mysql;NAME=data;USER=root;PASSWORD=redpill;HOST=localhost then add: import os dsn = dict([kv.split('=') for kv in

Re: Tutorial for MR

2006-05-04 Thread DavidA
But for every model? Sounds a little kludgy to have to add that to every model just to break them into separate files. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Bug in django/contrib/admin/templatetags/admin_list.py

2006-04-14 Thread DavidA
If you use a FloatField in the admin list_display, you get an error rendering the template from line 160 in admin_list.py (TypeError, float argument required) 158.elif isinstance(f, models.FloatField): 159.if field_val is not None: 160.result_repr

Re: Importing external modules/classes

2006-04-14 Thread DavidA
Hi Cary, What I did to avoid all the PYTHONPATH stuff was to just 'install' my python library using distutils. I set up a trivial setup.py script and then I just run 'python setup.py install' for my library whenever I make changes. from distutils.core import setup setup(name='pf',

Understanding FloatFields

2006-04-13 Thread DavidA
I'm a little confused about FloatFields and I was hoping someone could shed some light. They seem to be represented in the DB as 'numeric' but exist in Python as strings: class FundCapital(models.Model): fund = models.ForeignKey(Fund) date = models.DateField() capital =

Re: Problem with threads accessing MySQL database

2006-04-12 Thread DavidA
Hi kopikopiko, I thought I'd chime in on how I'm solving a similar problem. I also have a task scheduling app written in Django, but I actually run the tasks through Django rather than outside of it: I have a special view (/tasks/trigger) which remembers the last time the view ran and checks for

Error in saferef.py?

2006-04-08 Thread DavidA
I just switched to the m-r branch and am seeing this error very frequently: Exception exceptions.AttributeError: "'NoneType' object has no attribute 'print_exc'" in ignored >From a search of the code, it appears to be line 113 in django/dispatch/saferef.py. However, I'm unsure if its an error

Re: Advice on using model to bulk/batch load database

2006-03-23 Thread DavidA
Eric, The typical mode of operation will be to incrementally load new data each night - about 10 files each containing dozens to hundreds of rows. Maybe only a couple will be in the thousands category. But I've also created my scripts to work in two steps: 1) download the data from various

Re: Help getting admin and non-admin app running in Apache

2006-03-23 Thread DavidA
That still leaves my Django apps running in the same space (PythonInterpreter) as the admin app which I think is the root of the problem. I've tried using a separate for "/" and "/admin/" but that didn't work. I don't see how its possible to separate my non-admin apps from the admin app since

Re: Advice on using model to bulk/batch load database

2006-03-23 Thread DavidA
> BTW, if you do this repeatedly and format of those flat files is not a > requirement it is possible to have all initial data in a form of SQL > script. If you place it in /sql/.sql then Django will > include it in 'sqlall' command right after DB creation. While I'm not in control of the file

Re: Advice on using model to bulk/batch load database

2006-03-23 Thread DavidA
> You can set the environment variable at the top of your scripts by > importing the Python os module, just like you can import sys and set > sys.path. Thanks, I added this and it works fine: os.environ['DJANGO_SETTINGS_MODULE'] = 'data.settings' > The Python datetime and time modules are huge

Advice on using model to bulk/batch load database

2006-03-22 Thread DavidA
I am prepopulating my database with data from a number of flat files. I've written a small script to do this using my model class. While this works, there are a couple of kludges I made to get it to work and I was hoping someone could advise my on a better way to do this. First, to use the model

Help getting admin and non-admin app running in Apache

2006-03-22 Thread DavidA
I've read this documentation: http://www.djangoproject.com/documentation/modpython/ but I can't figure out how to configure the VirtualHost section to get the URLs I want. Here's what I'm trying to do: I have one Django project (data) with two apps under it (trades, marks). I also have the admin

Re: Question about inspectdb output

2006-03-01 Thread DavidA
I found the cause of this magic "multiply by 3" but I don't understand it well enough to offer a solution. In the mysql backend, there is this clause (lines 69-70 in DatabaseWrapper.cursor): if self.connection.get_server_info() >= '4.1': cursor.execute("SET NAMES utf8")

Re: Django in a Load-Balanced environment (ORM issues) ...

2006-03-01 Thread DavidA
I just want to echo Peter and Ivan's sentiments on NOT making this default behavior. What attracted me to Django was a simple, fast, elegant framework for quickly building common types of web applications. I've wandered into the tarpits of J2EE in my past life and I was looking for something at

  1   2   >