Re: Django with Cherokee web server

2009-10-08 Thread Rudy Lattae

Folks, I think we should bring this back to the actual question and
not derail the thread and ram it head first into the FUD vs FUD
mountain. hcarvalhoalves original question was (and still remains):

"I wanted to know if someone here on the list is using or used
Cherokee
with Django, if there's any performance improvements over Apache +
mod_wsgi/mod_python (specially for concurrent requests), and if there
are any gotchas with Django 1.1. "

I just wanted to draw the attention of all the well meaning
contributors to the key components of hcarvalhoalve's question:
* Have you used Cherokee with Django?
* Have you run any benchmarks comparing (or noticed performance
differences between) Cherokee and Apache + mod_wsgi/mod_python -- esp.
for concurrent requests?
* Are there any issues, concerns, road blocks that one needs to
lookout for when using Cherokee to serve a Django site/app/service?

I unfortunately have not used Cherokee, so I cannot comment on the
above question. However, I hope we see some pertinent responses soon.

Cheers

On Oct 8, 11:46 am, Oli Warner  wrote:
> > To stick with your analogy, it actually *is* like buying a car and being
> > surprised you don't get 0-60 in 5 seconds and 80 mpg, but only because
> > you will only drive it in second gear. And then you blame the dealer..
>
> Sure. Cherokee's an automatic ;p
>
> > >From the way you talk about Apache, you are fearful of it
>
> Fear doesn't enter into it at all. There's no uncertainty or doubt in my
> mind.
>
> I used Apache for several years. I *know* deploying it is harder. I
> *know*how much time it absorbs because its default behaviour needs so
> much
> attention.
>
> That's probably still not good enough for you but hey. It's my opinion.
> Somebody asked and I gave. Yours differs from mine. Great. I'm over the moon
> that you're happy with Apache. But I'm not particularly happy that you're
> trolling all over the thread calling me a FUD spreader for sharing my
> experience.
>
> That's not to say there's nothing of value in your posts. Unless you're
> dealing with billions of requests a day, connector latency is probably the
> least of your worries.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



about django.core.mail.send_mail

2009-10-08 Thread li kai
Can I send email using others' mail account following these steps?

1. I fill my own mail account and password in settings.py.

2. When using "send_mail(subject, message, sender, recipients)", I set
sender to  a different mail account.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Understanding "/admin/jsi18n/"

2009-10-08 Thread Anton Bessonov

http://www.google.com/search?q=django+jsi18n

LuisC schrieb:
> Hi!!!
> I am doing my fist appl and after some struggling I am using
>
> forms.DateField(widget=AdminDateWidget)
>
> in my view, and
>
> 
> 
> 
> 
> {{ form.media }}
>
> in my template...
>
> The calendar widget is working ok; but I do not know what jsi18n does
> and I am unable to find it any where in the system.  Also, I am not
> sure of the purpose of {{ form.media }}.
>
> I would apreciate some explanation on the subject
>
> Regards!!
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Understanding "/admin/jsi18n/"

2009-10-08 Thread LuisC

Hi!!!
I am doing my fist appl and after some struggling I am using

forms.DateField(widget=AdminDateWidget)

in my view, and





{{ form.media }}

in my template...

The calendar widget is working ok; but I do not know what jsi18n does
and I am unable to find it any where in the system.  Also, I am not
sure of the purpose of {{ form.media }}.

I would apreciate some explanation on the subject

Regards!!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: PID/processes for runserver

2009-10-08 Thread Karen Tracey
On Thu, Oct 8, 2009 at 6:47 PM, mviamari  wrote:

>
> I've written a script to launch a server, run some tests and then kill
> the server afterwards.  The problem I'm having is that the PID
> returned from the subprocess call is not the same as the PID needed to
> kill the server.
>
> Is there any way to get the runserver command to run with a single
> process?
>
> Other potential solutions are welcome.
>
>
--noreload is probably what you want:

http://docs.djangoproject.com/en/dev/ref/django-admin/#djadminopt---noreload

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



PID/processes for runserver

2009-10-08 Thread mviamari

I've written a script to launch a server, run some tests and then kill
the server afterwards.  The problem I'm having is that the PID
returned from the subprocess call is not the same as the PID needed to
kill the server.

Is there any way to get the runserver command to run with a single
process?

Other potential solutions are welcome.

Thanks,

Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django with Cherokee web server

2009-10-08 Thread Oli Warner
>
> To stick with your analogy, it actually *is* like buying a car and being
> surprised you don't get 0-60 in 5 seconds and 80 mpg, but only because
> you will only drive it in second gear. And then you blame the dealer..
>

Sure. Cherokee's an automatic ;p


> >From the way you talk about Apache, you are fearful of it


Fear doesn't enter into it at all. There's no uncertainty or doubt in my
mind.

I used Apache for several years. I *know* deploying it is harder. I
*know*how much time it absorbs because its default behaviour needs so
much
attention.

That's probably still not good enough for you but hey. It's my opinion.
Somebody asked and I gave. Yours differs from mine. Great. I'm over the moon
that you're happy with Apache. But I'm not particularly happy that you're
trolling all over the thread calling me a FUD spreader for sharing my
experience.

That's not to say there's nothing of value in your posts. Unless you're
dealing with billions of requests a day, connector latency is probably the
least of your worries.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Checking download completed

2009-10-08 Thread Alvaro Mouriño

Hi list,

I'm developing a website for a local newspaper which is distributed as
PDF as well. I was asked to keep track of how many times each edition
is downloaded, but I want to make a difference between completed
downloads and uncompleted.

Now I'm serving the file through the HttpResponse object [0] but I
have no control once the view returns it. Is there a way to know
whether the file was successfully downloaded?

Regards,

[0] 
http://docs.djangoproject.com/en/dev/ref/request-response/#telling-the-browser-to-treat-the-response-as-a-file-attachment

-- 
AlvAro

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin why deleting related(null=True) objects?

2009-10-08 Thread Alex Robbins

This sounds related to this ticket http://code.djangoproject.com/ticket/9308,
which supposedly fixed this issue 5 months ago. You should probably
file a bug report.

On Oct 7, 4:19 pm, Peter Sagerson  wrote:
> Yes, Django always cascades deletes. There's talk about providing more  
> options in a future release, but for now it's kind of a problem. I  
> generally find this behavior potentially catastrophic, so I wrote an  
> intermediate model base class that clears all nullable foreign keys  
> before deleting an object:
>
> http://www.djangosnippets.org/snippets/1231/
>
> Note that this probably won't stop the admin app from warning about  
> the anticipated cascade.
>
> On Oct 7, 2009, at 6:37 AM, x_O wrote:
>
>
>
> > Hi
>
> > My question that I'm getting right that situation. I've two models:
>
> > class First(db.models):
> >    second_item = models.ForeignKey('Second',null=True)
> >    ...
>
> > class Second(db.models):
> >    ...
>
> > I've both models registered in admin.py as AdminModels.
>
> > Why when I'm trying to delete some object created from "Second" class
> > which is RELATED to other one created from "First" class, admin is
> > telling me that will remove also that "First" object (relation in
> > ForeignKey is null). I understand that when there is null=False
> > attribute should remove it, by why when it is null=True?
>
> > In my interpretation of that should just leave First object with
> > 'second_item' = None.
>
> > x_O
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django with Cherokee web server

2009-10-08 Thread Tom Evans

On Thu, 2009-10-08 at 16:23 +0100, Oli Warner wrote:
> FUD. You just think it is slow and inefficient because you
> have never
> configured it correctly.
> 
> Analogy time. Gather round, children.
> 
> You buy a car. The dealer said it can do 0 to 60mph in five seconds
> and does 80 miles per gallon. You buy it for these reasons but when
> you receive it and test it, you find you can't even get to 60mph and
> you're only getting 10 miles per gallon.
> 
> You read the manual and find that in order to get optimum figures, you
> have to spend a few hours under the bonnet, completely out of your
> comfort zone, tweaking it to your consider your height, weight and
> shoe size. You're not a mechanic. You don't want to be a mechanic.
> 
> That's what we're talking about here. Sure Apache can do amazing
> things but as a web developer, I'd much rather spend time developing
> web apps than learning and maintaining the platform.
> 
> Cherokee by default it's a lot lighter and helps you create complex
> scenarios quickly and fuss-free.
> 

To stick with your analogy, it actually *is* like buying a car and being
surprised you don't get 0-60 in 5 seconds and 80 mpg, but only because
you will only drive it in second gear. And then you blame the dealer..

>From the way you talk about Apache, you are fearful of it, because you
don't know how to use it correctly, you are uncertain of how to
configure it correctly, and you are doubtful that it will do it's job
properly even if it was configured properly. It is classic FUD.

Millions and millions of websites do run quite nicely on Apache, and we
don't spend a lot of time configuring Apache to make it do so. I'm not
saying that Cherokee or Tornado or any other web stack isn't fast, just
that any FCGI/WSGI container will do pretty much the same job in pretty
much the same manner, with pretty much the same results, especially when
the FCGI/WSGI app it is connecting to is something reasonably heavy,
like django can be.

Cheers

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Automatic primary keys at model inheritance

2009-10-08 Thread Vlastimil Zíma
Hello,
I am using django 1.1 and I discovered this problem:
I have models like these
---
class Place(model.Models)
...

class Restaurant(Place)
...

class Bar(Place)
...
---

the primary key counters for Restaurant and Bar classes are separated, which
causes me troubles, because I want a Place to be Restaurant or Bar not both.

Example:
I create first Restaurant it has pk (place_ptr_id) = 1 and its Place has pk
(id) = 1
Then I create first Bar and it has pk (place_ptr_id) = 1 and its Place has
pk (id) = 1 instead what I expect (Bar.place_ptr_id = Place.id = 2).

