how can i wsdl file in my django

2010-10-23 Thread sami nathan
After completing my project i need to use wsdl file for web service
how could i use it any sugesstions

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: RelatedManager bug?

2010-10-23 Thread Lucasm
Thanks for the reply, I wasn't aware of that.

However, it seems that I should do the following, but I still can't
get it to print the message :s.

from django.db import models

class MyManager(models.Manager):
use_for_related_fields = True

def create(self, *args, **kwargs):
print "I am called!"
return super(MyManager, self).create(*args, **kwargs)


class OtherModel(models.Model):
pass


class MyModel(models.Model):
other_model = models.ForeignKey(OtherModel,
related_name='my_models')
objects = MyManager()

om = OtherModel.objects.create()
om.my_models.create()


On 21 Okt, 17:18, Daniel Roseman  wrote:
> On Oct 21, 4:01 pm, Lucasm  wrote:
>
>
>
>
>
> > It seems that the following does not work as expected:
>
> > from django.db import models
>
> > class MyManager(models.Manager):
> >     def create(self, *args, **kwargs):
> >         print "I am called!"
> >         return super(MyManager, self).create(*args, **kwargs)
>
> > class OtherModel(models.Model):
> >     pass
>
> > class MyModel(models.Model):
> >     other_model = models.ForeignKey(OtherModel,
> > related_name='my_models')
> >     objects = MyManager()
>
> > >>> other_model = OtherModel.objects.create()
> > >>> other_model.my_models.create()
>
> > The message is not printed!
>
> > (I'm using Django v1.2.3)
>
> Expected behaviour - you need to set the `use_for_related_fields`
> flag. Read 
> this:http://docs.djangoproject.com/en/1.2/topics/db/managers/#using-manage...
> --
> 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-us...@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: moving from Postgres to MySQL

2010-10-23 Thread Kevin Monceaux
On Fri, Oct 22, 2010 at 07:58:20AM +0100, Chris Withers wrote:

> On 21/10/2010 15:40, ringemup wrote:
> >MySQL has a tool (mysqldump) that will output the contents of an
> >entire database to a SQL file that can then be loaded directly into
> >another database.  Does Postgres not have anything analogous?
> 
> Sure, pg_dumpall. Now, what're the chances of the SQL that spits out
> being parsed correctly by MySQL without complaint? ;-)

I think the OP was referring to mysqldump's --compatible option which
one could use, for example, as mysqldump --compatible=postgresql ...
If pg_dumpall has a similar option chances are good it could produce
SQL that MySQL would be happy with.  But, I don't think pg_dumpall has
such an option.



-- 

Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

What's the definition of a legacy system?  One that works! 
Errare humanum est, ignoscere caninum.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: login_required and new class based views

2010-10-23 Thread Joachim Pileborg

On 19 Okt, 21:18, Łukasz Rekucki  wrote:
> On 19 October 2010 19:06, Valentin Golev  wrote:> Hello,
> > I was going to write something like LoginRequiredMixin, but I have no
> > idea how to do this. I need to run my code before .dispatch(), but I
> > also have to call the old dispatch, but since Mixin aren't inherited
> > from View, I can't just override method and use super().
>
> This is option #4. You can just do:
>
> class LoginRequiredMixin(object):
>
> def dispatch(self, *args, **kwargs):
> bound_dispatch = super(LoginRequired, self).dispatch
> return login_required(bound_dispatch)(*args, **kwargs)

This solution looks cleanest, and is easiest to implement. However
there is
a problem if two or more similar mixins are used: The order of the
calls are
dependant on the order the view inherits the mixins. If you make a
misstake
in the inheritance-order, your mixin might not be called at all, which
might
not always be whats intended.

I am personally working on option #3, with a simple linked list of
callables
that calls each other until the original "get", "post", etc. is
called.

--
Joachim Pileborg

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: login_required and new class based views

