Re: Extend a QuerySet

2007-05-08 Thread Tim Chase
>>> I want to search some entrys in a database. These entrys have a name >>> and a discription. At first I want to find all entrys whose names >>> start with the search query, at second i want to find all entrys whose >>> name contains the search query and then I want to have the entrys with >>> t

Re: INSTALLED_APPS dependency tracking

2007-05-05 Thread Tim Chase
> This looks interesting, and there was some discussion of something > similar for django (quite a while ago: [1]). Could you create a ticket > at code.djangoproject.com with a brief overview of how you did this, > to stimulate further discussion? Ticket #4224 created with a fair bit of rambling

INSTALLED_APPS dependency tracking

2007-05-04 Thread Tim Chase
I had a want for some simple dependency tracking in the INSTALLED_APPS of my settings.py, so I cranked out the code below. I don't know if it would help anybody else, but I wanted to be able to specify via the DEPENDENCIES that proj.app2 depended on app3, app4, and app6, and so on. That way, I c

Re: Case Sensitivity on MySQL searches

2007-05-04 Thread Tim Chase
>> It might even be as simple as tweaking the >> db/backends/mysql/base.py and changing the entry in the >> OPERATOR_MAPPING value from >> >>'exact': '= %s', >> >> to >> >>'exact': 'LIKE BINARY %s', > > This is exactly what "contains" does. Example:- > > Entry.objects.get(headline__contai

Re: Making list of M2M field in object's __str__

2007-05-04 Thread Tim Chase
def __str__(self): return "%s (%s)" % ( self.title, '/'.join(self.artists) ) This assumes that an Artist has a __str__ method as well. If not, you could change that one line to '/'.join([artist.name for artist in self.artists

Re: Django Diagram

2007-05-03 Thread Tim Chase
> I'm teaching my son Django and came up with a diagram > for him - you know what they say - a picture is worth a > thousand words. > > The diagram is at http://zdecisions.com/zdmedia/img/django.jpg > > Any comments or suggestions for making it better? Handy. I'm not sure how I'd change it exa

Re: Making list of M2M field in object's __str__

2007-05-03 Thread Tim Chase
>>def __str__(self): >> return "%s (%s)" % ( >>self.title, >>'/'.join(self.artists) >>) >> >> This assumes that an Artist has a __str__ method as well. If >> not, you could change that one line to >> >>'/'.join([artist.name for artist in self.artists]) > > I

Re: Making list of M2M field in object's __str__

2007-05-03 Thread Tim Chase
> class Artist(models.Model): > name = models.CharField(maxlength=100) > > class Song(models.Model): > title = models.CharField(maxlength=100) > artists = models.ManyToManyField(Artist) > > > I would like to join the artists that are related to a > particular song into a string (com

Re: Django for complex websites

2007-05-01 Thread Tim Chase
> they're different objects. Very simple. If you need to build a sitemap > or menu or breadcrumbs, you can travel the objects tree and build it. > You can attach a new page (section) with arbitrary functionality to > any node of the site tree with no effort. > > On the other hand, Django uses ORM

Re: Case Sensitivity on MySQL searches

2007-05-01 Thread Tim Chase
> Having read in other posts about MySQL being case insensitive by > default, I have tried using the __exact method to force exact > matching, however, this still finds the alternative case version in > the table. Note there are no duplicates in the table on this field. > > Example: > x=Datatabl

Re: Friendship_type on symmetrical M2M

2007-04-28 Thread Tim Chase
> be quick and easy. If Joe adds Murray as a friend, and > uses the pre- filled description "We worked together" when > adding him, Murray simply wants to be able to press > "Confirm", and the relationship is set up on both their > profiles. This is where the symmetrical M2M is really > handy - it

Re: Friendship_type on symmetrical M2M

2007-04-28 Thread Tim Chase
> I'm sorry, but the problem with it is that it isn't symmetrical. > > A part of my Profile-model looks like this: > class Profile(models.Model): > user = models.ForeignKey(User) > friends = models.ManyToManyField("self") > > This makes it very easy to create and maintain a relationship

Re: Friendship_type on symmetrical M2M

2007-04-28 Thread Tim Chase
> Scenario: User A goes to User B's profile. User A know User B, > so User A adds User B as his friend. He then specifies their > friendship as "Colleagues". > > How can I make this work? I have extended the User-model to > include a friends-field (ManyToManyField("self")), but I have > no idea h

Re: Comparing dates

2007-04-26 Thread Tim Chase
> today = datetime.date.today() > context[self.varname] = GpUser.objects.filter(birthday=today) > > The problem is, that will never evaluate to true, because I still have > today's year. So, how does one throw out the year and just compare > month and day? Well, the Django ORM handles something

Re: Django newbie: lost in custom managers

2007-04-24 Thread Tim Chase
> cursor.execute(""" > SELECT sports_players.city_id, sports_players.team_id, > count(sports_players.team_id) FROM sports_players, > sports_mastercitylist > WHERE sports_players.city_id=sports_mastercitylist.id > AND sports_mastercitylist.cityslug = %s >

Re: Help with queryset

2007-04-24 Thread Tim Chase
> I have queryset=Year.objects.all() > > But I want to limit that years in which event is not Null. > > I'm assuming I want something like Year.objects.filter(event != Null) I presume you mean Year.objects.filter(event__isnull = False) which you can read about at http://djangoproject.com

Re: Application Developer Job Posting - TBO.com

2007-04-23 Thread Tim Chase
>> If you like to build data-driven web applications on deadline, TBO.com >> may be the place for you. We are looking for a developer to design, >> build, and maintain key web applications. > > So this is a fairly good advertisement, except for one thing: it doesn't > say where in the world you a

Re: audit trail support

2007-04-21 Thread Tim Chase
> I will be working on this project as part of my Real Job(tm), > so devoting time to it should not be a problem. However, > before I begin coding, I want the community's input on a few > issues. > > What is the right way, at DB level, to implement the audit > trail? I had two ideas: Todd Schr

Re: Django Urls object_id/xxxxxx/object_id

2007-04-20 Thread Tim Chase
> (r'^team/(?P[0-9]+)/results/(?P[0-9]+)/$', > 'django.views.generic.list_detail.object_detail', dict(results_dict, > template_name='teams/team_results_reports.html')), > > the bottom Url is totally wrong I just had a stab in the dark (a > rather poor one at that) but it was attempting to il

Re: [OT] Vim (was "Poll tutorial question")

2007-04-19 Thread Tim Chase
>> Well, whitespaces in Python are pretty difficult to keep in >> line, if you are used to other languages. I personally use >> Tabs for intending and VIM editor and have it to make Tabs >> visible like dark blue |--, > > Hey, do you mind sharing your .vimrc for that, probably best > on dpast

Re: Best practices for large volumes of data?

2007-04-19 Thread Tim Chase
>> (with several hundred clients, drilldown >> would be nice). > > Indeed. I think you may want to look a the newforms-admin branch. I > think the most natural would be to add auto-complete filters and > multiple applied filters. > Also, perhaps data_hierarchy will help in the short term: > htt

Re: django comparison

2007-04-19 Thread Tim Chase
>> Have you looked at trunk/django/contrib/databrowse yet? :) > > Wow, I don't update since 49xx, lo and behold, there's a new module > in contrib! Just briefly looking over it, it looks like it wraps > models for some black magic data browsing? And what's this? A plugin > hook? :) This was

Best practices for large volumes of data?

2007-04-19 Thread Tim Chase
I've been struggling with getting Django's defaults to play nicely with our rather large data-sets. For small data-sets, Django works like a charm. However, our company manages around tens of thousands of phones for other companies (and then there's the call-detail for many of those accounts

Re: Navigating the Documentation

2007-04-18 Thread Tim Chase
> Am I the only one who has a hellish time trying to navigate > Django's online documentation? (here: > http://www.djangoproject.com/documentation/) Yes, I too have had difficulties, though I find the following link: http://www.google.com/search?q=%s%20%28site%3Adjangoproject.com%20OR%20site%3A

Re: HTTP faking

2007-04-12 Thread Tim Chase
>> Yes, I can see that, but PUT is idempotent, while POST >> isn't. It seems to me that treating one verb as another >> will at least make HTTP caching odd. > > None of PUT/POST/DELETE are cacheable (with the exception of > POST with Expires or Cache-Control headers)... so I don't know > that yo

Re: Dynamic Model Fields

2007-04-11 Thread Tim Chase
> Actually the labs where just an example: one laboratory will > have one installation of the application, and the dynamic > fields will only apply within the scope of this installation. > There's no such thing as consistency accross labs. It still sounds like the above scheme would do the trick.

Re: Dynamic Model Fields

2007-04-11 Thread Tim Chase
> I'm in the process of turning telemeta [1] into a django > application, and need dynamic model fields: we want to allow > site administrators to easily add/remove "fields" to our main > data structure, the MediaItem, which represents an audio/video > resource. > > Example: for a given research

Re: Detect ajax request

2007-04-10 Thread Tim Chase
> Is there a standard way to detect if a request was an ajax one? I > know I could append a key to the ajax request like in Mr. Bennett's > post here: > > http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1 > > ie http://website.com/some/request/?xhr and in my view, d

Re: Screen resolution

2007-04-07 Thread Tim Chase
> For my Django application I need to detect user's screen resolution. > So, I have the script in Javascript > > function resolution() > { > var winX = screen.width; > var winY = screen.height; > > } > I call the script like this > > > This script finds the resolution but I need to pass the sc

Re: Any books available

2007-04-05 Thread Tim Chase
> Looking for books on django. Online: www.djangobook.com Published: none To be published: http://www.amazon.com/Pro-Django-Development-Done-Right/dp/1590597257/ (by a bunch of chumps who know nothing about Django ;-) ...like a book on Linux by that Torvalds guy. Or a book on Python by that

Re: development server

2007-03-29 Thread Tim Chase
> The terminal being scrambled part of the story is strange. It sounds > like your terminal settings are a bit screwy, but it's always hard to > diagnose that. One thing you could try to debug this is to redirect > stdout and stderr to a file when you start manage.py, then you/we > could have a

Re: relative "extends" syntax in templates?

2007-03-28 Thread Tim Chase
>> app/templates/{various top-level templates} >> app/templates/help/help_base.html >> app/templates/help/particular_help.html >> >> In particular_help.html I have to use >> >> {% extends "help/help_base.html" %} >> >> rather than a relative >> >> {% extends "help_base.html" %} > > Having a q

relative "extends" syntax in templates?

2007-03-27 Thread Tim Chase
I have a directory structure like app/templates/{various top-level templates} app/templates/help/help_base.html app/templates/help/particular_help.html In particular_help.html I have to use {% extends "help/help_base.html" %} rather than a relative {% extends "help_base.html" %} Is there

Re: Forms vs. Models: Redundant?

2007-03-27 Thread Tim Chase
> The form_for_model and form_for_instance functions, which Tim Chase > mentioned earlier in this thread, are not yet documented (or 100% > complete). Ouch...no wonder they're not documented yet ;) Glad I haven't had any fiascoes. I guess I would deserve any abuse Django ga

Re: Forms vs. Models: Redundant?

2007-03-27 Thread Tim Chase
>> django.newforms.models.form_for_model >> django.newforms.models.form_for_instance > > Is there a example use for this somewhere? I am new ... You can find some demo code at http://www.djangosnippets.org/tags/form_for_model/ And as always, it's just Python, so you can read the code in django

Re: Forms vs. Models: Redundant?

2007-03-27 Thread Tim Chase
> Why can't a form be instantiated automatically when passed a > model (maybe with flags for which fields are enabled)? Or > better yet, bind the form to a model (or model instance), You mean like: django.newforms.models.form_for_model django.newforms.models.form_for_instance I'm not sure where

Re: sql log

2007-03-26 Thread Tim Chase
> In [3]: from django.db import connection > > In [4]: connection.queries > Out[4]: [] > > I tried a couple of page reloads, stuff I know is querying the > database, still nothing. > > Any idea what I'm doing wrong? The connection.queries is only available within a session/transaction. Thus,

Re: Application for Google Summer of Code

2007-03-23 Thread Tim Chase
> I've started to write an application for Google Summer of > Code, and I would LOVE any feedback you can possibly give me. > Please comment on both language and content. I guess my first concern/interest/question would be "what makes your proposal different from {{revision_control_system}}?" Si

Re: 404 Error custumization

2007-03-23 Thread Tim Chase
> Thanks, it solves the problem partially. > When I put 404.html in the templates root, I still cannot to pass > request object information to the template: > > in django/views/defaults.py: > def page_not_found(request, template_name='404.html'): > t = loader.get_template(template_name) >

Re: A custom label on a newforms Field doesn't get passed trought pretty_name

2007-03-19 Thread Tim Chase
> class MyForm(forms.Form): > field1 = forms.CharField(max_length=100) > field2 = forms.Charfield(max_length=100, label='custom field') > > When I render the field, the label for field1 get his first character > uppercased and becomes "Field1", the label for field2 was set by the > labe

Re: Using custom methods in queryset lookups

2007-03-19 Thread Tim Chase
> Now, I want to select all records whose duration (end_time - > start_time) is more than 2 hours. > > I tried a custom method in the model like this which returns the > duration but cannot figure out how to use it in queryset filters. Filtering by calculated fields is best done on the server si

Re: Preventing Multiple Logins

2007-03-16 Thread Tim Chase
> I would like to find a way to prevent users from simultaniously > logging in from different computers but using the same username and > password. How do you define "different computers"? A remote IP address, possibly cookies, and possibly JavaScript are about all you have to work with to dete

Re: Injecting a custom INNER JOIN tbl ON clause

2007-03-15 Thread Tim Chase
>> ... INNER JOIN tblBig b ON >> (b.other_id = other.id AND >> b.foo = 42 AND >> b.bar = 'zip' >> ) >> >> the cartesian product makes the join huge. I've performance >> tested the resulting queries at the psql prompt, and the above >> version runs in under 2 seconds. D

Re: transactions and unique variables: #2

2007-03-15 Thread Tim Chase
> Uhm, please ignore this email, it looks like this can't be done using > transactions > > begin transaction; > update book set "order"=2 where id=1; > update book set "order"=1 where id=2; > commit; > > ERROR: duplicate key violates unique constraint "book_order_key" Alternatively, if you wan

Re: transactions and unique variables:

2007-03-15 Thread Tim Chase
> Uhm, please ignore this email, it looks like this can't be done using > transactions > > begin transaction; > update book set "order"=2 where id=1; > update book set "order"=1 where id=2; > commit; for atomic swapping, however, it can be done in a single obscure SQL statement: update boo

Injecting a custom INNER JOIN tbl ON clause

2007-03-15 Thread Tim Chase
I'm trying to inject a table into my query, but need to do an INNER JOIN with a custom ON clause. This is due to the volumes of data in the joined table. Without being able to do something like ... INNER JOIN tblBig b ON (b.other_id = other.id AND b.foo = 42 AND

Re: DATE FORMAT ISSUE AGAIN.

2007-03-14 Thread Tim Chase
> Thanks for that TIM A LOT glad to help > But stuck again > > AttributeError at /registration/ > 'FormFieldWrapper' object has no attribute 'month' Well, somewhere in your code, you're asking for the "month" attribute of an object. And that object doesn't have a "month" property, so it rai

Re: DATE FORMAT ISSUE AGAIN.

2007-03-14 Thread Tim Chase
> Case is this > XXX | date "F J Y" > > It should read in the format that i choosen but instead of this gives > this error > TemplateSyntaxError at /mypage/ > Could not parse the remainder: | date "F J Y" I've been bitten by this one several times. I haven't seen any notes to the effect, b

Re: newb: Django & CountingDown

2007-03-14 Thread Tim Chase
> I have an app that is for online test taking. Most online test > are 30 mins to 2hrs. I need to create count down clock from > when the test is stared. If 30 mins test, then count down will > start from 30 mins : 00 Secs, 29 min: 59 secs and so on. How > do I do this? In a word: unreliably.

Re: Implementing an 'extent' query

2007-03-13 Thread Tim Chase
> Instances of Place will be stored in one table, and instances > of Restaurant will be stored in another table. How would I go > about implementing an efficient 'extent' query: a QuerySet > which would give me an instance of Place for each row in > **both** tables? (Or instances of Place or Resta

Re: Multi-tenant database

2007-03-12 Thread Tim Chase
> Is Django suitable for multi-tenant database application? i.e. > combining username and company_id as primary key You omit some key details: -are the tenants writing data, or just reading data? If they're just reading data, you can jockey your views based on the tenant. We're currently doin

Re: Chaining ManyToMany Filters Update

2007-03-12 Thread Tim Chase
> > >[56]:cs.filter(default_recipe__ingredients__ingredient__id=3).filter(default_recipe__ingredients__ingredient__id=1) >> Out[56]:[] > This would map to a Query that looks like this "... WHERE id=3 AND > id=1". that would most certainly return no results. Unless those ingredients were qbits

Re: Use images and css in templates

2007-03-08 Thread Tim Chase
> After I run : python manage.py runserver and browse my blog, it seems > that it can't read my images and css. I am not using apache because I > am developing my blog using my personal pc (Windows XP) > > Here is my urls.py: > > from django.conf.urls.defaults import * > > urlpatterns = pattern

Re: Runserver Hanging

2007-03-05 Thread Tim Chase
> To expand on this, sometimes the pages load as they would on our live > environment, but it randomly (and happens most of the time) hangs to > where it takes up to a couple minutes to load a page. If you disable CSS (or expand all of the collapsed sections of the traceback), are you getting a

Re: how to get all the objects in one model that are not foreign keys in another

2007-03-05 Thread Tim Chase
> I have two models: > > Child(models.Model): > name = CharField > > > Sponsorship(models.Model): > name = CharField > child = ForeignKey(Child) > ... > > how do i get a list of all children who are not in Sponsorship? AFAIK, for any sort of efficiency,

Re: DateField

2007-03-02 Thread Tim Chase
> In my models I use DateField quite a few times, is there any > way I can adjust it so it stores information in the database > as dd/mm/yy and retrieves/handles it in this way too rather > then its current -mm- dd format? I'm not sure this question makes a whole lot of sense without some cla

Preventing tracebacks from pulling back gobs of data

2007-03-01 Thread Tim Chase
I've encountered an odd problem that I'm hoping someone out there has encountered and can offer tips. I've got a fairly gargantuan database of phone information (my company manages cell-phone accounts for other companies). However, when I try to troubleshoot my views/templates, the tracebacks

Re: un-broken order_by (was "Upcoming Django release, and the future")

2007-02-26 Thread Tim Chase
> #app_list = > camp.application_set.filter(year=year_filter).order_by('camps_application__c > adet.sqn.wing.name') > > You can see where I've commented-out what I wanted to do. The commented-out > version gives : > Exception Type: OperationalError > Exception Value: (1054, "Unknow

Re: Upcoming Django release, and the future

2007-02-26 Thread Tim Chase
>> I've been using 0.95 for a few months now, and the one thing that is really >> annoying is using foreign keys in filter() and order_by() statements. Not >> sure about a bug # (I will see if I can find one), but I always seem to end >> up with errors about unknown table names, and end up having

Re: Aggregate class: a first-attempt

2007-02-23 Thread Tim Chase
>> items.aggregate((,), sum=( >> 'field1', >> 'field2', >> ... >> 'field20', >> 'field21', >> ), average=( >> 'field1', >> 'field2', >> ... >> 'field20', >> 'field21', >> )) > > well, in this extreme example, I would

Re: Aggregate class: a first-attempt

2007-02-23 Thread Tim Chase
>> quseryset = Model.objects.all() >> queryset.aggregate( ( 'name', 'city' ), sum=( 'pay', >>> 'some_other_field' ), avg=( 'pay', 'age' ), count=True ) >> I like this calling interface as an alternate method for its >> fine-tuned control, but there are times it would be nice to not >> have

Re: Aggregate class: a first-attempt

2007-02-22 Thread Tim Chase
>> I haven't yet figured out a way to suppress the order_by portion, >> so what's currently in there is an ugly hack. But it would need >> to prevent the standard methods from inserting an ORDER BY clause >> against a non-aggregated field. > > if you add an empty call (no parameters) to order_by

Aggregate class: a first-attempt

2007-02-22 Thread Tim Chase
Below I've pasted my first attempt at an aggregate function class. Its __init__ takes a queryset (and an optional list of aggregate functions to perform if, say, you only want the "sum"s rather than min/max/avg/sum). Thus you should be able to do things like >>>class Foo(Model): ... blah

Re: Postgre and mysql

2007-02-21 Thread Tim Chase
> Hello, I want to know which of these two databases are prefered by > django. I can choose and I'd like to know if there is some differences > in performance or integration (like foreign keys). http://www.djangoproject.com/documentation/faq/#what-are-django-s-prerequisites "PostgreSQL is recomm

Aggregate stats for recordsets...best practices?

2007-02-15 Thread Tim Chase
For reporting purposes, we're hoping to summarize a variety of fields across volumes of data. I know recordsets currently have a count() method that returns the number of rows. However, I'm trying to find a good way of obtaining max/min/sum/avg results for all the items in the recordset. I

Re: Django Cheat Sheet

2007-02-13 Thread Tim Chase
> a Django cheat sheet: > > > > We've spent a fair bit of time on it and would really appreciate the > following: > > 1. That you download it; try it out and enjoy it! Good stuff. Had to squish it from A4 to 8.5x11 (rolls eyes at

Doing "in" subqueries on the server-side

2007-02-10 Thread Tim Chase
For an app I've been assembling, I need to filter a particular data-set based on multiple many-to-many criteria where the criteria span multiple records in the far participant of the M2M. The basics are the recordset (Items) and each Item has a M2M relationship with Properties (a key/value pair)

Easy way to determine runtime environment?

2007-02-09 Thread Tim Chase
I'm trying to find an easy way to check what the current runtime environment is. I deploy to mod_python, but do development against runserver. I'd like my settings.py file to tweak the media settings based on whether I'm using mod_python (in which case, it should use the ones I have working ther

Using re.VERBOSE with urls.py?

2007-02-08 Thread Tim Chase
This may have a simple answer that I've overlooked. Is there a way to specify that the regexps used for mapping URLs in urls.py are in re.VERBOSE format rather than all in one line? I have several pieces that are easily recognizable when specified as VERBOSE, but when given in one line, it be

Re: Comparing datetime

2007-02-07 Thread Tim Chase
> date is coming up, say two weeks away. So, how would I say something > like > > if sponsor.period_end < now + 2 weeks: > > Or, alternately, just filter: > Sponsor.objects.filter(period_end__gte=datetime.datetime.now() + 2 > weeks) My first thought would be to try comparing your value to: da

OT: DFW Python and the real Django

2007-01-26 Thread Tim Chase
As Django got its name from Django Reinhardt, I thought I'd mention for fans. Not only is PyCon being held in Dallas, TX, but this weekend there's a Django Reinhardt festival in Ft. Worth just a short distance (by Texas standards...about 20-30 minutes) from Dallas. So if you're a local Pytho

Re: Database Error Handling

2007-01-24 Thread Tim Chase
> The other would be to catch the database error and then validate > again. But in the meantime, something else could have happened, so > you end up with a structure like this: > > for i in range(settings.RETRIES) > ... validate ... > try: > ... save ... > break > except ... > ..

Re: Database API blind spot

2007-01-22 Thread Tim Chase
> SELECT * FROM camps where id in (SELECT DISTINCT camp_id FROM application); Computing the DISTINCT portion here may be superfluous, and possibly (depending on your DB) a premature mis-optimization. Whether DISTINCT or not, membership via IN will still behave the same, but DISTINCT will requi

Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread Tim Chase
Django support only server side validation. Dose it support validation on Client Side? I would like to push it on client, to keep my server load light. Well, through JavaScript, you can do *both* server-side and client-side validation. However, not everybody flies with JS enabled (speaking

Re: manipulating the value before save()

2007-01-14 Thread Tim Chase
I think you're looking for the save-and-delete hooks: http://www.djangoproject.com/documentation/models/save_delete_hooks/ They will allow you to make the changes before the object is saved without overriding django's own internal save functionality. If I understand this correctly, it's for

manipulating the value before save()

2007-01-13 Thread Tim Chase
I'm trying to make a RelaxedPhoneNumber field that normalizes user input to an internal representation of purely digits before getting saved, and then presents in a particular format. I'm having trouble finding where to intercept and change the value. I want to do it on the field level, as I

Re: Running Django on OpenBSD...best practices?

2007-01-11 Thread Tim Chase
>> Any suggestions for which direction I should pursue? (Building >> Apache2 + building mod_python) Options I haven't uncovered? > > > I went this route under OpenBSD 3.9 and have had very few issues. The most > trouble I had was with getting mod_python to compile correctly, mostly > related

Running Django on OpenBSD...best practices?

2007-01-09 Thread Tim Chase
I'm setting up an OpenBSD server and would like to start testing some projects using Django. Are there any bits of sage advice that could be given? At this point, I'm not tied to anything else (Apache vs. Lighttpd; mod_python vs. WSGI; etc). Some of the speedbumps that I've come across in my

Re: Switching branches (was "Schema Evolution code")

2006-12-14 Thread Tim Chase
>> Are there any "best practices" tips for swapping among them for >> testing/experimenting? Preferably without causing /too/ much >> damage. :) > > Hey Tim, > > I've added some more instructions to the "Using branches" part of our > documentation. Let me know if this helps. > > http://www.dja

Re: Switching branches (was "Schema Evolution code")

2006-12-14 Thread Tim Chase
> If you don't use Schema Evolution, you shouldn't be affected." > > I'd really like to try it, but I don't have time to keep up to date with > two branches. Early on, I naively just did the generic install of Django which put it in the usual system-wide place. Now I'd like to toy with both th

Re: Retrieve Password

2006-11-29 Thread Tim Chase
> I need to send the password to the user(email), but how recover the raw > password once the database stores in this format: > > hashType$salt$hash > sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968 Hashing is generally a one-way process (like making hamburger out of cow) that prevents f

Re: Returning an average from a Related Field.

2006-10-16 Thread Tim Chase
> Any suggestions on how would you get the server to calculate > and return the average? Though I believe someone else already answered this, Django allows you to fire off live SQL queries, which can do things like SELECT AVERAGE(column_name1) FROM tblTable which will just return the average o

Re: Returning an average from a Related Field.

2006-10-16 Thread Tim Chase
>def av_rating(self): > queryset = self.review_set.all() > x=0 > y=0 > for rating in queryset: > x=x+rating.rating > y=y+1 > return x/y > > {{ objects.av_rating }} is the tag that is then put in the te

Re: Django, Postgres and Server Crash

2006-10-16 Thread Tim Chase
> Pressing 'c' on top clears everything a little bit. One thing > I think I forgot to mention is 90% of the time the server load > is moderate. It is 3 times a week around early in the morning > that my django and postgres start dancing to death for me. > Given that my server hardware handles the

Re: What IDE do you use? (semi-OT)

2006-10-10 Thread Tim Chase
> I am using emacs but I am looking for a editor easier to > customize. For instance I'd like to be able to write small > snippet of python code to do some tasks. What do you suggest? I'm about to commit heresy here (as a vi/vim user), but I'd recommend that you stick with Emacs. It sounds like

Re: Django comments system and ajax

2006-10-10 Thread Tim Chase
>> Can I specify a custom view without having to edit the >> django framework, or am I going to have to do this? > > I really like the idea of layering any ajaxy behavior on > simple XHTML. There is some name for this, "graceful > degradation" or something (which, in one sense, is a great > oxy

Re: Django's target applications?

2006-10-06 Thread Tim Chase
> or work with. Django provides an incredibly simple framework with a > multitude of options for different caching and other low level > implementation decisions (which it achieves through decoupled code) In addition to Fascis's good comments, if you google for django shared-nothing you

Re: Support for static content?

2006-10-04 Thread Tim Chase
> Django's database-centric approach seems to make certain kinds > of mostly-static sites harder to build. [cut] > Yes, Django is a framework, so I could build components that > make this possible, but it seems to me that it should be a > fundamental, built-in part of the system. Has anyone alrea

Re: Mile-high view of Django

2006-10-03 Thread Tim Chase
>> http://simon.incutio.com/archive/2005/08/15/request > > For the detail-oriented folks, I also maintain a more in-depth version: > > http://www.b-list.org/weblog/2006/06/13/how-django-processes-request Yes, these were exactly the sort of thing I was hunting for--particularly the detailed pro

Mile-high view of Django (was "Re: Cannot get Many to Many Relationship To work...")

2006-10-03 Thread Tim Chase
>> Jay, I did read the documentation before jumping in - but >> it's not all necessarily clear for someone who hasn't alot >> of experience in Python of Django. Are there any good resources where one can find the mile-high overview of Django's inner workings? An "executive summary", if you wil

<    2   3   4   5   6   7