Re: How to do dynamic lookup of variables.

2007-02-14 Thread Benedict Verheyen
Mike Lake schreef: > Hi all > > Im trying to place into a list of experiments the number of procedures for > each experiment. > From within the views.py I can save the number of procedures in an experiment > into either a list of tuples (e.id, count) or a dictionary {'e.id': count}. > But when

Re: manage.py reset database fails

2007-02-14 Thread Malcolm Tredinnick
On Thu, 2007-02-15 at 04:54 +, akonsu wrote: > hello, > > in my models.py i have two classes related as many-to-many. if i add a > ManyToManyField to one of the models, and run manage.py reset or > syncdb, and then move the field to the other model (which functionally > makes no difference) a

manage.py reset database fails

2007-02-14 Thread akonsu
hello, in my models.py i have two classes related as many-to-many. if i add a ManyToManyField to one of the models, and run manage.py reset or syncdb, and then move the field to the other model (which functionally makes no difference) and run manage.py reset again, it fails to reset the database

Re: Listing users

2007-02-14 Thread [EMAIL PROTECTED]
The problem I have with this is that, if I'm correctly understand what goes on, when I do a select_related all the related objects are retrieved. In this case, if a user has made, say, 4000 posts plus other types of contributions, it seems like it's pulling in a lot of unnecessary data. Am I misu

Re: how to postpone HttpResponse but still get new requests

2007-02-14 Thread Nicholas Ding
AJAX is the better solution, u need to poll the server with a small interval in your web client. On 2/15/07, oggie rob <[EMAIL PROTECTED]> wrote: > > > > is there a way to save the request so i can send a response later > (when the are new items). > > You can't send a much-delayed response to brow

How to do dynamic lookup of variables.

2007-02-14 Thread Mike Lake
Hi all Im trying to place into a list of experiments the number of procedures for each experiment. >From within the views.py I can save the number of procedures in an experiment >into either a list of tuples (e.id, count) or a dictionary {'e.id': count}. >But when I come to access them in the

Re: Dumping a db using django db api

2007-02-14 Thread Russell Keith-Magee
On 2/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > limodou made a script that dumps the data to django ORM format: > http://groups.google.com/group/django-users/browse_thread/thread/b7423a8944770ec/189c26faa9bd823c ... and ticket #2333 has a database dumping capability that will be roll

Re: "Best" way of using templates

2007-02-14 Thread Don Arbow
On Feb 14, 2007, at 2:46 PM, James Tauber wrote: > If the formatting could be applied to different classes, I'd use a > filter. If the formatting only makes sense for Houses, I'd make it a > method on House. And you might even want to make it a __str__() method, I do that for some of my models

Re: Dumping a db using django db api

2007-02-14 Thread [EMAIL PROTECTED]
limodou made a script that dumps the data to django ORM format: http://groups.google.com/group/django-users/browse_thread/thread/b7423a8944770ec/189c26faa9bd823c the + is that you can move data between databases (like sqlites - postgres) and you don't have to care about db encoding ;) (for non la

Re: Creating HTML emails

2007-02-14 Thread Clint Ecker
And please note, this was probably nabbed from some example online and modified to suit my needs, please don't attribute it to me, it's only as an example for you ;) Clint On 2/8/07, Tipan <[EMAIL PROTECTED]> wrote: > > I've been able to create Plain text emails to send to users with an > authen

Re: Creating HTML emails

2007-02-14 Thread Clint Ecker
Forgot to include my send_mail function: http://dpaste.com/hold/5682/ On 2/8/07, Tipan <[EMAIL PROTECTED]> wrote: > > I've been able to create Plain text emails to send to users with an > authentication link which work well, however I'd like to improve the > look of these by outputting in HTML w

Re: Creating HTML emails

2007-02-14 Thread Clint Ecker
Here is a bit of code from a project I did, let me know if I should explain anything: http://dpaste.com/hold/5681/ Seems to work just fine for me! On 2/8/07, Tipan <[EMAIL PROTECTED]> wrote: > > I've been able to create Plain text emails to send to users with an > authentication link which work

Dumping a db using django db api

2007-02-14 Thread Herman
Well I made a little script that dump the database content insert statements of a django application, useful for creating the initial data of an application. I don't know if this has been done or if it's a feature of the many tools that django provides, but it have fun making it. #!/usr/bin/env p

