Re: Django with Cherokee web server

2009-10-06 Thread Graham Dumpleton
On Oct 7, 3:34 pm, hcarvalhoalves wrote: > I recently found this web server (http://www.cherokee-project.com/) > that claims to be "the fastest web server". I'm not sure that holds > true for *CGI, but at least for static content they have some > impressive

Re: Problem with adding multiple aggregates to clause with join

2009-10-06 Thread Russell Keith-Magee
On Wed, Oct 7, 2009 at 1:13 PM, Paddy Joy wrote: > > Can anyone help out with the following aggregation clause? I have an > invoice and invoice_item models as shown. > > class Invoice(models.Model): > >    customer =  models.ForeignKey(Customer) >    payments_received =

Problem with adding multiple aggregates to clause with join

2009-10-06 Thread Paddy Joy
Can anyone help out with the following aggregation clause? I have an invoice and invoice_item models as shown. class Invoice(models.Model): customer = models.ForeignKey(Customer) payments_received = models.FloatField(default=0) class Invoice_Item(models.Model): invoice =

Re: One to Many on Template UI

2009-10-06 Thread hcarvalhoalves
On 7 out, 01:23, robinne wrote: > I have my model setup with foreign key relationships. I can read one > table's data to the UI. But I cannot figure out how to read child > records onto template. I know it is (in the case of Blog, Author, and > Entry)

Django with Cherokee web server

2009-10-06 Thread hcarvalhoalves
I recently found this web server (http://www.cherokee-project.com/) that claims to be "the fastest web server". I'm not sure that holds true for *CGI, but at least for static content they have some impressive benchmarks. Despite the claimings, it's an interesting alternative for what it supports

One to Many on Template UI

2009-10-06 Thread robinne
I have my model setup with foreign key relationships. I can read one table's data to the UI. But I cannot figure out how to read child records onto template. I know it is (in the case of Blog, Author, and Entry) b.entry_set.all(). But I don't know where this code goes. It won't work in the

Multiple queryset filter parameters on same instance of related model

2009-10-06 Thread bweiss
I know it's possible to combine filter parameters, so as to return a queryset of objects that meet all the conditions. And it's also possible to perform filters on related models. Is it possible to do both at once? ie. Return a list of objects that have a related object meeting both of two

Check list it's presented in other list and display data.

2009-10-06 Thread veasna bunhor
Dear Django developers, Here is my problem: author_A = [['book_x',1,10],['book_y',2,20],['book_z',3,30]] author_B = [['book_s',5,10],['book_t',2,20],['book_z',3,30]] author_A AND author_B = ['book_z',3,30] author_A = [['book_x',1,10],['book_y',2,20]] author_B =

inline queryset dependant on runtime data

2009-10-06 Thread sico
Suppose I have 4 models as below: class Hub(models.Model): name = models.CharField("Name", ) something-else = models.CharField("Something", ) class HubPlug(model.Model): hub = models.ForeignKey(Hub) plug_id = models.CharField("Plug Id (A, B, C, etc)", ) class Link(model.Model):

Re: Getting model's ID in save() method

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 9:15 PM, Robert Field wrote: > > On Oct 6, 10:09 am, Karen Tracey wrote: > > > > Personally I'd look pretty closely at the need to store a value dependent > on > > the primary key in some other field of the model. Is this

Re: Getting model's ID in save() method

2009-10-06 Thread Robert Field
On Oct 6, 10:09 am, Karen Tracey wrote: > > Personally I'd look pretty closely at the need to store a value dependent on > the primary key in some other field of the model.  Is this really absolutely > necessary? > > Karen In relational models it's pretty standard to use

Re: Django comments

2009-10-06 Thread kmike
It seems that django's comments system isn't exactly what your want. It is quity easy to write your specialised comments app, one solution is to just write your own. Second solution solution is: 1. Attach comments to your page model, not paragraph. 2. Add paragraph_id field to comment model. 3.

Re: Switching from MySQL to PostgreSQL

2009-10-06 Thread Graham Dumpleton
On Oct 7, 2:44 am, Chris McComas wrote: > We've been running our Django app with mod_python and Apache to serve > static files, along with MySQL as the database of choice. We're in the > process of making a few changes because we've had some stability and > performance

Re: Call javascript function in formset

2009-10-06 Thread Sonal Breed
Solved this problem using JQuery. On Oct 6, 2:26 pm, Sonal Breed wrote: > Hi all, > > I am using a formset in my template. I want to invoke a javascript > function as you click a key in any of the text-fields in this formset. > How do I accomplish this? I did not find any

Re: Form processing using bash script

2009-10-06 Thread Carlos Gustavo
Brilliant! Just what I needed to hear. :-) Thanks, Kevin. -Carlos. On Tue, Oct 6, 2009 at 3:56 PM, Kevin Teague wrote: > > > > On Oct 6, 12:02 pm, Carlos Gustavo wrote: > > Thanks Kevin, > > > > I would give it a shot. Doesn't sound as easy as I had

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread Sam Lai
2009/10/7 StevenC : > > Thank you all for your feedback. > > Python is not going to be the best interface to use and i have chosen > to go with C#, something i want to learn and much more achievable. As for .NET, if you're used to something like Django or most PHP frameworks,

Call javascript function in formset

2009-10-06 Thread Sonal Breed
Hi all, I am using a formset in my template. I want to invoke a javascript function as you click a key in any of the text-fields in this formset. How do I accomplish this? I did not find any documentation in this scenario. {% for data in formset.forms %}

get urlpattern name from path?

2009-10-06 Thread ringemup
Given a path and a urlconf, how would one go about fetching the name (NOT the view) corresponding to the current path? I've poked around Google a bit, but everything I could find looked really fragile. Thanks! --~--~-~--~~~---~--~~ You received this message

Re: Q regex

2009-10-06 Thread Tim Chase
Karen Tracey wrote: > On Tue, Oct 6, 2009 at 1:32 PM, Mat wrote: > >> Okay so here is my code: >> >> **This way works and does not error** >> rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); >> print len(rs); >> print rs[0].addr >> >>