I think this may cause a lot of trouble in case you want to have multiple
children models for one parent model (even if you want Place to be both,
Restaurant and Bar, because there is not an easy way to extend Place to Bar,
when you have a Restaurant or Place, or I have not found it).

I wonder if it is bug or a feature. If it is feature I can not find out what
is it useful for.

Vlastimil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: import model from another project-app

2009-10-08 Thread Karen Tracey
On Thu, Oct 8, 2009 at 11:44 AM, Jorge Ercoli  wrote:

>
> Ok Karen , cleaning my post:
>
> I have this two projects with 1 application each other:
>
> ProjectA with AppA (with your model) and ProjectB with AppB (with your
> model).
>
> In the views.py of AppA , i should import the model from AppB:
>
> from ProjectB.AppB.models import *
> (** without brackets, it was only a highlight for the code in the
> first post)
>
> the error is:
> "No module named ProjectB.AppB.models"
>
> Then, in settings.py of ProjectA, in INSTALLED_APPS, i put :
> "ProjectB.AppB", but this error appear in the "runserver" : No module
> named ProjectB.AppB
>
>
(This is a pure Python issue and really has nothing to do with Django.)
These errors indicate ProjectB can't be found on your PYTHONPATH. You'll
need to set the PYTHONPATH to include the parent directory of ProjectB if
you want imports of the form:

from ProjectB.AppB.whatever import anything

to work

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Two cache-related questions

2009-10-08 Thread Christophe Pettus


On Oct 7, 2009, at 12:35 PM, kmike wrote:
> 1. Maybe you can use django's Vary support (
> http://docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers
> ).

Thank you!  The method I came up with was to use the fragment-caching  
facility with the language code as one of the keys, which works,  
although it's a bit tedious.

--
-- Christophe Pettus
x...@thebuild.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: import model from another project-app

2009-10-08 Thread Jorge Ercoli

Ok Karen , cleaning my post:

I have this two projects with 1 application each other:

ProjectA with AppA (with your model) and ProjectB with AppB (with your
model).

In the views.py of AppA , i should import the model from AppB:

 from ProjectB.AppB.models import *
(** without brackets, it was only a highlight for the code in the
first post)

the error is:
"No module named ProjectB.AppB.models"

Then, in settings.py of ProjectA, in INSTALLED_APPS, i put :
"ProjectB.AppB", but this error appear in the "runserver" : No module
named ProjectB.AppB

Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: iphone to website

2009-10-08 Thread Christophe Pettus


> I'm looking at how to send information from the iphone to a django-
> website.

iPhone applications can generate web requests, so you can just  
generate an HTTP(S) request to your web site, and do whatever you want.

--
-- Christophe Pettus
x...@thebuild.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django with Cherokee web server

2009-10-08 Thread Oli Warner
>
> FUD. You just think it is slow and inefficient because you have never
> configured it correctly.
>

Analogy time. Gather round, children.

You buy a car. The dealer said it can do 0 to 60mph in five seconds and does
80 miles per gallon. You buy it for these reasons but when you receive it
and test it, you find you can't even get to 60mph and you're only getting 10
miles per gallon.

You read the manual and find that in order to get optimum figures, you have
to spend a few hours under the bonnet, completely out of your comfort zone,
tweaking it to your consider your height, weight and shoe size. You're not a
mechanic. You don't want to be a mechanic.

That's what we're talking about here. Sure Apache *can* do amazing things
but as a web developer, I'd much rather spend time developing web apps than
learning and maintaining the platform.

Cherokee by default it's a lot lighter and helps you create complex
scenarios quickly and fuss-free.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM

2009-10-08 Thread Geobase Isoscale
Hi all,
Thanks a lot, for the comments. I'm working with PostgreSQL database
together with with Django and GeoDjango. I intended to use views to query
externally joined tables that keep changing based on the updates. I was also
looking at database consistency by taking into account constraints with
triggers being part them. Thats how the discussion on triggers and views
came about.

The other issue is if someone is aware of modelling tools like UML does,
 that converts conceptual design (graphical classes) into django model
classes can forward me their names and user guides.


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 django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: import model from another project-app

2009-10-08 Thread Karen Tracey
On Thu, Oct 8, 2009 at 10:52 AM, Jorge Ercoli  wrote:

>
> If i have, my Proj1 with mi App1 and your Model, and in the Views.py i
> should import a model from an App of another Project :
>
> 
>
>
What's with the brackets?  Are you actually including the brackets in your
.py file?  That's not valid syntax so would cause an error.  Also, you
mention "App1" as being part of your "Proj1" and "App" being part of
"another" project, so it looks a little odd that you are trying to import
"App1", not "App", from "Proj2" (assuming "Proj2" is the other project).  If
you would use the actual names you are using things might be much clearer.
You've either confused things in translating to "generic" names or you are
actually trying to reference apps using incorrect packages, or


>

this command  cause an error,


Why do you make us guess what the error might be?  You're far more likely to
get help if you tell us exactly what error you get.  Also, since you haven't
been clear on what exactly you are doing, specifics of the error might give
us a clue what your code is really doing.


>

i'm tried to put "Proj2.App1" in Proj1
> settings.py Installed-Apps; but not work.
>

You may well need the "other" app you are trying to use listed in
INSTALLED_APPS, but having it there won't have any effect on how the Python
interpreter handles import statements, which is the problem you are talking
about above.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problems subclassing models

2009-10-08 Thread Daniel Roseman

On Oct 8, 4:05 pm, Chris Withers  wrote:
> Hi All,
>
> I have a set of models that all have the same implementation for a
> method, so I thought I'd create a base class for these:
>
> class UrlModel(models.Model):
>      def get_absolute_url(self):
>          return reverse(index,kwargs=dict(fk=self.pk))
>
> ...and then have the relevant models subclass that. However, as soon as
> I did this, I started getting bizarre SQL errors, things like:
>
> ProgrammingError at /some/path
> relation "myapp_urlmodel" does not exist
> LINE 1: ...somefield1"."somefield2" FROM "myapp_modelname" INNER JOIN
> "myapp_urlm...
>
> Why is this?
>
> Chris

If your base model doesn't contain any fields, you should probably
mark it as abstract.
http://docs.djangoproject.com/en/dev/topics/db/models/#id6
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: efficiently deleting content based on how old it is

2009-10-08 Thread Streamweaver

You could set this up as a custom manage.py command and run a cron on
that.  Gives the advantage of both initiating from outside the app and
using Django's DB abstraction layer.

A very simple way to do this would be to put all month text names in
order in a tuple.

i.e.  monthnames = ('jan', 'feb', 'mar',  )  or however your month
names are reflected.  (You can actually generate this list by doing a
'for m in' line and pull out the month names but you get what I mean.

Then just iterate over the month names more than 6 back from the
current position and delete the records.


On Oct 8, 10:54 am, Chris Withers  wrote:
> Tim Chase wrote:
> > I wouldn't try to do it from within the web app itself --
> > I'd schedule some wee-hours cron job to do the deletion.
>
> I plan to, don't worry ;-)
> But, I would like to do it from within the Django environment to make it
> immune to changes of database...
>
> > 6mo boundary.  Your Month is defined as a string, and I
> > don't see any actual date information in it.
>
> Yeah, an unfortunate artifact of the legacy system I'm replacing.
> Months are of the form "September 2009", "August 2009", etc.
> How would you represent those in a Django ORM sensible way?
>
> > In all, I'd just skip Django completely and do something
> > like create a quick shell-script to execute the raw SQL and
> > schedule it to run monthly
>
> You guessed right about the database, but that's a luxury I don't have.
> The database used may change, so I'd like to do this through the Django
> ORM. Does the Django ORM have a sql abstraction layer like sqlalchemy
> where I can do the kind of thing you're proposing, or do I need to work
> with models?
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>             -http://www.simplistix.co.uk
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problems subclassing models

2009-10-08 Thread Chris Withers

Hi All,

I have a set of models that all have the same implementation for a 
method, so I thought I'd create a base class for these:

class UrlModel(models.Model):
 def get_absolute_url(self):
 return reverse(index,kwargs=dict(fk=self.pk))

...and then have the relevant models subclass that. However, as soon as 
I did this, I started getting bizarre SQL errors, things like:

ProgrammingError at /some/path
relation "myapp_urlmodel" does not exist
LINE 1: ...somefield1"."somefield2" FROM "myapp_modelname" INNER JOIN 
"myapp_urlm...

Why is this?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



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, blank=True)
account = models.ForeignKey(Account, null=True, blank=True)
date = models.DateField(null=True, blank=True)
description = models.TextField(blank=True)
memo = models.TextField(blank=True)
quantity = models.FloatField(blank=True)
price = models.FloatField(blank=True)
class Meta:
db_table = u'trans'

>>> t = 
>>> Trans.objects.extra(select={'amount':'quantity*price'}).aggregate(total=Sum('amount'))
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Python/2.6/site-packages/django/db/models/query.py",
line 277, in aggregate
is_summary=True)
  File "/Library/Python/2.6/site-packages/django/db/models/sql/
query.py", line 1471, in add_aggregate
field_list, opts, self.get_initial_alias(), False)
  File "/Library/Python/2.6/site-packages/django/db/models/sql/
query.py", line 1737, in setup_joins
"Choices are: %s" % (name, ", ".join(names)))
FieldError: Cannot resolve keyword 'amount' into field. Choices are:
account, date, description, id, memo, parent, price, quantity, trans
>>>

Am I going about this wrong? This is how I would do it in SQL:

select sum(quantity * price) as total from trans;

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: efficiently deleting content based on how old it is