2010-10-23 Thread Łukasz Rekucki
On 23 October 2010 08:08, Joachim Pileborg  wrote:
>
> On 19 Okt, 21:18, Łukasz Rekucki  wrote:
>> On 19 October 2010 19:06, Valentin Golev  wrote:> Hello,
>> > I was going to write something like LoginRequiredMixin, but I have no
>> > idea how to do this. I need to run my code before .dispatch(), but I
>> > also have to call the old dispatch, but since Mixin aren't inherited
>> > from View, I can't just override method and use super().
>>
>> This is option #4. You can just do:
>>
>> class LoginRequiredMixin(object):
>>
>>     def dispatch(self, *args, **kwargs):
>>         bound_dispatch = super(LoginRequired, self).dispatch
>>         return login_required(bound_dispatch)(*args, **kwargs)

This discussion has moved to django-developers. It starts in [1] and
then continued in [2]. There is also a ticket #14512 for tracking this
issue[3]. All help is welcome :)

>
> This solution looks cleanest, and is easiest to implement. However
> there is
> a problem if two or more similar mixins are used: The order of the
> calls are
> dependant on the order the view inherits the mixins.

Yes it is. But I don't really see a problem with this. That's how
Python works. Wrapping the mixin construction to a class decorator
should make this a bit more obvious in what order the decorators will
be applied. With the code above, to wrap your view "MyView" with
a login_required you would need to do something like this:

class MyProtectedView(LoginRequiredMixin, MyView):
pass

> If you make a misstake
> in the inheritance-order, your mixin might not be called at all, which
> might not always be whats intended.

If all classes you inherit from play nicely (that means they call
super() in dispatch()), they your mixin will always be called. It
might be
called *earlier* then you expect, but not later or not at all.

>
> I am personally working on option #3, with a simple linked list of
> callables
> that calls each other until the original "get", "post", etc. is
> called.

See the links. There are some problems with decorators that leave
attributes (like csrf_protect) to consider. I will be more than happy
to work toghether.


[1]: 
http://groups.google.com/group/django-developers/browse_frm/thread/f4bad32127776177
[2]: 
http://groups.google.com/group/django-developers/browse_frm/thread/f36447f96277fe8c
[3]: http://code.djangoproject.com/ticket/14512

-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Two ForeignKeys to show a combo in admin

2010-10-23 Thread Alexandre González
Hi! I have a model as this:

class User:
   id

class Type:
   user = ForeignKey(User)

class B:
   user = ForeignKey(User)
   type = ForeignKey(Type)

When I'm creating a B object in the admin I like to show a combo with all
the users, and after select the user in the first combo, fill the second
combo only with Type of their users...

I must do that with ajax and subquerys? or admin.py allow me to do this
easily?

-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



The same table in 2 apps

2010-10-23 Thread robos85
Hi.
I'm new in Django so I have a very simple problem.
I have 1 table that will be used in 2 models (maybe more). Should I
declare that table in each application's model? Or how to do that in
proper way?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: What does an ideal django workflow setup look like?

2010-10-23 Thread shacker
On Oct 22, 10:09 pm, Kenneth Gonsalves  wrote:

> 5. Note: settings.py is not put under version control as this holds
> sensitive information and paths differ according to the server it is on.
> I create a default.settings.py which has the sensitive information
> removed. That is kept under version control.

Another approach to this problem:

settings.py IS in version control and includes settings that are
universal to all environments (local dev, staging, production), but
has dummy info or empty strings for passwords or paths or other
information that vary between environments.

local_settings.py is NOT in version control, and redefines any
passwords or settings specific to the various environments with actual
values.

Technically, it should not be necessary to define dummy values in
settings.py first, but we've seen issues where things break if you
don't set them first and then override them. No idea why.

The following bit at the end of settings.py looks for and reads in
info from local_settings.


##
# Default settings go above this line.
# This allows local settings to override.
##
try:
from local_settings import *
except ImportError, exp:
pass

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django 1.2.3 test fixtures are slower than creating every model object each time setUp() calls.