Re: Form processing using bash script

2009-10-06 Thread Kevin Teague
On Oct 6, 12:02 pm, Carlos Gustavo wrote: > Thanks Kevin, > > I would give it a shot. Doesn't sound as easy as I had hoped. :-) > To make things even harder, keep in mind that any data gotten from the HTTP request which is passed on to a shell call as an argument must

django-wikiapp reviews?

2009-10-06 Thread zweb
Has anyone used django wikiapp in production. Any reviews of this app - Features you liked? Any major issues or shortcomings one should be aware of? Any alternatives you can recommend, I should evaluate as well. --~--~-~--~~~---~--~~ You received this

Re: Getting model's ID in save() method

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 3:31 PM, Aaron wrote: > > On Oct 6, 4:20 pm, Karen Tracey wrote: > > On Tue, Oct 6, 2009 at 2:49 PM, Aaron wrote: > > > > > Just tried it, like this: > > > > > class MyModel(models.Model): > > >myfield =

Re: Getting model's ID in save() method

2009-10-06 Thread Aaron
On Oct 6, 4:20 pm, Karen Tracey wrote: > On Tue, Oct 6, 2009 at 2:49 PM, Aaron wrote: > > > Just tried it, like this: > > > class MyModel(models.Model): > >    myfield = models.CharField(unique = True, blank = True, null = > > True) > > That can't be

Re: Getting model's ID in save() method

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 2:49 PM, Aaron wrote: > > Just tried it, like this: > > class MyModel(models.Model): >myfield = models.CharField(unique = True, blank = True, null = > True) > > That can't be right because this field is missing max_length. >def save(self,

Re: Form processing using bash script