2009-10-08 Thread Chris Withers

Tim Chase wrote:
> I wouldn't try to do it from within the web app itself --
> I'd schedule some wee-hours cron job to do the deletion.

I plan to, don't worry ;-)
But, I would like to do it from within the Django environment to make it 
immune to changes of database...

> 6mo boundary.  Your Month is defined as a string, and I
> don't see any actual date information in it. 

Yeah, an unfortunate artifact of the legacy system I'm replacing.
Months are of the form "September 2009", "August 2009", etc.
How would you represent those in a Django ORM sensible way?

> In all, I'd just skip Django completely and do something
> like create a quick shell-script to execute the raw SQL and 
> schedule it to run monthly

You guessed right about the database, but that's a luxury I don't have. 
The database used may change, so I'd like to do this through the Django 
ORM. Does the Django ORM have a sql abstraction layer like sqlalchemy 
where I can do the kind of thing you're proposing, or do I need to work 
with models?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



import model from another project-app

2009-10-08 Thread Jorge Ercoli

If i have, my Proj1 with mi App1 and your Model, and in the Views.py i
should import a model from an App of another Project :



this command  cause an error, i'm tried to put "Proj2.App1" in Proj1
settings.py Installed-Apps; but not work.

Any ideas or examples?, thanks in advance.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding the default field types

2009-10-08 Thread Bogdan I. Bursuc

You want the field hidden or not on the form at all ?

if you want it out of the form user 
exlude = ('dri',) on Meta but type exclude with a 'd' :)

On Thu, 2009-10-08 at 07:14 -0700, luca72 wrote:
> I have try it but the field dri is show in the form
> 
> Luca
> 
> On 8 Ott, 16:06, "Mark (Nosrednakram)"  wrote:
> >  Hello Luca,
> >
> >
> >
> > > my models is this:
> > > class Per(models.Model):
> > > dip = models.CharField(max_length=100)
> > > di = models.CharField(max_length=100)
> > > df = models.CharField(max_length=100)
> > > m = models.CharField(max_length=500)
> > > dri = models.CharField(max_length=100)
> >
> > > the form is this:
> >
> > > class PerForm(ModelForm):
> > > class Meta:
> > > model = Per
> >
> > > i need that the field dri is hidden in the render of the form, can you
> > > tell me how i can do this?
> >
> > You can and exclude to your Meta:
> >
> > class PerForm(ModelForm):
> > class Meta:
> > model = Per
> > excluse = ('dri')
> >
> > Hope this Helps,
> > Mark
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



SOLVED - Re: User object subclass appears in App models under Admin instead of Auth

2009-10-08 Thread Gerard

Hi all,

The link below gave the answer. The difference was that I initially 
subclassed User .. I went with an extra table with 1-to-1 relation instead 
as the example stated

Trick under admin is to subclass UserAdmin and re-register the User thingy.

Works like a charm!

Hope this helps, if you dig up the same issue :)

Regards,

Gerard.


Gerard wrote:
> Found a solution that's getting me closer to my goal
> 
> http://www.thenestedfloat.com/articles/displaying-custom-user-profile-fields-in-djangos-admin
> 
> Regards,
> 
> Gerard.
> 
> Gerard wrote:
>> Hi all,
>>
>> I've subclassed Django's User object (also accessible under Admin) to extend 
>> the user profile. But the 'CustomUser' model ends up in the Myapp list 
>> instead of under Auth. I need it 'top level' otherwise I and up with users 
>> for every seperate module/app in my project. Would this be possible?
>>
>> And when using the admins passwd change dialog "change password form." it 
>> returns an error:
>>
>> Warning at /admin/myapp/userprofile/4/password/
>>
>> Truncated incorrect DOUBLE value: '4/password'
>>
>> Anybody seen this before?
>>
>>
>> Thanx a lot.
>>
>> Regards,
>>
>> Gerard.
>>
>>
>> Reference: 
>> http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
>>
>>
> 
> 


-- 
self.url = www.gerardjp.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding the default field types

2009-10-08 Thread luca72

I have try it but the field dri is show in the form

Luca

On 8 Ott, 16:06, "Mark (Nosrednakram)"  wrote:
>  Hello Luca,
>
>
>
> > my models is this:
> > class Per(models.Model):
> >     dip = models.CharField(max_length=100)
> >     di = models.CharField(max_length=100)
> >     df = models.CharField(max_length=100)
> >     m = models.CharField(max_length=500)
> >     dri = models.CharField(max_length=100)
>
> > the form is this:
>
> > class PerForm(ModelForm):
> >     class Meta:
> >         model = Per
>
> > i need that the field dri is hidden in the render of the form, can you
> > tell me how i can do this?
>
> You can and exclude to your Meta:
>
> class PerForm(ModelForm):
>     class Meta:
>         model = Per
>         excluse = ('dri')
>
> Hope this Helps,
> Mark
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding the default field types

2009-10-08 Thread Bogdan I. Bursuc

Yes is simple:
just add the field to the form and will override the model one:
class PerForm(ModelForm):
dri = forms.CharField(max_length=100, widget=forms.HiddenInput())
class Meta:
model = Per
You should check the docs on the Widgets to make sure:
http://docs.djangoproject.com/en/dev/ref/forms/widgets/#ref-forms-widgets

On Thu, 2009-10-08 at 06:58 -0700, luca72 wrote:
> hello
> my models is this:
> class Per(models.Model):
> dip = models.CharField(max_length=100)
> di = models.CharField(max_length=100)
> df = models.CharField(max_length=100)
> m = models.CharField(max_length=500)
> dri = models.CharField(max_length=100)
> 
> the form is this:
> 
> class PerForm(ModelForm):
> class Meta:
> model = Per
> 
> i need that the field dri is hidden in the render of the form, can you
> tell me how i can do this?
> 
> Thanks
> 
> Luca
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding the default field types

2009-10-08 Thread Mark (Nosrednakram)

 Hello Luca,

> my models is this:
> class Per(models.Model):
>     dip = models.CharField(max_length=100)
>     di = models.CharField(max_length=100)
>     df = models.CharField(max_length=100)
>     m = models.CharField(max_length=500)
>     dri = models.CharField(max_length=100)
>
> the form is this:
>
> class PerForm(ModelForm):
>     class Meta:
>         model = Per
>
> i need that the field dri is hidden in the render of the form, can you
> tell me how i can do this?

You can and exclude to your Meta:

class PerForm(ModelForm):
class Meta:
model = Per
excluse = ('dri')

Hope this Helps,
Mark
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Overriding the default field types

2009-10-08 Thread luca72

hello
my models is this:
class Per(models.Model):
dip = models.CharField(max_length=100)
di = models.CharField(max_length=100)
df = models.CharField(max_length=100)
m = models.CharField(max_length=500)
dri = models.CharField(max_length=100)

the form is this:

class PerForm(ModelForm):
class Meta:
model = Per

i need that the field dri is hidden in the render of the form, can you
tell me how i can do this?

Thanks

Luca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM

2009-10-08 Thread Mark (Nosrednakram)

Hello Isoscale,

>  I intend to write ORM code that will create views and triggers in the
> database? Which parts of the source code should I alter?

I use django to access views commonly, primarily for reporting I'll
create views taking care of the complex joins from our ERP so
developers can easily use the ORM.  There are a few things to keep in
mind if you want to use the ORM to access views especially if they are
based on external tables.

  1. ORM expects tables with a single PK
  2. Don't add views into your models.py use another file to define
them

The first one is very important you'll need to come up with a single
unique identifier for each row which can be a concatenated string etc.
If you are using oracle you can use rownum see notes at . Can you explain the your purpose
that requires you to create views and triggers.

Hope this helps,
Mark


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: efficiently deleting content based on how old it is

2009-10-08 Thread Tim Chase

 > I only want to keep 6 months worth of data. How can I
 > efficiently delete a month and all it's associated
 > services and those services associated pages? (in this
 > app, there could be about 3 million pages that are
 > associated with each month though a bunch of service
 > objects)

I wouldn't try to do it from within the web app itself --
I'd schedule some wee-hours cron job to do the deletion.  If
your DB has referential integrity and these are set up as
cascading deletes, you can just delete from Month and the
Service and Page items will go with it automatically.  The
other trick is knowing which months fall off the edge of the
6mo boundary.  Your Month is defined as a string, and I
don't see any actual date information in it.  Having actual
dates instead of month-names would make this a lot easier.

In all, I'd just skip Django completely and do something
like create a quick shell-script to execute the raw SQL and 
schedule it to run monthly

###
   #!/bin/sh
   psql << EOF
DELETE FROM Month
WHERE
 monthname = to_char(
current_date -
interval '6 months',
'MONTH')
 or monthname = to_char(
current_date -
interval '7 months',
'MONTH')
 or monthname = to_char(
current_date -
interval '8 months',
'MONTH')
 or monthname = to_char(
current_date -
interval '9 months',
'MONTH')
 or monthname = to_char(
current_date -
interval '10 months',
'MONTH')
 or monthname = to_char(
current_date -
interval '11 months',
'MONTH')
 or monthname = to_char(
current_date -
interval '12 months',
'MONTH')

   EOF

###

If you had actual date fields, it would be as simple as

   DELETE FROM Month
   WHERE datefield < current_date - INTERVAL '6 months'

(date arithmetic/extraction functions vary from db to db...the 
above should be fairly close to postgres syntax)

-tim






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: iphone to website

2009-10-08 Thread grant neale

Well 1 problem I was thinking about was uploading photos.
Any suggestion.

Grant

On Oct 8, 2009, at 2:39 PM, Chris Withers wrote:

>
> grant neale wrote:
>> Does anyone have a hint on where I should start, re: making the
>> website ready to receive this information?
>
> Doesn't the iPhone have a web browser?
>
> Chris
>
> --  
> Simplistix - Content Management, Batch Processing & Python Consulting
>- http://www.simplistix.co.uk
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is django comment's honeypot really useful?

2009-10-08 Thread Eric Abrahamsen


On Oct 8, 2009, at 8:20 PM, Joshua Partogi wrote:

>
>> even the developers who know what is happening shouldn't complain.
>>
>> I have a site that seems to get crawled by bots quite frequently. I  
>> had a
>> feedback form that didn't have a honeypot originally. I got about  
>> 3-4 pieces
>> of spam a day. Turning on the honey pot, I only have gotten a few  
>> pieces of
>> spam.
>>
>> The honeypot isn't the most effective spam measure but it is an  
>> easy and
>> cheap way to catch the type of spam bots that crawl looking for any  
>> input to
>> place their ugliness. You don't need to ping a service like Askimet  
>> and the
>> item doesn't need to hit the db.
>>
>> IMO there is no reason not to have this in any form that you think  
>> might get
>> spammed. It helps out, and it doesn't harm anything. I would still  
>> use
>> another service for spam as well, but this is the most base check I  
>> can
>> think of.
>
> Okay fair enough. I guess it really is useful to reduce the number of
> spams, although you would still expect spams :-) I have implemented
> captcha before, but I found it very inconvenient for the visitors and
> as you said the operation is quite expensive. Do you have any other
> recommendation of another spam preventer service? I haven't tried
> akismet, it sounds really user-friendly compared to captcha.

+1 for akismet, once you've got it set up it works like a charm, and  
you can adjust your signals so it won't check logged in users or  
approved IPs or whatever. In a year or so of using it I've gotten only  
one real comment marked as spam, and maybe three or four spams have  
gotten through. Not bad.

Michael's point is good: having several layers of spam protection is a  
great idea, and if you put the lightweight ones out front, you can  
maximize protection while minimizing hits on databases or external  
services.

E

>
> Thanks heaps.
>
> -- 
> Certified Scrum Master
> http://twitter.com/scrum8 | http://blog.scrum8.com | http://jobs.scrum8.com
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User object subclass appears in App models under Admin instead of Auth

2009-10-08 Thread Gerard

Found a solution that's getting me closer to my goal

http://www.thenestedfloat.com/articles/displaying-custom-user-profile-fields-in-djangos-admin

Regards,

Gerard.

Gerard wrote:
> Hi all,
> 
> I've subclassed Django's User object (also accessible under Admin) to extend 
> the user profile. But the 'CustomUser' model ends up in the Myapp list 
> instead of under Auth. I need it 'top level' otherwise I and up with users 
> for every seperate module/app in my project. Would this be possible?
> 
> And when using the admins passwd change dialog "change password form." it 
> returns an error:
> 
> Warning at /admin/myapp/userprofile/4/password/
> 
> Truncated incorrect DOUBLE value: '4/password'
> 
> Anybody seen this before?
> 
> 
> Thanx a lot.
> 
> Regards,
> 
> Gerard.
> 
> 
> Reference: 
> http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
> 
> 


-- 
self.url = www.gerardjp.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'

2009-10-08 Thread Sandra Django
Hi, I want add a new attribute in User model and create custom backends.
Steep by steep, I did the following:
1) I created an application named "profile" into my project
2) I created, in models.py of "profile" a class named "UserProfile",
which inherits
from User class of Django. I added "press_agency" attribute, and I wrote
objects = UserManager()
3) I registered UserProfile and UserProfileAdmin classes in admin.py, and
unregistered User of Django.
4) Into my project, I created auth_backends.py file. You should see it here:
http://dpaste.com/hold/101036/
5) In settings.py I wrote:
AUTHENTICATION_BACKENDS = (
'myproject.auth_backends.CustomUserModelBackend', )
   CUSTOM_USER_MODEL = 'myproject.profile.UserProfile'

Then, when I go to login, write mi name and password, y the system returns
the following error:
'NoneType' object has no attribute 'DoesNotExist'
Why? What is the problem?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: iphone to website

2009-10-08 Thread Chris Withers

grant neale wrote:
> Does anyone have a hint on where I should start, re: making the  
> website ready to receive this information?

Doesn't the iPhone have a web browser?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM Cache in a standalone script

2009-10-08 Thread Alexis MINEAUD
Thanks a lot Karen, transaction was the problem. Resolved by :
connection.cursor().execute('set transaction isolation level read
committed')

Have a nice day :)


On Thu, Oct 8, 2009 at 1:52 PM, Karen Tracey  wrote:

> On Thu, Oct 8, 2009 at 5:07 AM, Alexis MINEAUD  wrote:
>
>> Ok, my bad, the  sequence works well, i just confused the field name...
>> But the problem is still there if the update is done by another actor than
>> Django itself.
>>
>> My standalone script is daemon which poll my DB with a XX.objects.all().
>> If i updated myself a row from XX, the daemon doesn't see the modification
>> until i relaunch it.
>>
>> Even a Tag.objects.get(id = 1) for example ignore the update.
>>
>> Is there a way to force the query again ?
>>
>> Django does issue the query again, if you are getting the same result it
> is because that is what the database is returning. You don't mention what
> database you are using. When I have seen this before it has always been due
> to MySQL/InnoDB's default transaction isolation level of repeatable read. If
> that is the DB you are using you might want to read this thread:
>
>
> http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06d/
>
> If you are using a different DB you might want to investigate its
> trasnaction isolation level handling.
>
> Karen
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is django comment's honeypot really useful?

2009-10-08 Thread Joshua Partogi

> even the developers who know what is happening shouldn't complain.
>
> I have a site that seems to get crawled by bots quite frequently. I had a
> feedback form that didn't have a honeypot originally. I got about 3-4 pieces
> of spam a day. Turning on the honey pot, I only have gotten a few pieces of
> spam.
>
> The honeypot isn't the most effective spam measure but it is an easy and
> cheap way to catch the type of spam bots that crawl looking for any input to
> place their ugliness. You don't need to ping a service like Askimet and the
> item doesn't need to hit the db.
>
> IMO there is no reason not to have this in any form that you think might get
> spammed. It helps out, and it doesn't harm anything. I would still use
> another service for spam as well, but this is the most base check I can
> think of.

Okay fair enough. I guess it really is useful to reduce the number of
spams, although you would still expect spams :-) I have implemented
captcha before, but I found it very inconvenient for the visitors and
as you said the operation is quite expensive. Do you have any other
recommendation of another spam preventer service? I haven't tried
akismet, it sounds really user-friendly compared to captcha.

Thanks heaps.

-- 
Certified Scrum Master
http://twitter.com/scrum8 | http://blog.scrum8.com | http://jobs.scrum8.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread luca72

Thanks

On 8 Ott, 12:54, Tom Evans  wrote:
> On Thu, 2009-10-08 at 13:27 +0300, Bogdan I. Bursuc wrote:
> > I'm sorry, but i still can't figure out where the error comes.
> > Can you post your traceback from the error page ?
>
> The error comes because he misspelled 'class Meta' as 'class meta'.
>
> >>> class profilemodelform(ModelForm):
>
> ...   class meta:
> ...     model = UserProfile
> ...>>> a=profilemodelform()
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "~/lib/python2.5/site-packages/django/forms/models.py", line 197,
> in __init__
>     self.instance = opts.model()
> TypeError: 'NoneType' object is not callable
>
> Tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is django comment's honeypot really useful?

2009-10-08 Thread Michael
On Thu, Oct 8, 2009 at 12:12 AM, Kenneth Gonsalves
wrote:

>
> On Thursday 08 Oct 2009 9:32:23 am Joshua Partogi wrote:
> > I want to ask for your advice here regarding the honeypot field in
> > django comments. Is it really useful to prevent spam? Or should we add
> > another method for spam prevention and shouldn't really rely on this
> > honeypot. I currently been getting several spams on my site but I'm
> > not sure whether the spammer is a bot or a human though. If it is a
> > spam bot, it would be very interesting how a bot can recognize there's
> > a hidden honeypot field and by-pass it. Or would a spam bot be able to
> > recognize visible fields and fill in only those visible fields?
> > Anybody have any advise and experience with django comments spam
> > prevention?
>
> the only time I used the honeypot I took tremendous flak from users who
> were
> getting caught in it - and anyway that particular app required a login for
> comments, so I safely removed it.
>
> How did your users know it was there? It should be hidden. If it's hidden,
even the developers who know what is happening shouldn't complain.

I have a site that seems to get crawled by bots quite frequently. I had a
feedback form that didn't have a honeypot originally. I got about 3-4 pieces
of spam a day. Turning on the honey pot, I only have gotten a few pieces of
spam.

The honeypot isn't the most effective spam measure but it is an easy and
cheap way to catch the type of spam bots that crawl looking for any input to
place their ugliness. You don't need to ping a service like Askimet and the
item doesn't need to hit the db.

IMO there is no reason not to have this in any form that you think might get
spammed. It helps out, and it doesn't harm anything. I would still use
another service for spam as well, but this is the most base check I can
think of.

Hppe that helps,

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



User object subclass appears in App models under Admin instead of Auth

2009-10-08 Thread Gerard

Hi all,

I've subclassed Django's User object (also accessible under Admin) to extend 
the user profile. But the 'CustomUser' model ends up in the Myapp list 
instead of under Auth. I need it 'top level' otherwise I and up with users 
for every seperate module/app in my project. Would this be possible?

And when using the admins passwd change dialog "change password form." it 
returns an error:

Warning at /admin/myapp/userprofile/4/password/