2010-10-23 Thread Phlip
Djangoists:

My last project got into trouble because the .json test fixtures took
so bloody long to run. (I fussed about that here at the time...)

So I started my current, blue-sky project with an absolutely clean new
codebase, and Django 1.2.3. I switched the test database to SQLite,
and wrote unit tests by creating each sample model object in the
setUp().

Tests took 1.25s to run.

When I dumped out that database as .json, and switched from using
setUp() to using fixtures, tests went to 1.45s.

This bodes ill for bigger data sets.

Is there some way to determine if the test runner is indeed using the
transaction-rollback trick? Where it creates the DB once, puts each
test case inside a transaction, and rolls the transaction back after
each run?

(Also, is there some way to log every SQL command sent to the DB?)

And even if the fixtures were re-creating the database before each
test case, shouldn't that work at the same speed as manual creation?
How on earth could it be slower??

--
  Phlip
  http://zeekland.zeroplayer.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-us...@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: What does an ideal django workflow setup look like?

2010-10-23 Thread Phlip
> I know how to get python/django working on my computer (PC or Mac) and
> have developed simple test apps using django's built-in dev server and
> a mysql back-end. So I can get things to work and don't need help on
> installing stuff.

I take all the other advice in these threads (beginning with
relentless automated tests), and I put them into fabfile.py.

Programmers should consider command lines like 'python manage.py
syncdb' and 'git push origin master' as just components of a kit. We
have no reason to type those command lines over and over again, with
minor variations each time. We should use the kit to assemble a
programmer-friendly environment.

Here's a Fabric fabfile.py example:

def sh(cmd):  local(cmd, capture=False)

def _manage(command, flavor, extra=''):
sh('python manage.py %s --settings=settings.%s %s' % (command,
flavor, extra))

def test():   _manage('test',  'test' , '--verbosity=0')
def shell():  _manage('shell', 'local')

def run():
_manage('syncdb',  'local')
_manage('loaddata', 'local', 'sample_database') #  CONSIDER  These
data should differ from the tests.py data.
_manage('runserver', 'local')

I also move the clutter of test_settings.py, local_settings.py, etc to
a folder settings/, contain test.py, common_settings.py, local.py,
etc.

That fab file allows for short command lines:

  fab run  #  build a sample database from your test fixtures & launch
a server

  fab shell  #  use iPython for the best shell.

  fab ci:'what I did'  #  run all the tests then integrate

Also, read the book "Release It!", if you think you know how to battle-
harden a website for production!

--
  Phlip
  http://zeekland.zeroplayer.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-us...@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 there some way to log every SQL command sent to the DB?

2010-10-23 Thread Phlip
Google leads me to this:

from django.db import connection
print connection.queries

It can't see the queries the test runner used to set up the database.

So, how to log every SQL command to a log file? (Like RoR can?)

--
  Phlip

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 1.2.3 test fixtures are slower than creating every model object each time setUp() calls.

2010-10-23 Thread Phlip
When I switch to TransactionTestCase - meaning a test case that does
not use the transaction-rollback trick - the test time goes to 2.5s.

This sucks. The test cases WITH transaction-rollback around each test
case are SLOWER than test cases that just rebuild the DB by hand each
time.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



possible bug in joining on a geo field

2010-10-23 Thread Miguel Araujo
Hi everyone,

I'm trying to do a join on geo field. I have two models like these ones
(simplified):

from django.contrib.gis.db import models
class Spot(models.Model):
point = models.PointField(spatial_index = True, srid = 4326, geography =
True)
objects = models.GeoManager()

from django.db import models
class Item(models.Model):
location = models.ForeignKey(Spot)
description = models.CharField(max_length=100)

I'm trying to execute this query:

from django.contrib.gis.geos import Point
point = Point(4, 5)
Item.objects.filter(location__point__distance_lte = (point, D(km=10)))

And I'm getting:

FieldError: Join on field 'point' not permitted. Did you misspell
'distance_lte' for the lookup type?

is this a bug? should I report it in a ticket? am I doing anything wrong?

Thanks, regards
Miguel Araujo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: possible bug in joining on a geo field

2010-10-23 Thread Karen Tracey
On Sat, Oct 23, 2010 at 1:07 PM, Miguel Araujo  wrote:

> Item.objects.filter(location__point__distance_lte = (point, D(km=10)))
>

Looks like you are missing an underscore in distance__lte

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: possible bug in joining on a geo field

2010-10-23 Thread Miguel Araujo
Thanks Karen, you are right. But I missed the underscore for sending this,
although I was trying here with double underscore:

So If I do it right:

Item.objects.filter(location__point__distance__lte = (point, D(km=10)))

I get:

FieldError: Join on field 'point' not permitted. Did you misspell 'distance'
for the lookup type?

So it's still not working.

Regards,
Miguel Araujo

2010/10/23 Karen Tracey 

> On Sat, Oct 23, 2010 at 1:07 PM, Miguel Araujo wrote:
>
>> Item.objects.filter(location__point__distance_lte = (point, D(km=10)))
>>
>
> Looks like you are missing an underscore in distance__lte
>
> Karen
> --
> http://tracey.org/kmt/
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: The same table in 2 apps

2010-10-23 Thread werefr0g

Hello,

You have defined "MyClass" for "foo" application in its models.py, and 
you want to use that class in your application "bar"?


You'll find how to use models from another app in Django documentation 
[1]. A widly spread example is the import of User in your app from 
django.contrib.auth [2]. By searching the web for "from 
django.contrib.auth import User", I found a discussion about the best 
way to import [3].


Regards

[1] 
http://docs.djangoproject.com/en/dev/topics/db/models/#models-across-files
[2] 
http://docs.djangoproject.com/en/dev/topics/auth/#module-django.contrib.auth
[3] 
http://stackoverflow.com/questions/1704058/python-and-django-best-import-practices


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: how can i wsdl file in my django

2010-10-23 Thread Scott Hebert (slaptijack)
You need to provide a SOAP service or consume one?

--
Scott Hebert
http://slaptijack.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-us...@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.



Django tutorial

2010-10-23 Thread dynamo44
Hello,

I am working through the Django tutorial at
http://docs.djangoproject.com/en/dev/intro/tutorial01/, and I seem to
have hit a wall at the database setup section.

I am modifying settings.py as described. Specifically, in the
DATABASES 'default' item. I am a college student who is using Django
to develop a project. The database I want to use is on cPanel X. I
modify the ENGINE, NAME, USER, and PASSWORD fields in settings.py. I
leave HOST and PORT alone. When I try to run the command:

python manage.py syncdb

I get the following error:
"django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: No module named MySQLdb." Any advice as to what may be going
wrong?

Thank you 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-us...@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.



Forms: set required value at runtime

2010-10-23 Thread bobo
Hi All,

I have a form, width two different address field (invoice and post)
and a booleanfield:

class AddressForm(forms.Form):
invoice_address = forms.CharField(max_length=255)
same = forms.BooleanField(initial=True)
post_address = forms.CharField(max_length=255,required=False)

I'd like to do, if I uncheck the 'same' field, then the required for
the post_address change to True.
I tried width the overall clean method, but when I raise
forms.ValidationError, I can't raise the error for the post_address
field.

Can I change the required value at runtime?
Thanks,
Bence

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 tutorial

2010-10-23 Thread Karen Tracey
On Sat, Oct 23, 2010 at 3:51 PM, dynamo44  wrote:

> I get the following error:
> "django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No module named MySQLdb." Any advice as to what may be going
> wrong?
>