2009-10-06 Thread Carlos Gustavo
Thanks Kevin, I would give it a shot. Doesn't sound as easy as I had hoped. :-) -Carlos. On Tue, Oct 6, 2009 at 2:55 PM, Kevin Teague wrote: > > Use the os.subprocess module in the python standard library to invoke > the bash script from your django view code: > >

Re: Getting model's ID in save() method

2009-10-06 Thread Aaron
Just tried it, like this: class MyModel(models.Model): myfield = models.CharField(unique = True, blank = True, null = True) def save(self, force_insert = False, force_update = False): if self.myfield == '': self.myfield = None super(MyModel,

Re: Form processing using bash script

2009-10-06 Thread Kevin Teague
Use the os.subprocess module in the python standard library to invoke the bash script from your django view code: http://docs.python.org/library/subprocess.html Although in my experience, when there is a bash script wrapping a number of calls to other programs, I tend to find it easier to work

where can I find email alert functionality

2009-10-06 Thread Norman
hello, I look for email alert functionality, where readers sign up to get notifications when news happens. But I can't find any suitable django app. So where can I find something like this? Any snippet or source code? regards, nomanek --~--~-~--~~~---~--~~ You

Re: Form processing using bash script

2009-10-06 Thread Carlos Gustavo
Hi Daniel, Thanks for the response to my mail. These input values are used by a bash script containing various C programs and the processing results in graph that needs to be displayed as an image plot on the response form. Thanks again. -Carlos On Tue, Oct 6, 2009 at 2:01 PM, Daniel Roseman

Re: Q regex

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 1:32 PM, Mat wrote: > > Okay so here is my code: > > **This way works and does not error** > rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); > print len(rs); > print rs[0].addr > > ***This way errors > q =

Re: How to wrap SQL in Django ORM

2009-10-06 Thread Geobase Isoscale
Yes, I intend to write ORM code that will create views and triggers in the database? Many Thanks Isoscale --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Q regex

2009-10-06 Thread Mat
Okay so here is my code: **This way works and does not error** rs = BadActor.objects.filter(addr__iregex='^(192\.188\.)(.*)(\.20)$'); print len(rs); print rs[0].addr ***This way errors q = Q({'addr__iregex':'^(192\.188\.)(.*)(\.20)$'}); rs = BadActor.objects.filter(q); print

Re: How to wrap SQL in Django ORM

2009-10-06 Thread Daniel Roseman
On Oct 6, 4:49 pm, Geobase Isoscale wrote: > Hi all, > Firstly, I'm looking  for modules and folders that supports ORM (object > relation mapper ) that will enable me to extend the functionality of Django > to enable me wrap SQL statements to result with database triggers and

Re: Getting model's ID in save() method

2009-10-06 Thread Aaron
On Oct 6, 2:56 pm, Daniel Roseman wrote: > Does that field need to be unique on its own? Yes it does. And I also don't want the clients of this model to know that they could be accessing the model's ID when they access the field in question. I suppose what I could do is

Re: Form processing using bash script

2009-10-06 Thread Daniel Roseman
On Oct 6, 6:01 pm, Carlos Gustavo wrote: > Hi Everyone, > > I am Django newbie and the experience has been exciting. > > I want some help with the ff. challenge I am now facing: > > How can I get a Django form to process a bash script executing a bunch of C > programs

Re: Getting model's ID in save() method

2009-10-06 Thread Daniel Roseman
On Oct 6, 6:28 pm, Aaron wrote: > On Oct 6, 2:09 pm, Karen Tracey wrote: > > > Yes, you'll have to save the change to the DB.  But note if you were called > > with force_insert=True you do not want to call the superclass save with > > force_insert=True

Re: Getting model's ID in save() method

2009-10-06 Thread Aaron
On Oct 6, 2:09 pm, Karen Tracey wrote: > Yes, you'll have to save the change to the DB.  But note if you were called > with force_insert=True you do not want to call the superclass save with > force_insert=True twice. OK. Would calling "super(MyModel, self).save(False,