Truncated incorrect DOUBLE value: '4/password'

Anybody seen this before?


Thanx a lot.

Regards,

Gerard.


Reference: 
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/


-- 
self.url = www.gerardjp.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM Cache in a standalone script

2009-10-08 Thread Karen Tracey
On Thu, Oct 8, 2009 at 5:07 AM, Alexis MINEAUD  wrote:

> Ok, my bad, the  sequence works well, i just confused the field name...
> But the problem is still there if the update is done by another actor than
> Django itself.
>
> My standalone script is daemon which poll my DB with a XX.objects.all(). If
> i updated myself a row from XX, the daemon doesn't see the modification
> until i relaunch it.
>
> Even a Tag.objects.get(id = 1) for example ignore the update.
>
> Is there a way to force the query again ?
>
> Django does issue the query again, if you are getting the same result it is
because that is what the database is returning. You don't mention what
database you are using. When I have seen this before it has always been due
to MySQL/InnoDB's default transaction isolation level of repeatable read. If
that is the DB you are using you might want to read this thread:

http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06d/

If you are using a different DB you might want to investigate its
trasnaction isolation level handling.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Models for a hockey database

2009-10-08 Thread Christian Wittwer

Hi,

> I have a pretty large site that tracks a football team and it's league
> ( http://www.muskegohitmen.com ).

That sounds interesting.. ;-)

> Things you'll probably want to consider
> Seasons - a very small model class, but organizing things by a season
> becomes pretty tricky with out this.
> Rosters ( players per season )
> Staff ( staff Per season )
> Game category ie, pre-season, regular, playoff, championship.
>    * keeping track of win/losses and ties for each game type.
>
> However, my set up track only 1 team which defined by a simply boolean
> check, and can  be changed at any time. I have a thin layer that keeps
> track of win/losses in the league, but not the stats of the whole
> league.  I have a separate league manager application which handles
> things on a league wide level.
> So this may not fit your purpose exactly.

Thx for your input!
I have to track several teams in several leagues, so it's quite tricky.

> I have a trac site set up. If you are are interested in looking over
> the source shoot me an email esatterwhite -[at]- wi.rr.com. I'll set
> you up with a password.

That would be great, I'll write you a e-mail. Maybe I can use some
parts or get some ideas out of your work!

Chris

> On Oct 7, 4:16 pm, Curt  wrote:
>> Instead of including every player in the Game model, I would add a
>> field to the Player model to assign which team a player belongs to:
>>
>> class Team(models.Model):
>>     name = models.CharField(max_length=60)
>>
>> class Player(models.Model):
>>     surname = models.CharField(max_length=60)
>>     lastname = models.CharField(max_length=60)
>>     team = models.ForeignKey(Team)
>>
>> Now you can just specify the home_team and the away_team in the Game
>> model without having to add every player.
>>
>> For more functionality (like allowing players to switch teams) you
>> could use a through table that includes Player, Team, join_date and
>> leave_date -- The example in the docs is a good starting point for
>> that:http://docs.djangoproject.com/en/dev/topics/db/models/
>>
>> I'm not sure how to answer a), but you can figure out b) because the
>> goal_scorer will be assigned to either home_players or away_players in
>> your original Game model, or the goal_scorer will be assigned to the
>> home_team or away_team in the modified models.
>>
>> On Oct 5, 7:21 am, "c!w"  wrote:
>>
>>
>>
>> > Hi,
>> > I trying to create a hockey database, based on Django.
>> > The heaviest part so long is to define the structure of my models.
>> > There I need some help.
>> > What I have so far..
>>
>> > class Team(models.Model):
>> >     name = models.CharField(max_length=60)
>>
>> > class Player(models.Model):
>> >     surname = models.CharField(max_length=60)
>> >     lastname = models.CharField(max_length=60)
>>
>> > class Game(models.Model):
>> >     date_time = models.DateTimeField()
>> >     home_team = models.ForeignKey(Team,related_name='home_team')
>> >     away_team = models.ForeignKey(Team,related_name='away_team')
>> >     home_players = models.ManyToManyField(Player,blank=True)
>> >     away_players = models.ManyToManyField(Player,blank=True)
>>
>> > class GameGoal(models.Model):
>> >     goal_scorer = models.ForeignKey(Player,blank=True,null=True)
>> >     first_assist = models.ForeignKey(Player,blank=True,null=True)
>> >     game = models.ForeignKey(Game)
>>
>> > So now I have the following problems with these models.
>>
>> > a) How can I limit the choice (in the admin page) of goal_scorer to
>> > Players, which are assigned to the Game?
>> > b) A GameGoal should be connected to the home_team or the away_team,
>> > how can I handle this? Add a foreignkey to Team and  limit the choice
>> > to the both teams?
>> > c) Is there a better way, to define such a case?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Models for a hockey database

2009-10-08 Thread Christian Wittwer

Hi,

> class Team(models.Model):
>    name = models.CharField(max_length=60)
>
> class Player(models.Model):
>    surname = models.CharField(max_length=60)
>    lastname = models.CharField(max_length=60)
>    team = models.ForeignKey(Team)
>
> Now you can just specify the home_team and the away_team in the Game
> model without having to add every player.
>
> For more functionality (like allowing players to switch teams) you
> could use a through table that includes Player, Team, join_date and
> leave_date -- The example in the docs is a good starting point for
> that: http://docs.djangoproject.com/en/dev/topics/db/models/

I guess the models ith a through table won't work, because it's quite
complicated.
On one site I have a roster of my team which will be published on the
site. There you see all guys playing at a specific team.
On the other hand I have a game, where some players played, and some note.
So I have to know, which player played, therefore I have to connect
players to a game. You know what I mean?

> I'm not sure how to answer a), but you can figure out b) because the
> goal_scorer will be assigned to either home_players or away_players in
> your original Game model, or the goal_scorer will be assigned to the
> home_team or away_team in the modified models.

Exactly, if I know the player who shoot the goal I know the team he is
playing at.
I think the big part will be the forms to create/add games and players.
They need a lot of logic and some customizations..

Cheers,
Chris

> On Oct 5, 7:21 am, "c!w"  wrote:
>> Hi,
>> I trying to create a hockey database, based on Django.
>> The heaviest part so long is to define the structure of my models.
>> There I need some help.
>> What I have so far..
>>
>> class Team(models.Model):
>>     name = models.CharField(max_length=60)
>>
>> class Player(models.Model):
>>     surname = models.CharField(max_length=60)
>>     lastname = models.CharField(max_length=60)
>>
>> class Game(models.Model):
>>     date_time = models.DateTimeField()
>>     home_team = models.ForeignKey(Team,related_name='home_team')
>>     away_team = models.ForeignKey(Team,related_name='away_team')
>>     home_players = models.ManyToManyField(Player,blank=True)
>>     away_players = models.ManyToManyField(Player,blank=True)
>>
>> class GameGoal(models.Model):
>>     goal_scorer = models.ForeignKey(Player,blank=True,null=True)
>>     first_assist = models.ForeignKey(Player,blank=True,null=True)
>>     game = models.ForeignKey(Game)
>>
>> So now I have the following problems with these models.
>>
>> a) How can I limit the choice (in the admin page) of goal_scorer to
>> Players, which are assigned to the Game?
>> b) A GameGoal should be connected to the home_team or the away_team,
>> how can I handle this? Add a foreignkey to Team and  limit the choice
>> to the both teams?
>> c) Is there a better way, to define such a case?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread Tom Evans

On Thu, 2009-10-08 at 13:27 +0300, Bogdan I. Bursuc wrote:
> I'm sorry, but i still can't figure out where the error comes.
> Can you post your traceback from the error page ?
> 

The error comes because he misspelled 'class Meta' as 'class meta'.

>>> class profilemodelform(ModelForm):
...   class meta:
... model = UserProfile
... 
>>> a=profilemodelform()
Traceback (most recent call last):
  File "", line 1, in 
  File "~/lib/python2.5/site-packages/django/forms/models.py", line 197,
in __init__
self.instance = opts.model()
TypeError: 'NoneType' object is not callable

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM

2009-10-08 Thread Matt Schinckel

On Oct 8, 6:18 pm, Marek Pietrucha  wrote:
> I see that all of you guy's know what your talking about. I was
> thinking way won't you share some knowledge to this 
> topic:http://groups.google.com/group/django-users/browse_thread/thread/1517...
>

What does this have to do with this thread?  You have asked the
question, asking it again isn't likely to (at least this soon) result
in more response.

Matt.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: QuerySets with annonate, count() and multiple fields

2009-10-08 Thread Emily Rodgers