You need to install the MySQLdb, the Python interface to MySQL (see
http://docs.djangoproject.com/en/dev/ref/databases/#mysqldb).

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 tutorial

2010-10-23 Thread Rizwan Mansuri
You need mysqldb library for your installed python version.

Cheers,

-Original Message-
From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]
On Behalf Of dynamo44
Sent: 23 October 2010 20:52
To: Django users
Subject: Django tutorial

Hello,

I am working through the Django tutorial at
http://docs.djangoproject.com/en/dev/intro/tutorial01/, and I seem to
have hit a wall at the database setup section.

I am modifying settings.py as described. Specifically, in the
DATABASES 'default' item. I am a college student who is using Django
to develop a project. The database I want to use is on cPanel X. I
modify the ENGINE, NAME, USER, and PASSWORD fields in settings.py. I
leave HOST and PORT alone. When I try to run the command:

python manage.py syncdb

I get the following error:
"django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: No module named MySQLdb." Any advice as to what may be going
wrong?

Thank you 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-us...@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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: serving SOAP service with soaplib, consuming with suds

2010-10-23 Thread Scott Hebert (slaptijack)
Ricko -

You may have already gotten your answer. I believe your problem is
related to Django's CSRF protection. If that's the case, you'll want
to import csrf_exempt from django.views.decorators.csrf into your
views and then wrap the call to MySOAPService in it.

For example:

# views.py
from django.views.decorators.csrf import csrf_exempt



my_soap_service = csrf_exempt(MySOAPService([DjangoSoapService],
DjangoSoapService.__tns__))

In my testing that seemed to work:

$ python2.5
Python 2.5.5 (r255:77872, Sep  7 2010, 10:18:54)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from suds.client import Client

>>> client = Client("http://127.0.0.1:8000/hello_world/service.wsdl";, 
>>> cache=None, faults=False)
>>> response = client.service.hello_world(hello_string="hi")
>>> print response
(200, hi)

Let us know if that works for you.

--
Scott Hebert
http://slaptijack.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-us...@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.



Would django affect where or how I set ServerAdmin (apache) environment variable?

2010-10-23 Thread robinne
Hi,

I am posting an apache question to the django users groups since I
have django installed using wsgi and wondering if it might be
affecting how or where I should set this environment variable.

I am trying to update the email address in the 500 Internal Server
Error message: "Please contact the server administrator,
webmas...@localhost and inform..."

I have tried to set the ServerAdmin variable in two separate config
files, but neither change will update the error page.
I have tried each of these in /etc/apache2/httpd.conf and /etc/apache2/
apache2.conf (I have restarted apache after each change)

ServerAdmin "m...@myemail.com"
ServerAdmin m...@myemail.com

Sorry if this is not django related at all.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Forms: set required value at runtime

2010-10-23 Thread widoyo
On Oct 24, 3:28 am, bobo  wrote:
> I'd like to do, if I uncheck the 'same' field, then the required for
> the post_address change to True.
> I tried width the overall clean method, but when I raise
> forms.ValidationError, I can't raise the error for the post_address
> field.
>
> Can I change the required value at runtime?

It could be easier to do this at Javascript instead of django.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Would django affect where or how I set ServerAdmin (apache) environment variable?

2010-10-23 Thread robinne
Contacted my VPS host. They must change this environment variable.
Sorry. Thanks.

On Oct 23, 7:37 pm, robinne  wrote:
> Hi,
>
> I am posting an apache question to the django users groups since I
> have django installed using wsgi and wondering if it might be
> affecting how or where I should set this environment variable.
>
> I am trying to update the email address in the 500 Internal Server
> Error message: "Please contact the server administrator,
> webmas...@localhost and inform..."
>
> I have tried to set the ServerAdmin variable in two separate config
> files, but neither change will update the error page.
> I have tried each of these in /etc/apache2/httpd.conf and /etc/apache2/
> apache2.conf (I have restarted apache after each change)
>
> ServerAdmin "m...@myemail.com"
> ServerAdmin m...@myemail.com
>
> Sorry if this is not django related at all.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: too many options error when launching sqlite3 dbshell