Re: Getting model's ID in save() method

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 12:57 PM, Aaron wrote: > > On Oct 6, 1:30 pm, Karen Tracey wrote: > > The only sure way to know what primary key is going to be assigned by the > DB > > is to actually save the object to the DB and see what got assigned. > > O.K.

Form processing using bash script

2009-10-06 Thread Carlos Gustavo
Hi Everyone, I am Django newbie and the experience has been exciting. I want some help with the ff. challenge I am now facing: How can I get a Django form to process a bash script executing a bunch of C programs running on linux. Any pointers or suggestions would be deeply appreciated. Thanks

Re: Switching from MySQL to PostgreSQL

2009-10-06 Thread Christophe Pettus
On Oct 6, 2009, at 8:44 AM, Chris McComas wrote: > Is there an easy way for us > to take all of our data from our MySQL and move it over to PostgreSQL? Welcome to PostgreSQL! I think you'll find it a very convivial environment. :) Here's a blog entry that describes one migration path:

Re: Getting model's ID in save() method

2009-10-06 Thread Aaron
On Oct 6, 1:30 pm, Karen Tracey wrote: > The only sure way to know what primary key is going to be assigned by the DB > is to actually save the object to the DB and see what got assigned. O.K. Now, when I get the ID after saving the object and perform some logic on it, I'll

Re: syndication feed framework - how to reverse the urls?

2009-10-06 Thread anentropic
ok, thanks! On Oct 5, 12:09 pm, Russell Keith-Magee wrote: > On Mon, Oct 5, 2009 at 6:31 PM, anentropic wrote: > > > So I just have to hard-code the feed urls in my templates? > > In short, yes. > > The feeds framework predates the introduction of

Re: Getting model's ID in save() method

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 12:05 PM, Aaron wrote: > > When saving a model, I need to be able to access its ID field like > this: > > class MyModel: >... >def save(self, force_insert = False, force_update = False): >v = self.id ># Do something with v > >

Re: Unhandled IntegrityError caused by setting unique_together over DateField and SlugField

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 11:44 AM, Michiel wrote: > > Hi, > > I'm getting an unhandled IntegrityError after setting a > unique_together over a DateField and a SlugField, is that considered a > bug or not? > > I expected it to show a nice error message informing the

Re: Getting model's ID in save() method

2009-10-06 Thread Bogdan I. Bursuc
You could do something like this: def save(self, force_insert=False, force_update=False): # first save the model using the base class save method super(MyModel, self).save(force_insert, force_update) # then self will have an id set v = self.id On Tue, 2009-10-06 at

Getting model's ID in save() method

2009-10-06 Thread Aaron
When saving a model, I need to be able to access its ID field like this: class MyModel: ... def save(self, force_insert = False, force_update = False): v = self.id # Do something with v super(MyModel, self).save(force_insert, force_update) However, if the model

Unhandled IntegrityError caused by setting unique_together over DateField and SlugField

2009-10-06 Thread Michiel
Hi, I'm getting an unhandled IntegrityError after setting a unique_together over a DateField and a SlugField, is that considered a bug or not? I expected it to show a nice error message informing the user that he should pick something else for either Date or Slug. I does do that when I set the

How to wrap SQL in Django ORM

2009-10-06 Thread Geobase Isoscale
Hi all, Firstly, I'm looking for modules and folders that supports ORM (object relation mapper ) that will enable me to extend the functionality of Django to enable me wrap SQL statements to result with database triggers and views. Secondly, how can I use RAW SQL statements with Django. Many

media url naming, philosophies and reasons?

2009-10-06 Thread Bill Freeman
Media seems to come in several flavors (admin, non-admin read only, uploadable to, maybe more). We have MEDIA_URL and ADMIN_MEDIA_PREFIX available in settings.py for configuring where our projects will look for their media. I've seen '/media/' and MEDIA_URL+'admin/', but I've also seen

Switching from MySQL to PostgreSQL