On Oct 8, 8:36 am, Emily Rodgers 
wrote:
> On 8 Oct, 01:31, Russell Keith-Magee  wrote:
>
>
>
> > On Thu, Oct 8, 2009 at 1:43 AM, Emily Rodgers
>
> >  wrote:
>
> > > Hello,
>
> > > I am a bit stuck on something that I think ought to be really easy (so
> > > I am probably being really stupid!).
>
> > > I am trying to write a view for a model such that I can pass the view
> > > (via post data) a (or an unknown) number of fields of that model, and
> > > receive back a list of dictionaries of distinct values for those
> > > fields and the number of times that combination of values appears.
>
> > > So, suppose the model was for holding data about cars, and it had
> > > fields 'manufacturer', 'model', 'fuel_type', 'colour', 'n_of_doors',
> > > etc where the fields had appropriate field types (a mixture of
> > > different field types), I would want to be able to pass the view for
> > > example groupBy=['colour', 'fuel_type'], and it would return a dict of
> > > distinct colour/fuel type combinations and how many cars there are in
> > > the db with those combinations, eg. [{'colour': 'red', 'fuel_type:
> > > 'diesel', 'count': 14}, ...].
>
> > > To me it seems like the kind of thing you would want to use annotate
> > > and Count for, except Count takes one field not multiple fields.
>
> > Depending on the exact result you're looking for, this may not be a
> > problem. The following query may do the job:
>
> > Car.objects.values('make','model').annotate(count=Count('id'))
>
> > will give you a list of  (make, model, count) indicating how many
> > instances of each make-model pair there are.
>
> > The complication here is exactly what you want to count. Are you looking 
> > for:
> >  * The number of rows that have every make/model combination?
> > or
> >  * The number of distinct combinations for every make/model combination?
>
> > Consider the following data:
>
> > Ford | Explorer | Black
> > Ford | Explorer | Black
> > Ford | Explorer | Blue
> > Ford | Explorer | Red
> > Dodge | Charger | Red
>
> > The query I gave you will return (Ford, Explorer, 4), (Dodge, Charger,
> > 1). However, if you want to collapse the two "black Ford Explorer"
> > entries and only return a count of 3, you're out of luck. For that you
> > need to specify multiple columns to the Count(), which Django doesn't
> > support. If this is what you need, you'll need to fall back on using
> > raw SQL.
>
> > Yours,
> > Russ Magee %-)
>
> Ah your suggestion is exactly what I am after :)
>
> Although, I think if there are foreign keys (or choices for the field)
> etc, values() tends to return the id of the value, which means I have
> to go figure out which model it relates to, then find that record, and
> get the user friendly data (I am returning this using JSON to a ExtJS
> script). This starts to make it expensive again.
>
> I will have a play with your suggestion though - thanks :)
>
> Emily

Realised I was being dumb, and you can follow the foreign keys to get
more useful values by specifying them when you pass the strings to
values() :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Models for a hockey database

2009-10-08 Thread esatterwh...@wi.rr.com

I have a pretty large site that tracks a football team and it's league
( http://www.muskegohitmen.com ).

What I did was to have an abstract base statistics class that is
attached to a player/user.

then mad a class for every stat i wanted to track
class Statistics(models.Model):
#base class (abstract?)
#for_player =models.ForeignKey(User,
related_name = "%(class)s_related")
for_player =models.ForeignKey(Member,
related_name = "%(class)s_related")
for_game =  models.ForeignKey
(Game,related_name = "%(class)s_related" )
date_stamp =models.PositiveIntegerField
(editable=False)

def save(self, force_insert=False, force_update=False):
ds = self.for_game.date_scheduled
self.date_stamp=ds.year
super(Statistics, self).save(force_insert, force_update)
class Meta:
abstract = True

@models.permalink
def get_absolute_url(self):
return '%d/%d"%d/statistics/' %
(self.for_game.date_scheduled.year,self.for_game.date_scheduled.month,self.for_game.date_scheduled.day)
get_absolute_url = permalink(get_absolute_url)

#===
# OFFENSE
#  ALL % AND AVG ARE DONE AUTOMATICALLY - NO NEED TO INCLUDE THEM
HERE
#===


class PassingStatistics(Statistics):
#passing
passing_attempts =  models.PositiveSmallIntegerField
('Attempts',default = 0)
passing_completions =   models.PositiveSmallIntegerField
('Completions',default = 0)
passing_tot_yards = models.PositiveSmallIntegerField
('Total Yards',default = 0)
passing_tds =   models.PositiveSmallIntegerField
('Touchdowns', default = 0)
passing_interceptions = models.PositiveSmallIntegerField
('Interceptions', default = 0)
class Meta:
verbose_name = 'Passing Statistics'
verbose_name_plural = 'Passing Statistics'

def passing_percentage(self):
if self.passing_attempts == 0:
return 0
else:
return (( float(self.passing_completions) / float
(self.passing_attempts) ) * 100)
#==get_qb_rating
=
#if no statsDict is passed, we calculate QB rating for the current
Game instance
#Can easily re - use to calc for a span of games, career, season,
etc
#http://en.wikipedia.org/wiki/Passer_rating
#=
def get_qb_rating(self, statsDict=None):

# store in variables to cut on memory / stack overflow &
Processor cycles
"""
C = Passing Completions
Y = Passing Yards Per Attempt
T = Passing Touchdowns Per Attempt
I + Interceptions Per Attempts

Pass in a dictionary named statsDict if the Passing
Statisitcs you wish to calculate
statsDict["completions"]
statsDict["attempts"]
statsDict["yards"]
statsDict["touchdowns"]
statsDict["interceptions"]

If no dictionary is passed, the function will calculate a
QB rating for current game the stats
associated with.

C = ( (self.passing_completions / self.passing_attempts)*100 -
30) / 20
Y = ((self.passing_tot_yards / self.passing_attempts)-3) *
(1/4)
T = (self.passing_tds / self.passing_attempts) * 20
I = 2.375 - ( (self.passing_interceptions /
self.passing_attempts) * 25 )

rating = (( max(min(C, 2.375),0 ) + max(min(Y,2.375),0)  + max
(min(T, 2.375),0) + max(min(I,2.375),0))/ 6) *100

"""
if statsDict is not None:
C = float(( (float(statsDict['completions']) / float
(statsDict['attempts'])*100 - 30)) / 20 )
Y = ((statsDict['yards'] / statsDict['attempts']) - 3) /4
T = float((statsDict['touchdowns']) / float(statsDict
['attempts']) * 20)
I = float(2.375 - ((float(statsDict['interceptions']) /
float(statsDict['attempts'])) * 25 ))

rating = (( max(min(C, 2.375),0 ) + max(min(Y,2.375),0)  +
max(min(T, 2.375),0) + max(min(I,2.375),0))/ 6) *100
return rating


C = float(( (float(self.passing_completions) / float
(self.passing_attempts)*100 - 30)) / 20 )
Y = ((self.passing_tot_yards / self.passing_attempts) - 3) /4
T = float((float(self.passing_tds) / float
(self.passing_attempts)) * 20)
I = float(2.375 - ((float(self.passing_interceptions) / float
(self.passing_attempts)) * 25 ))

rating = float((( max(min(C, 2.375),0 ) + max(min(Y,2.375),0)
+ max(min(T, 2.375),0) + max(min(I,2.375),0))/ 6) *100)
return rating


class RushingStatistics(Statistics):
#rushing
rushing_carries =  

Re: ModelForm

2009-10-08 Thread Bogdan I. Bursuc

I'm sorry, but i still can't figure out where the error comes.
Can you post your traceback from the error page ?

On Thu, 2009-10-08 at 02:24 -0700, luca72 wrote:
> Hello and thanks for your help
> This is the form
> 
> 
>  www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> http://www.w3.org/1999/xhtml; xml:lang="en" lang="en">
> 
> {{titolo}}
> 
> 
> 
>  
>  {{form.as_table}}
>  
> 
> 
> 
> 
> 
> Luca
> 
> On 8 Ott, 10:33, "Bogdan I. Bursuc"  wrote:
> > so the error comes up at the first access
> > could you please post the template where you render the form, i think
> > the error is there, you try to access something that isn't set yet.
> >
> > On Thu, 2009-10-08 at 01:28 -0700, luca72 wrote:
> > > Hello this is the views file
> >
> > > from django.http import HttpResponse
> > > from django.shortcuts import render_to_response
> > > from models import *
> > > from forms import PermessiForm
> >
> > > def mostro_permesso(request):
> > > titolo = 'Richiesta Permessi'
> > > if request.method == 'POST':
> > > form = PermessiForm(request.POST)
> > > if form.is_valid():
> > > return render_to_response('richiesta_permesso.html',
> > > {'form': form, 'titolo':titolo})
> > > else :
> > > return render_to_response('richiesta_permesso.html',
> > > {'form': form, 'titolo':titolo})
> > > else :
> > > form = PermessiForm()
> > > return render_to_response('richiesta_permesso.html',{'form':
> > > form, 'titolo':titolo})
> >
> > > This is the urls:
> >
> > > from django.conf.urls.defaults import *
> > > from django.contrib import admin
> > > admin.autodiscover()
> >
> > > urlpatterns = patterns('',
> > >  (r'^admin/', include(admin.site.urls)),
> > >  (r'^mostro_permesso/', 'rm.remi.views.mostro_permesso'),
> > > )
> >
> > > On 8 Ott, 09:07, "Bogdan I. Bursuc"  wrote:
> > > > I think we need a little more info here, post your urls.py that contain
> > > > mostro_permesso url and your view that is linked to that url.
> >
> > > > On Thu, 2009-10-08 at 00:04 -0700, luca72 wrote:
> > > > > Hello this is my model:
> > > > > from django.db import models
> >
> > > > > class Per(models.Model):
> > > > > dip = models.CharField(max_length=100)
> > > > > data_ini = models.CharField(max_length=100)
> > > > > data_fin = models.CharField(max_length=100)
> > > > > mot = models.CharField(max_length=500)
> > > > > data_rich= models.CharField(max_length=100)
> >
> > > > > and this is the forms:
> >
> > > > > from django.forms import ModelForm
> > > > > from models import Per
> >
> > > > > class PermessiForm(ModelForm):
> > > > > class meta:
> > > > > model = Per
> >
> > > > > I get this error :
> >
> > > > > TypeError at /mostro_permesso/
> >
> > > > > 'NoneType' object is not callable
> >
> > > > > Request Method:GET
> > > > > Request URL:  http://127.0.0.1:8000/mostro_permesso/
> > > > > Exception Type:TypeError
> > > > > Exception Value:
> >
> > > > > 'NoneType' object is not callable
> >
> > > > > can you tell me where is the error
> >
> > > > > Thanks
> >
> > > > > Luca
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