2010-10-23 Thread John Yeukhon Wong
Problem solved. SQLite will chop the path of the sqlite.db... so
instead moved to "C:\\sqlite.db" will solve the problem.

On Oct 22, 9:47 pm, John Yeukhon Wong  wrote:
> I have django 1.2.3.0 Final
>
> In my setting, I have 'sqlite3' filled for the DATABASE_ENGINE.
> I am able to work with the sqlite3 until I am told that I need to
> access python manage.py dbshell
>
> At first I got the error "sqlite3 is not recongized"
> Then I read threads and I found that this can be solved by downloading
> the exe file and set the environment variable path on Windows (I am on
> XP Pro)
>
>  I used this approach 
> insteadhttp://groups.google.com/group/django-users/msg/cf0665c227030ae2?
>
> Now when I access python manage.py dbshell, I am getting
>
> [[[
> C:\Documents and Settings\JohnWong\workspace\mysite\mysite>python
> manage.py dbsh
> ell
> sqlite3: Error: too many options: "Settings\JohnWong\workspace\mysite
> \sqlite.db"
>
> Use -help for a list of options.
> ]]]
> I tried with --database=name_of_my_db and still no luck
>
> Any input is appreciated.
> 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-us...@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: Forms: set required value at runtime

2010-10-23 Thread werefr0g

Bence,

I think your problem is related to the second case described in 
documentation about validation fields that depend on each other [1].


Just an observation about your design, if I may: I believe you should 
explicitly set and store both addresses. You will ease user task by 
providing a widget that will set the second address according the first, 
activated or not by default (I prefer not as your helper offer a direct 
one click "auto-fill" as you can encounter in many date fields with 
"today" button).


Regards

[1] 
http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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 1.2.3 test fixtures are slower than creating every model object each time setUp() calls.

2010-10-23 Thread Russell Keith-Magee
On Saturday, October 23, 2010, Phlip  wrote:
> Djangoists:
>
> My last project got into trouble because the .json test fixtures took
> so bloody long to run. (I fussed about that here at the time...)
>
> So I started my current, blue-sky project with an absolutely clean new
> codebase, and Django 1.2.3. I switched the test database to SQLite,
> and wrote unit tests by creating each sample model object in the
> setUp().
>
> Tests took 1.25s to run.
>
> When I dumped out that database as .json, and switched from using
> setUp() to using fixtures, tests went to 1.45s.
>
> This bodes ill for bigger data sets.

If a single fixture takes more than a second to load, i would suggest
to you that the problem lies in your test case. Tests should be as
simple as possible. Huge fixture files suggests to me that the first
port of call should be to try and simplify your test case and reduce
the size of your fixture file.

That said, if anyone can suggest any optimizations to the fixture
loading process (or any other part of Django for that matter) we're
happy to look at integrating those changes.

> Is there some way to determine if the test runner is indeed using the
> transaction-rollback trick? Where it creates the DB once, puts each
> test case inside a transaction, and rolls the transaction back after
> each run?

If you use django.test.TestCase, the rollback behavior will be used.
If you use a TransactionTestCase, tables will be flushed. There is no
other special logic or condition that you need to test for.

The only exception to this is when your database doesn't support
transactions (which effectively means MySQL MyISAM), in which case all
tests become TransactionTestCases.

> (Also, is there some way to log every SQL command sent to the DB?)

Yes; connection.queries contains a list of the executed SQL
statements. If you're running Django trunk, the recently added logging
framework includes a hook for outputting every SQL statement to a log
handler.

However, both these utilities are only available when debug is enabled.

> And even if the fixtures were re-creating the database before each
> test case, shouldn't that work at the same speed as manual creation?
> How on earth could it be slower??

I would be amazed if fixture loading was faster than manual creation.
Fixtures don't magically parse themselves. Parsing takes time, and
then the objects still have to be created. Unless your manual creation
code contains some seriously pathological logic, manual creation will
*always* be faster.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.