2009-10-06 Thread Chris McComas
We've been running our Django app with mod_python and Apache to serve static files, along with MySQL as the database of choice. We're in the process of making a few changes because we've had some stability and performance issues, so we're moving to mod_wsgi/nginx, but we also want to switch from

Re: PIL or an error elsewhere?

2009-10-06 Thread Angel Cruz
When I ran through this problem, there were a couple of things I was doing wrong, none of which had to do with jpeg support. Eventually, I found that my major problem was that my media directory (where the upload directory resides) was not set properly in Apache. It was not writeable. In my

Getting django working on jython/modjy/jetty

2009-10-06 Thread Arto Vuori
Hello, I'm trying to get django working through WSGI with modjy using (embedded) Jetty as the web server. The problem is that django does not like that the url path is prefixed with the web application's name. By "web application" I mean the complete tree (or a war file) with the WEB-INF

Re: Problem with list_filter

2009-10-06 Thread Karen Tracey
On Tue, Oct 6, 2009 at 7:52 AM, Thomas Steinmaurer wrote: > > Hello, > > I have the following model: > > [snip] > class RelationalDatabaseAdmin(admin.ModelAdmin): > list_display = > > ('data_package_id','physical_name','database_instance_name','model_version') >

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread Kristaps Kūlis
just for your knowledge : Python implementation under .NET http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython Kristaps Kūlis BOFH excuse #371: Incorrectly configured static routes on the

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread StevenC
Thank you all for your feedback. Python is not going to be the best interface to use and i have chosen to go with C#, something i want to learn and much more achievable. Cheers all though --~--~-~--~~~---~--~~ You received this message because you are subscribed

Models mixins/inheritance