new permission

2009-10-08 Thread elminio

Hi,
I've extended my model with new permission.

  class Meta:
permissions = (
("total", "total"),
)

After that I mafe manage.py syncdb. But after that when I wanted to
add user new privilage just created there wasn't it in admin panel
where you can choose permissions add and remove from user.

thanks for help


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



efficiently deleting content based on how old it is

2009-10-08 Thread Chris Withers

Hi All,

I have a set of models structured roughly as follows:

class Month(models.Model):
 monthname = models.CharField(
 max_length=14,
 db_index=True,
 verbose_name='Month'
 )
 ...

class Service(models.Model):
 month = models.ForeignKey(Month)
 service = models.CharField(
 max_length=255,
 db_index=True,
 )
 ...

class Page(models.Model):
 service = models.ForeignKey(Service)
 ...

I only want to keep 6 months worth of data. How can I efficiently delete 
  a month and all it's associated services and those services associated 
pages? (in this app, there could be about 3 million pages that are 
associated with each month though a bunch of service objects)


cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread luca72

Hello and thanks for your help
This is the form



http://www.w3.org/1999/xhtml; xml:lang="en" lang="en">

{{titolo}}



 
 {{form.as_table}}
 





Luca

On 8 Ott, 10:33, "Bogdan I. Bursuc"  wrote:
> so the error comes up at the first access
> could you please post the template where you render the form, i think
> the error is there, you try to access something that isn't set yet.
>
> On Thu, 2009-10-08 at 01:28 -0700, luca72 wrote:
> > Hello this is the views file
>
> > from django.http import HttpResponse
> > from django.shortcuts import render_to_response
> > from models import *
> > from forms import PermessiForm
>
> > def mostro_permesso(request):
> >     titolo = 'Richiesta Permessi'
> >     if request.method == 'POST':
> >         form = PermessiForm(request.POST)
> >         if form.is_valid():
> >             return render_to_response('richiesta_permesso.html',
> > {'form': form, 'titolo':titolo})
> >         else :
> >             return render_to_response('richiesta_permesso.html',
> > {'form': form, 'titolo':titolo})
> >     else :
> >         form = PermessiForm()
> >         return render_to_response('richiesta_permesso.html',{'form':
> > form, 'titolo':titolo})
>
> > This is the urls:
>
> > from django.conf.urls.defaults import *
> > from django.contrib import admin
> > admin.autodiscover()
>
> > urlpatterns = patterns('',
> >      (r'^admin/', include(admin.site.urls)),
> >      (r'^mostro_permesso/', 'rm.remi.views.mostro_permesso'),
> > )
>
> > On 8 Ott, 09:07, "Bogdan I. Bursuc"  wrote:
> > > I think we need a little more info here, post your urls.py that contain
> > > mostro_permesso url and your view that is linked to that url.
>
> > > On Thu, 2009-10-08 at 00:04 -0700, luca72 wrote:
> > > > Hello this is my model:
> > > > from django.db import models
>
> > > > class Per(models.Model):
> > > >     dip = models.CharField(max_length=100)
> > > >     data_ini = models.CharField(max_length=100)
> > > >     data_fin = models.CharField(max_length=100)
> > > >     mot = models.CharField(max_length=500)
> > > >     data_rich= models.CharField(max_length=100)
>
> > > > and this is the forms:
>
> > > > from django.forms import ModelForm
> > > > from models import Per
>
> > > > class PermessiForm(ModelForm):
> > > >     class meta:
> > > >         model = Per
>
> > > > I get this error :
>
> > > > TypeError at /mostro_permesso/
>
> > > > 'NoneType' object is not callable
>
> > > > Request Method:    GET
> > > > Request URL:      http://127.0.0.1:8000/mostro_permesso/
> > > > Exception Type:    TypeError
> > > > Exception Value:
>
> > > > 'NoneType' object is not callable
>
> > > > can you tell me where is the error
>
> > > > Thanks
>
> > > > Luca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread Tom Evans

On Thu, 2009-10-08 at 00:04 -0700, luca72 wrote:
> Hello this is my model:
> from django.db import models
> 
> 
> class Per(models.Model):
> dip = models.CharField(max_length=100)
> data_ini = models.CharField(max_length=100)
> data_fin = models.CharField(max_length=100)
> mot = models.CharField(max_length=500)
> data_rich= models.CharField(max_length=100)
> 
> and this is the forms:
> 
> from django.forms import ModelForm
> from models import Per
> 
> 
> class PermessiForm(ModelForm):
> class meta:
> model = Per
> 
> I get this error :
> 
> TypeError at /mostro_permesso/
> 
> 'NoneType' object is not callable
> 
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/mostro_permesso/
> Exception Type:   TypeError
> Exception Value:
> 
> 'NoneType' object is not callable
> 
> can you tell me where is the error
> 
> Thanks
> 
> Luca

What happens if you name the meta class correctly? ie 'class Meta' not
'class meta'.

Cheers

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM Cache in a standalone script

2009-10-08 Thread Alexis MINEAUD
Ok, my bad, the  sequence works well, i just confused the field name...
But the problem is still there if the update is done by another actor than
Django itself.

My standalone script is daemon which poll my DB with a XX.objects.all(). If
i updated myself a row from XX, the daemon doesn't see the modification
until i relaunch it.

Even a Tag.objects.get(id = 1) for example ignore the update.

Is there a way to force the query again ?





On Thu, Oct 8, 2009 at 2:05 AM, Karen Tracey  wrote:

> On Wed, Oct 7, 2009 at 7:39 PM, laligatz  wrote:
>
>>
>> Hi everybody.
>>
>> I'm stuck on a problem with the Django ORM.
>> After a basic query like select * from table where id = 1, the result
>> is still the same although i've update the row in the DB.
>>
>> Example:
>>
>> >>> Tag.objects.all()
>> []
>>
>> >>> tag = Tag.objects.all().get()
>> >>> tag
>> 
>>
>> >>>  tag.name = 'tag11'
>> >>>  tag.save()
>>
>> >>>  Tag.objects.all()
>> []
>>
>> How to say to Django to make the query again ?
>>
>>
> I cannot recreate this.  With this model:
>
> class Tag(models.Model):
>name = models.CharField(max_length=22)
>def __unicode__(self):
>   return self.name
>
> your sequence of commands produces:
>
> >>> from ttt.models import Tag
> >>> Tag.objects.all()
> []
> >>> Tag.objects.create(name='tag1')
> 
> >>> Tag.objects.all()
> []
> >>> tag = Tag.objects.get()
> >>> tag
> 
> >>> tag.name = 'tag11'
> >>> tag.save()
> >>> Tag.objects.all()
> []
>
> Is there something you've left out of your account that might be a clue?
> What's this standalone script mentioned in the subject?  Despite looking
> like your sequence is from a singe python shell session, is the update being
> done by a different shell/script than the query?  If so, and if you are
> using MySQL/InnoDB I suspect the problem is to do its default transaction
> isolation level.  But at this point point I'm leaping pretty high to a
> conclusion based on guesses about what you might be doing, not what you've
> actually said you are doing.
>
> Karen
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



bulk import limits?

2009-10-08 Thread Chris Withers

Hi All,

I need to import data from a legacy app (non-relational database).

I was planning to do an xml dump from the old app (which is now done and 
working) but turns out that the app has rather more data in it than I 
realised ;-)

I need to import about 40 million rows into one table.
I take it I'll need to chunk the data up into reasonable-sized xml files.

My questions is: what limits the size of the xml file that can be 
imported with djangoadmin's loaddata command? What would people 
recommend as a maximum size of xml file to use with this command?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



iphone to website

2009-10-08 Thread grant neale

Hi,

I'm looking at how to send information from the iphone to a django- 
website.
Via email or via an app(like the one that wordpress uses) or by an app  
that I will build.

Does anyone have a hint on where I should start, re: making the  
website ready to receive this information?

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django with Cherokee web server

2009-10-08 Thread Tom Evans

On Wed, 2009-10-07 at 23:54 +0100, Oli Warner wrote:
> People quite happily run Django on memory starved VPS systems
> using
> Apache/mod_wsgi with optional nginx front end for static
> files.
> 
> Apache is woefully slow and inefficient at static serving. A static
> reverse proxy is not optional for sane people.
> 
> And I'd rather just admin one server.
> 

FUD. You just think it is slow and inefficient because you have never
configured it correctly. 

However, that is largely irrelevant. There is no tangible difference in
speed serving django from one fcgi/wsgi server than from almost any
other. Anything you do in django will be orders of magnitude slower than
what the server does.

Cheers

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread Bogdan I. Bursuc

so the error comes up at the first access 
could you please post the template where you render the form, i think
the error is there, you try to access something that isn't set yet.