Re: "Best" way of using templates

2007-02-14 Thread James Tauber
If the formatting could be applied to different classes, I'd use a filter. If the formatting only makes sense for Houses, I'd make it a method on House. James On 14/02/2007, at 9:51 PM, Jonathan Ballet wrote: > > Hello everybody, > > some days ago, my co-worker did some things which keep b

Re: "Best" way of using templates

2007-02-14 Thread Malcolm Tredinnick
On Wed, 2007-02-14 at 13:51 -0800, Jonathan Ballet wrote: [...] > The title is a mix of some fields of a house object : for ex., if the > number of rooms is not available, it is not displayed, etc. > (currently, it's a 30 lines function). > He ends up with a title which looks like this : "House fo

Re: Application parameters (was: template loading and pluggable apps)

2007-02-14 Thread Malcolm Tredinnick
On Wed, 2007-02-14 at 17:00 +0100, Frank Tegtmeyer wrote: > "James Bennett" <[EMAIL PROTECTED]> writes: > > > you had two apps named "payment", it wouldn't just affect templates -- > > Right. Thanks for all the answers. > > My next question is about parameters for applications: how does one do

"Best" way of using templates

2007-02-14 Thread Jonathan Ballet
Hello everybody, some days ago, my co-worker did some things which keep bothering me. He has a simple model, which represents, as it's name point out, err ... houses : class House(models.Model): price = models.FloatField(max_digits=10, decimal_places=2) to_buy = models.BooleanField(defa

Re: Using django for CMS stuff

2007-02-14 Thread Kenneth Gonsalves
On 15-Feb-07, at 1:49 AM, [EMAIL PROTECTED] wrote: > Django is very good for CMS like apps. I develop Diamanda Wiki and > MyghtyBoard forum (www.rkblog.rk.edu.pl) and each app has it's own > folder for code/templates and can be rather easily used in other > projects :) if you want a readymade c

Re: Using django for CMS stuff

2007-02-14 Thread [EMAIL PROTECTED]
Django is very good for CMS like apps. I develop Diamanda Wiki and MyghtyBoard forum (www.rkblog.rk.edu.pl) and each app has it's own folder for code/templates and can be rather easily used in other projects :) --~--~-~--~~~---~--~~ You received this message becau

Using django for CMS stuff

2007-02-14 Thread walterbyrd
CMSes like joomla and drupal have a rich assortment of plugins/modules/ extensions for stuff like: blogs, forums, galleries, news aggregators, ecommerce, document management, and so on. How difficult would it be to get that sort of functionallity from dango? --~--~-~--~~

Suggested blog software

2007-02-14 Thread Chris Moffitt
I know that building your own blog in Django is almost a rite of passage but I am building another app and would like to use a blog plus some other cms-type django goodness for the app website. I've found a few links for working blog code in Django but not much that seems to be actively worked on

Re: newb question: Kind of confused MEDIA_URL, MEDIA_ROOT, SITE_MEDIA and so on.

2007-02-14 Thread Jeremy Dunck
On 2/14/07, Joseph Heck <[EMAIL PROTECTED]> wrote: > It's worth noting that to use the MEDIA_URL settings in your template, > you'll need to either pass it down through the views into the Template > context, or write a quick little middleware that always pushes it into the > context (which is what

iteration of query set appears to fail when running function directly from interpretor

2007-02-14 Thread Merric Mercer
Help! I have a function that is provided below. When I try the individual lines of the function through the interpretor (Ipython) everything works as expected. For example:- >> qset=PointTransaction.objects.filter etc this works fine!! However, when I try to run the function as a

Template question - Can you conditionally inherit from other templates?

2007-02-14 Thread Joseph Heck
I looked through the documentation, and tried a few experiments - it looks like you can't - but I wanted to make sure I wasn't doing something wrong: We tried to do something like: {% if {{trigger_variable}} %} {% block foo %} {% endblock foo %} {% else %} {% block altfoo %} {% endblo

Re: Sorting a query set

2007-02-14 Thread Joseph Heck
Absolutely correct - I was a bit confusing - if the integer is kept in a "text field" - the sorting may not be what you expect. -joe On 2/14/07, James Bennett <[EMAIL PROTECTED]> wrote: > > > On 2/14/07, Joseph Heck <[EMAIL PROTECTED]> wrote: > > Certainly - if a field is just an integer, use th

Re: newb question: Kind of confused MEDIA_URL, MEDIA_ROOT, SITE_MEDIA and so on.

2007-02-14 Thread Joseph Heck
It's worth noting that to use the MEDIA_URL settings in your template, you'll need to either pass it down through the views into the Template context, or write a quick little middleware that always pushes it into the context (which is what I did). Then you can use: wrote: > > > * johnny wrote, O

Re: how to postpone HttpResponse but still get new requests

2007-02-14 Thread oggie rob
> is there a way to save the request so i can send a response later (when the are new items). You can't send a much-delayed response to browser clients. the http request will time out if it doesn't get a response in time. I think you need to look to AJAX. Get a response immediately & keep queryi

Re: Sorting a query set

2007-02-14 Thread James Bennett
On 2/14/07, Joseph Heck <[EMAIL PROTECTED]> wrote: > Certainly - if a field is just an integer, use the .order_by('fieldname') or > .order_by('-fieldname') and that should do the trick nicely. Actually, you should be able to order by any field, not just an integer. -- "Bureaucrat Conrad, you ar

Re: Creating HTML emails

2007-02-14 Thread Joseph Heck
There's a sort of long-run-pending discussion on adding this functionality to the Django core - check out http://code.djangoproject.com/ticket/1541which includes patches that you can use in your own code to get the job done in the mean time -joe On 2/8/07, Tipan <[EMAIL PROTECTED]> wrote: > > > I

Re: Sorting a query set

2007-02-14 Thread Joseph Heck
Certainly - if a field is just an integer, use the .order_by('fieldname') or .order_by('-fieldname') and that should do the trick nicely. -joe On 2/7/07, MerMer <[EMAIL PROTECTED]> wrote: > > > > > Is it possible to sort a query set based on an integer in one of the > fields. > > MerMer > > > > >

Re: how to postpone HttpResponse but still get new requests

2007-02-14 Thread Dill0r
this is my first web-app, so i didnt know twisted. looks nice. thx! --~--~-~--~~~---~--~~ 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 unsubs

Re: sqlite problems

2007-02-14 Thread Guillermo Fernandez Castellanos
Hi, Try this (http://code.djangoproject.com/wiki/NewbieMistakes): Django says "Unable to Open Database File" when using SQLite3 ¶ Problem ¶ You're using SQLite3, your DATABASE_NAME is set to the database file's full path, the database file is writeable by Apache, but you still get the above erro

Application parameters (was: template loading and pluggable apps)

2007-02-14 Thread Frank Tegtmeyer
"James Bennett" <[EMAIL PROTECTED]> writes: > you had two apps named "payment", it wouldn't just affect templates -- Right. Thanks for all the answers. My next question is about parameters for applications: how does one do that in Django? Say I want to have two different photo galleries, both

Re: template loading and pluggable apps

2007-02-14 Thread James Bennett
On 2/14/07, Frank Tegtmeyer <[EMAIL PROTECTED]> wrote: > except that there is no central registry for application names, right? > So one could have two applications called "payment" where one would be > for credit cards, the other for anonymous payment. What if he needs > both and they are made by

Re: template loading and pluggable apps

2007-02-14 Thread Frank Tegtmeyer
Hi Geert, > - Non name clash except that there is no central registry for application names, right? So one could have two applications called "payment" where one would be for credit cards, the other for anonymous payment. What if he needs both and they are made by someone else? Ok, not very like

Re: Model instance identity

2007-02-14 Thread Ivan Sagalaev
David Abrahams wrote: > I just wrote some code that used Model instances as keys in a dict, > and was surprised to find two instances in the dict that represented > the same object in the database. Shouldn't that be impossible? If > you can't guarantee that a given object in the database is alwa

Re: Constructing Breadcrumbs

2007-02-14 Thread primitive
Both suggestions seem plausible, I will have to try it out and see what makes the most sense for me. I might have to restructure the layout of the site to be more logical (I knew this would come back to haunt me). Thanks all, I will post my results soon. Regards, Leo. --~--~-~--~~--

Re: Listing users

2007-02-14 Thread [EMAIL PROTECTED]
I just use a generic list view and send it user_dict = { 'queryset': GpUser.objects.all(), } GpUser is my model that extends auth.user On Feb 14, 2:47 am, "Aidas Bendoraitis" <[EMAIL PROTECTED]> wrote: > Your profile perhaps is related by a foreign key to the user, which > means that theore

Re: template loading and pluggable apps

2007-02-14 Thread Geert Vanderkelen
Hi Frank, On 14 Feb 2007, at 11:45, Frank Tegtmeyer wrote: > > Hi, > > I ave a question about the philosophy behind the template loading > mechanism (my background is Zope2 with the "local overrides global" > approach). > If I understand it right, all the (standard) template loaders form a > nam

Re: Django Cheat Sheet

2007-02-14 Thread Aidas Bendoraitis
I found one small mistake. CommaSeparatedIntegerField doesn't have auto_now and auto_now_add, so they should be removed from the appropriate place in the cheet sheet. Regards, Aidas Bendoraitis [aka Archatas] On 2/14/07, Julian Romero <[EMAIL PROTECTED]> wrote: > On 2/13/07, John Sutherland <[E

Re: Cooki Problem

2007-02-14 Thread ScottB
On Feb 14, 7:00 am, "samira" <[EMAIL PROTECTED]> wrote: > we can have two ways to store data in cookie: Session for permanent > and cookie for temporary. Am I right? Not exactly. Data stored in session is held on the server. The session middleware uses a cookie to give the client a session id s

Re: correct limit_choices_to syntax

2007-02-14 Thread Benedict Verheyen
Benedict Verheyen schreef: I now defined the fields in my custom change manipulator: self.fields = ( forms.PositiveIntegerField(field_name="Admissionnr", is_required=True), ... forms.SelectField(field_name="kamer", choices=room_choices), ... ) This displays the correct list of available bed

Re: how to postpone HttpResponse but still get new requests

2007-02-14 Thread Julian Romero
Did you tried twisted? http://twistedmatrix.com/projects/core/documentation/howto/async.html On 2/9/07, Dill0r <[EMAIL PROTECTED]> wrote: > > > Hi, > > i got a producer-consumer class which await new items from the > clients, does sth with them and provides them to all clients. > > the url "getNe

Re: Django Cheat Sheet

2007-02-14 Thread Julian Romero
On 2/13/07, John Sutherland <[EMAIL PROTECTED]> wrote: > > > Hi all, > > Firstly, sorry for the cross-post. > > My employer, Mercurytide [1], as some of you may have seen in the > past, publishes white-papers on a monthly basis. This month it's > another Django themed one: a Django cheat sheet: > >

template loading and pluggable apps

2007-02-14 Thread Frank Tegtmeyer
Hi, I ave a question about the philosophy behind the template loading mechanism (my background is Zope2 with the "local overrides global" approach). If I understand it right, all the (standard) template loaders form a namespace for templates that is used for all applications within a site: app1

Re: stored procedures in initial SQL ?

2007-02-14 Thread Malcolm Tredinnick
On Wed, 2007-02-14 at 11:26 +0100, Bram - Smartelectronix wrote: > Malcolm Tredinnick wrote: > > At the moment, the only workaround is to call out to your own shell > > script (or other) to do the insert. If you have a look around line 506 > > of django/core/management.py, you can see where Django

sqlite problems

2007-02-14 Thread ydo
I've installed django with mod_python on an apache2 server configured as below. When I run /blog/ it works fine but when I try to fire up the /admin/ I get: OperationalError: unable to open database file full error below.. I have absolutely no clue how to proceed. the database is initialized with

Re: stored procedures in initial SQL ?

2007-02-14 Thread Bram - Smartelectronix
Malcolm Tredinnick wrote: > At the moment, the only workaround is to call out to your own shell > script (or other) to do the insert. If you have a look around line 506 > of django/core/management.py, you can see where Django emits a > "post-syncdb" signal after setting up the database, so you can

Re: Listing users

2007-02-14 Thread Aidas Bendoraitis
Your profile perhaps is related by a foreign key to the user, which means that theoretically one user can have several profiles. Therefore, in my opinion, you should get the profiles and use select_related() for related users. profiles = UserProfile.objects.select_related().order_by('user__id')[