2009-10-06 Thread Eugene Mirotin
We have an existing app written in perl with Postgre as DB. I want to add the django admin as the interface to this existing DB. The main app is in constant development, so the DB scheme may change in the future. I have checked the inspectdb output and it is quite good (I do also do some

Re: Architecture with multiple applications, context processors, utility methods

2009-10-06 Thread davisd
Daniel, Thanks for your reply. I believe template tags are part of the answer, namely in the example I gave below about the "Ads". They can grab some context right from the template, call functions from the app, etc. But they can't "pass data" to themselves... And the tag has to be hard-coded

Re: 3rd Party Auth or Session Management

2009-10-06 Thread Kristaps Kūlis
You can write auth backend to LDAP, so it will auth against LDAP See http://code.djangoproject.com/ticket/11526 About sessions: you can write custom session backend, with talks to OpenSSO server Kristaps Kūlis BOFH excuse #371: Incorrectly configured static routes on the

Re: Problem with list_filter (SOLVED)

2009-10-06 Thread Thomas Steinmaurer
Thomas Steinmaurer wrote: > Hello, > > I have the following model: > > class ModelVersion(models.Model): > model_version_id = models.AutoField(primary_key=True) > major_version = models.IntegerField(null=True, blank=True) > minor_version = models.IntegerField(null=True,

Problem with list_filter

2009-10-06 Thread Thomas Steinmaurer
Hello, I have the following model: class ModelVersion(models.Model): model_version_id = models.AutoField(primary_key=True) major_version = models.IntegerField(null=True, blank=True) minor_version = models.IntegerField(null=True, blank=True) class Meta: db_table =

Re: How do I create project independent apps.

2009-10-06 Thread Torsten Bronger
Hallöchen! Torsten Bronger writes: > [...] > > I did some research on this two weeks ago and my impression was > that there are no guidelines at all to create portable apps. On > the contrary, the template path in the official Django tutorial is ... not a good example. Tschö, Torsten. --

Re: Unit Testing in Django.

2009-10-06 Thread veasna bunhor
I have been test it, but it's seem not to be clear to involve into the real project. Could you let me know the other example? On Tue, Oct 6, 2009 at 6:01 PM, Daniel Roseman wrote: > > On Oct 6, 11:55 am, veasna bunhor wrote: > > Do you know how to

Re: Unit Testing in Django.

2009-10-06 Thread Daniel Roseman
On Oct 6, 11:55 am, veasna bunhor wrote: > Do you know how to use unit testing in django ? Could you please give me an > example? > > Thanks in advanced, http://docs.djangoproject.com/en/dev/topics/testing/ -- DR --~--~-~--~~~---~--~~ You

Re: Unit Testing in Django.

2009-10-06 Thread Russell Keith-Magee
On Tue, Oct 6, 2009 at 6:55 PM, veasna bunhor wrote: > Do you know how to use unit testing in django ? Could you please give me an > example? There's a link to docs labled "Testing: Overview" on the homepage of the documentation.

Unit Testing in Django.

2009-10-06 Thread veasna bunhor
Do you know how to use unit testing in django ? Could you please give me an example? Thanks in advanced, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread Kristaps Kūlis
Hey, If you prefer cleaner way, then you can run django on iropython http://stackoverflow.com/questions/425990/django-on-ironpython and use .NET Powershell SDK for this purpose Kristaps Kūlis BOFH excuse #371: Incorrectly configured static routes on the

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread Sam Lai
2009/10/6 StevenC : > > Hey all. > > I have been set a massive project and one of the fundimentals is to > create a Mailbox in Microsoft Exchange 2007. My choice of language is > going to be Django/Python rather than PHP because i want to move away > from PHP. > > Soo, my

Re: How do I create project independent apps.

2009-10-06 Thread Torsten Bronger
Hallöchen! Johan writes: > Thanks for all the feedback. By nature I prefer NOT to use a to > deep framework stack. So although django-harness could work I > would prefer to keep my dependencies simple. I would probably go > with managing the python path. It seems to be the simplest way and >

Re: custom permission in admin models

2009-10-06 Thread Bogdan I. Bursuc
Ok, I think your answer is here on creating permissions: http://docs.djangoproject.com/en/dev/topics/auth/#id1 in the ModelAdmin, override the `save_model` method and check the current user permission: request.user.has_perm('permission_name') for more on checking permission see

Re: How do I create project independent apps.

2009-10-06 Thread Johan
Thanks for all the feedback. By nature I prefer NOT to use a to deep framework stack. So although django-harness could work I would prefer to keep my dependencies simple. I would probably go with managing the python path. It seems to be the simplest way and most transparent way of handling the

Re: How do I create project independent apps.

2009-10-06 Thread Andy Mikhailenko
Another way is to use a settings wrapper such as django-harness[1], which: * helps organize apps (by name, without the notion of project) and eliminates the need to write absolute paths for templates, sqlite database and such stuff stored in the project directory; * simplifies version control of

Re: custom permission in admin models

2009-10-06 Thread elminio
not exactly, for example I want to make custom permission which enables user to change one field in model but only to 5 letter length word while other users may change that field to 6 letters length word. Thats sily example but in some cases it may be useful. On Oct 6, 10:19 am, "Bogdan I.

Re: custom permission in admin models

2009-10-06 Thread Bogdan I. Bursuc
i think you want to create a group. On Tue, 2009-10-06 at 01:05 -0700, elminio wrote: > Hi, > In admin Panel I can choose groups and give them specified > permissions. For example > > admin | log entry | can add log entry > > And I would like to create my own type of permission which for

case sensitivity in admin search

2009-10-06 Thread elminio
Hi, How to ignore case sensitivity in admin search box ? In model I have one search field set but case sensitivity isn't ignored thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

custom permission in admin models

2009-10-06 Thread elminio
Hi, In admin Panel I can choose groups and give them specified permissions. For example admin | log entry | can add log entry And I would like to create my own type of permission which for example is called all and gives to the specified user permission to do whatever he likes, and other

Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread StevenC
Hey all. I have been set a massive project and one of the fundimentals is to create a Mailbox in Microsoft Exchange 2007. My choice of language is going to be Django/Python rather than PHP because i want to move away from PHP. Soo, my question to everyone is.. Does anyone know if you can