On Thu, 2009-10-08 at 01:28 -0700, luca72 wrote:
> Hello this is the views file
> 
> from django.http import HttpResponse
> from django.shortcuts import render_to_response
> from models import *
> from forms import PermessiForm
> 
> def mostro_permesso(request):
> titolo = 'Richiesta Permessi'
> if request.method == 'POST':
> form = PermessiForm(request.POST)
> if form.is_valid():
> return render_to_response('richiesta_permesso.html',
> {'form': form, 'titolo':titolo})
> else :
> return render_to_response('richiesta_permesso.html',
> {'form': form, 'titolo':titolo})
> else :
> form = PermessiForm()
> return render_to_response('richiesta_permesso.html',{'form':
> form, 'titolo':titolo})
> 
> This is the urls:
> 
> from django.conf.urls.defaults import *
> from django.contrib import admin
> admin.autodiscover()
> 
> 
> urlpatterns = patterns('',
>  (r'^admin/', include(admin.site.urls)),
>  (r'^mostro_permesso/', 'rm.remi.views.mostro_permesso'),
> )
> 
> 
> 
> 
> On 8 Ott, 09:07, "Bogdan I. Bursuc"  wrote:
> > I think we need a little more info here, post your urls.py that contain
> > mostro_permesso url and your view that is linked to that url.
> >
> > On Thu, 2009-10-08 at 00:04 -0700, luca72 wrote:
> > > Hello this is my model:
> > > from django.db import models
> >
> > > class Per(models.Model):
> > > dip = models.CharField(max_length=100)
> > > data_ini = models.CharField(max_length=100)
> > > data_fin = models.CharField(max_length=100)
> > > mot = models.CharField(max_length=500)
> > > data_rich= models.CharField(max_length=100)
> >
> > > and this is the forms:
> >
> > > from django.forms import ModelForm
> > > from models import Per
> >
> > > class PermessiForm(ModelForm):
> > > class meta:
> > > model = Per
> >
> > > I get this error :
> >
> > > TypeError at /mostro_permesso/
> >
> > > 'NoneType' object is not callable
> >
> > > Request Method:GET
> > > Request URL:  http://127.0.0.1:8000/mostro_permesso/
> > > Exception Type:TypeError
> > > Exception Value:
> >
> > > 'NoneType' object is not callable
> >
> > > can you tell me where is the error
> >
> > > Thanks
> >
> > > Luca
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread luca72

Hello this is the views file

from django.http import HttpResponse
from django.shortcuts import render_to_response
from models import *
from forms import PermessiForm

def mostro_permesso(request):
titolo = 'Richiesta Permessi'
if request.method == 'POST':
form = PermessiForm(request.POST)
if form.is_valid():
return render_to_response('richiesta_permesso.html',
{'form': form, 'titolo':titolo})
else :
return render_to_response('richiesta_permesso.html',
{'form': form, 'titolo':titolo})
else :
form = PermessiForm()
return render_to_response('richiesta_permesso.html',{'form':
form, 'titolo':titolo})

This is the urls:

from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()


urlpatterns = patterns('',
 (r'^admin/', include(admin.site.urls)),
 (r'^mostro_permesso/', 'rm.remi.views.mostro_permesso'),
)




On 8 Ott, 09:07, "Bogdan I. Bursuc"  wrote:
> I think we need a little more info here, post your urls.py that contain
> mostro_permesso url and your view that is linked to that url.
>
> On Thu, 2009-10-08 at 00:04 -0700, luca72 wrote:
> > Hello this is my model:
> > from django.db import models
>
> > class Per(models.Model):
> >     dip = models.CharField(max_length=100)
> >     data_ini = models.CharField(max_length=100)
> >     data_fin = models.CharField(max_length=100)
> >     mot = models.CharField(max_length=500)
> >     data_rich= models.CharField(max_length=100)
>
> > and this is the forms:
>
> > from django.forms import ModelForm
> > from models import Per
>
> > class PermessiForm(ModelForm):
> >     class meta:
> >         model = Per
>
> > I get this error :
>
> > TypeError at /mostro_permesso/
>
> > 'NoneType' object is not callable
>
> > Request Method:    GET
> > Request URL:      http://127.0.0.1:8000/mostro_permesso/
> > Exception Type:    TypeError
> > Exception Value:
>
> > 'NoneType' object is not callable
>
> > can you tell me where is the error
>
> > Thanks
>
> > Luca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ORM

2009-10-08 Thread Marek Pietrucha

I see that all of you guy's know what your talking about. I was
thinking way won't you share some knowledge to this topic:
http://groups.google.com/group/django-users/browse_thread/thread/1517053b51a1d7c8/

Please read and give some response.

best regards.

On Oct 7, 7:05 pm, Christophe Pettus  wrote:
> On Oct 7, 2009, at 2:30 AM, Geobase Isoscale wrote:
>
> >  I intend to write ORM code that will create views and triggers in  
> > the database? Which parts of the source code should I alter?
>
> Django can work just fine with views and triggers, but the Django ORM  
> layer will not create them for you.  Views tend to be extremely  
> database-specific, and triggers even more so.
>
> In the case of views, you can create them using the database's native  
> view creation mechanism, and then set up a Django model to access  
> them, just as if they were a table (in this case, you would not use  
> syncdb to create the tables).  If you are using PostgreSQL, you can  
> even set them up to be updatable using the rules system.  As long as  
> they can be used just like a table with standard SQL SELECT / INSERT /  
> DELETE, Django should be perfectly happy to access them.
>
> In the case of triggers, there's no reason that a database that Django  
> is accessing cannot use triggers.  The only thing to keep in mind is  
> that if a trigger modifies a database row that also exists in memory  
> as a model object instance, nothing will cause the model object  
> instance to automatically reflect the changes in the database row, so  
> you might have "cache" consistency problems.
>
> So, if what you are asking is, "Can I use the Django ORM to access a  
> database in which I have created views and triggers," the answer is  
> "yes, provided you understand potential interactions."  If the  
> question is, "Can the Django ORM create views and triggers in the  
> database through its API," the answer is no.
> --
> -- Christophe Pettus
>     x...@thebuild.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: QuerySets with annonate, count() and multiple fields

2009-10-08 Thread Emily Rodgers



On 8 Oct, 01:31, Russell Keith-Magee  wrote:
> On Thu, Oct 8, 2009 at 1:43 AM, Emily Rodgers
>
>
>
>  wrote:
>
> > Hello,
>
> > I am a bit stuck on something that I think ought to be really easy (so
> > I am probably being really stupid!).
>
> > I am trying to write a view for a model such that I can pass the view
> > (via post data) a (or an unknown) number of fields of that model, and
> > receive back a list of dictionaries of distinct values for those
> > fields and the number of times that combination of values appears.
>
> > So, suppose the model was for holding data about cars, and it had
> > fields 'manufacturer', 'model', 'fuel_type', 'colour', 'n_of_doors',
> > etc where the fields had appropriate field types (a mixture of
> > different field types), I would want to be able to pass the view for
> > example groupBy=['colour', 'fuel_type'], and it would return a dict of
> > distinct colour/fuel type combinations and how many cars there are in
> > the db with those combinations, eg. [{'colour': 'red', 'fuel_type:
> > 'diesel', 'count': 14}, ...].
>
> > To me it seems like the kind of thing you would want to use annotate
> > and Count for, except Count takes one field not multiple fields.
>
> Depending on the exact result you're looking for, this may not be a
> problem. The following query may do the job:
>
> Car.objects.values('make','model').annotate(count=Count('id'))
>
> will give you a list of  (make, model, count) indicating how many
> instances of each make-model pair there are.
>
> The complication here is exactly what you want to count. Are you looking for:
>  * The number of rows that have every make/model combination?
> or
>  * The number of distinct combinations for every make/model combination?
>
> Consider the following data:
>
> Ford | Explorer | Black
> Ford | Explorer | Black
> Ford | Explorer | Blue
> Ford | Explorer | Red
> Dodge | Charger | Red
>
> The query I gave you will return (Ford, Explorer, 4), (Dodge, Charger,
> 1). However, if you want to collapse the two "black Ford Explorer"
> entries and only return a count of 3, you're out of luck. For that you
> need to specify multiple columns to the Count(), which Django doesn't
> support. If this is what you need, you'll need to fall back on using
> raw SQL.
>
> Yours,
> Russ Magee %-)

Ah your suggestion is exactly what I am after :)

Although, I think if there are foreign keys (or choices for the field)
etc, values() tends to return the id of the value, which means I have
to go figure out which model it relates to, then find that record, and
get the user friendly data (I am returning this using JSON to a ExtJS
script). This starts to make it expensive again.

I will have a play with your suggestion though - thanks :)

Emily
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ModelForm

2009-10-08 Thread Bogdan I. Bursuc

I think we need a little more info here, post your urls.py that contain
mostro_permesso url and your view that is linked to that url.

On Thu, 2009-10-08 at 00:04 -0700, luca72 wrote:
> Hello this is my model:
> from django.db import models
> 
> 
> class Per(models.Model):
> dip = models.CharField(max_length=100)
> data_ini = models.CharField(max_length=100)
> data_fin = models.CharField(max_length=100)
> mot = models.CharField(max_length=500)
> data_rich= models.CharField(max_length=100)
> 
> and this is the forms:
> 
> from django.forms import ModelForm
> from models import Per
> 
> 
> class PermessiForm(ModelForm):
> class meta:
> model = Per
> 
> I get this error :
> 
> TypeError at /mostro_permesso/
> 
> 'NoneType' object is not callable
> 
> Request Method:   GET
> Request URL:  http://127.0.0.1:8000/mostro_permesso/
> Exception Type:   TypeError
> Exception Value:
> 
> 'NoneType' object is not callable
> 
> can you tell me where is the error
> 
> Thanks
> 
> Luca
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ModelForm

2009-10-08 Thread luca72

Hello this is my model:
from django.db import models


class Per(models.Model):
dip = models.CharField(max_length=100)
data_ini = models.CharField(max_length=100)
data_fin = models.CharField(max_length=100)
mot = models.CharField(max_length=500)
data_rich= models.CharField(max_length=100)

and this is the forms:

from django.forms import ModelForm
from models import Per


class PermessiForm(ModelForm):
class meta:
model = Per

I get this error :

TypeError at /mostro_permesso/

'NoneType' object is not callable

Request Method: GET
Request URL:http://127.0.0.1:8000/mostro_permesso/
Exception Type: TypeError
Exception Value:

'NoneType' object is not callable

can you tell me where is the error

Thanks

Luca
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---