Re: djangobook.com, chapter 5, __init__() got an unexpected keyword argument 'maxlength'

2013-07-08 Thread Nkansah Rexford
Several years since this question was asked, but really solved my problem 
today. I'm using 1.5 of django, and the maxlength (now max_length) thing 
was bugging me. 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Abstract models instrospection

2013-07-08 Thread Roberto Bouza
Hello,

Hope someone can explain to me what is happening here?

I have this models:

*class InfrastructureBaseModel(models.Model):*

*class Meta:*

*abstract = True*

*app_label = 'infrastructure'*

*
*

*class ConsumerClasifications(InfrastructureBaseModel):*

*product_environment = models.ForeignKey('ProductEnvironments')*

*consumer = models.ForeignKey('Consumers')*

*class Meta(InfrastructureBaseModel.Meta):*

*db_table = 'consumer_clasifications'*

*
*

I'm trying to instrospect this classes using inspect:


*from models import *
*

*import inspect
*

*inspect.getmembers(InfrastructureBaseModel.Meta)
*

*
*

*[('__doc__', None), ('__module__', 'models'), ('abstract', False), 
('app_label', u'infrastructure')]*


Why am I getting False when inspecting, if the class has True on the 
abstract field? Maybe this is not the right forum, but any help is 
appreciated.


Thank you


-- Roberto

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
On Monday, July 8, 2013 6:11:36 PM UTC-4, Drew Ferguson wrote:
>
> On Mon, 8 Jul 2013 14:46:25 -0700 (PDT) 
> "Yves S. Garret"  wrote: 
>
> > On Monday, July 8, 2013 5:18:21 PM UTC-4, Drew Ferguson wrote: 
> > > 
> > > Yo 
> > > 
> > > You have 2 versions of python installed: 
> > > 
> > > * python 2.6 installed probably in /usr/bin and 
> > > using /usr/lib/python2.6 
> > > 
> > > * python 2.7 installed in /usr/local/bin and 
> > > possibly /usr/lib/python2.7 
> > > 
> > > You need to decide which one you want to use and deal with the tools 
> > > and binaries installed for the version to be rejected e.g. pip is 
> > > currently installed for 2.6 whereas the default python is 2.7. 
> > > 
> > > The fact that 2.7 is installed in /usr/local/bin suggests this was a 
> > > manual build 
> > > 
> > > Also you should consider using virtualenv or similar 
> > > 
> > > 
> > > 
> https://docs.djangoproject.com/en/1.5/topics/install/#install-the-django-code 
> > > 
> > 
> > Yes, 2.7 is a manual build and I'd like to use 2.7.  Any way I can go 
> > that route? 
> > 
>
> Install virtualenv for 2.7 
>
> Make sure you know which binaries you are using to install 
> packages with: /usr/bin/pip is currently linked to python2.6 so don't use 
> that obviously. You may need to install pip or other tools manually for 
> v2.7 
>
> Afterwards install django in a virtualenv 
>
>
> -- 
> Drew 
>

If it's less of a pain in the neck, I'd like to use 2.6.  I'd prefer 2.7, 
but what
I'm working on won't kill me if I go 2.6. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: more testing questions

2013-07-08 Thread Javier Guerra Giraldez
On Mon, Jul 8, 2013 at 5:41 PM, Larry Martell  wrote:
> So if you don't use dump files, what do you do? Load data row by row
> from within your test's setups?


no, i mostly write the fixture data by hand.  except when i need a
series of records to cover a all (most?) combinations, then i generate
those in the shell and dump.

but for the user and privileges tables, i do by hand.  i think it's
possible to create mostly clean dump files, but it's not easy, and i
usually only need 2-5 different users for tests anyway.


--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: more testing questions

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 4:21 PM, Javier Guerra Giraldez
 wrote:
> On Mon, Jul 8, 2013 at 4:14 PM, Larry Martell  wrote:
>> It appesars it's trying to add a row to django_content_type and it's
>> already there. I tried not loading the fixture for django_content_type
>> but I got the same error. These fixture files contain data I dumped
>> from my real db, so I know it's good. Googling this I found a few
>> posts with people having the same problem, but they are all a few
>> years old. People 'solved' this by using an external package
>> (django-fixture-magic) or excluding the auth tables or hand
>> re-ordering the records in the fixtures file. None of these seem like
>> good solutions to me. Is this still a known problem? Shouldn't I be
>> able to load data generated from a dump?
>
>
> rigth, it's quite messy.  i usually don't use dump files. (the mess,
> they don't do so 'clean' tests).
>
> check 'natural keys'
> (https://docs.djangoproject.com/en/1.5/topics/serialization/#natural-keys)
>  for a ways to get more robust fixtures

Not having much success. I created the fixture for auth_permission
with --natural, but I still got the same error:

IntegrityError: Could not load auth.Permission(pk=166): (1062,
"Duplicate entry '7-add_logentry' for key 'content_type_id'")

Then I tried also creating django_content_type with --natural, but
then I got a different error:

Problem installing fixture
'/usr/local/motor/motor/../motor/core/data/fixtures/django_content_type.json':
Traceback (most recent call last):
  File 
"/Library/Python/2.7/site-packages/django/core/management/commands/loaddata.py",
line 190, in handle
for obj in objects:
  File "/Library/Python/2.7/site-packages/django/core/serializers/json.py",
line 47, in Deserializer
raise DeserializationError(e)
DeserializationError: User matching query does not exist.


I need to load these table to login and I need to login to run my
other tests. Seems odd that these basic django auth tables give so
much grief.

So if you don't use dump files, what do you do? Load data row by row
from within your test's setups?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: more testing questions

2013-07-08 Thread Javier Guerra Giraldez
On Mon, Jul 8, 2013 at 4:14 PM, Larry Martell  wrote:
> It appesars it's trying to add a row to django_content_type and it's
> already there. I tried not loading the fixture for django_content_type
> but I got the same error. These fixture files contain data I dumped
> from my real db, so I know it's good. Googling this I found a few
> posts with people having the same problem, but they are all a few
> years old. People 'solved' this by using an external package
> (django-fixture-magic) or excluding the auth tables or hand
> re-ordering the records in the fixtures file. None of these seem like
> good solutions to me. Is this still a known problem? Shouldn't I be
> able to load data generated from a dump?


rigth, it's quite messy.  i usually don't use dump files. (the mess,
they don't do so 'clean' tests).

check 'natural keys'
(https://docs.djangoproject.com/en/1.5/topics/serialization/#natural-keys)
 for a ways to get more robust fixtures

--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Drew Ferguson
On Mon, 8 Jul 2013 14:46:25 -0700 (PDT)
"Yves S. Garret"  wrote:

> On Monday, July 8, 2013 5:18:21 PM UTC-4, Drew Ferguson wrote:
> >
> > Yo 
> >
> > You have 2 versions of python installed: 
> >
> > * python 2.6 installed probably in /usr/bin and
> > using /usr/lib/python2.6 
> >
> > * python 2.7 installed in /usr/local/bin and
> > possibly /usr/lib/python2.7 
> >
> > You need to decide which one you want to use and deal with the tools
> > and binaries installed for the version to be rejected e.g. pip is
> > currently installed for 2.6 whereas the default python is 2.7. 
> >
> > The fact that 2.7 is installed in /usr/local/bin suggests this was a 
> > manual build 
> >
> > Also you should consider using virtualenv or similar 
> >
> >
> > https://docs.djangoproject.com/en/1.5/topics/install/#install-the-django-code
> >  
> >
> 
> Yes, 2.7 is a manual build and I'd like to use 2.7.  Any way I can go
> that route? 
> 

Install virtualenv for 2.7

Make sure you know which binaries you are using to install
packages with: /usr/bin/pip is currently linked to python2.6 so don't use
that obviously. You may need to install pip or other tools manually for
v2.7

Afterwards install django in a virtualenv 


-- 
Drew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
On Monday, July 8, 2013 5:18:21 PM UTC-4, Drew Ferguson wrote:
>
> Yo 
>
> You have 2 versions of python installed: 
>
> * python 2.6 installed probably in /usr/bin and using /usr/lib/python2.6 
>
> * python 2.7 installed in /usr/local/bin and possibly /usr/lib/python2.7 
>
> You need to decide which one you want to use and deal with the tools and 
> binaries installed for the version to be rejected e.g. pip is currently 
> installed for 2.6 whereas the default python is 2.7. 
>
> The fact that 2.7 is installed in /usr/local/bin suggests this was a 
> manual build 
>
> Also you should consider using virtualenv or similar 
>
>
> https://docs.djangoproject.com/en/1.5/topics/install/#install-the-django-code 
>
>  On Mon, 8 Jul 2013 15:58:10 -0400 
> "Yves S. Garret"  wrote: 
>
> > Ok, just installed Django anew with pip (first did uninstall, then 
> > install). 
> > 
> > This is what I have: 
> > 
> > $ django-admin.py help 
> > Traceback (most recent call last): 
> >   File "/usr/bin/django-admin.py", line 5, in  
> > management.execute_from_command_line() 
> >   File 
>
>
> > "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", 
>
>
> > line 453, in execute_from_command_line 
> > utility.execute() 
> >   File 
> > "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", 
> > line 359, in execute 
> > version=get_version(), 
> >   File "/usr/lib/python2.6/site-packages/django/__init__.py", line 6, in 
> > get_version 
> > from django.utils.version import get_version 
> > ImportError: cannot import name get_version 
> > $ python 
>
>
> > Python 2.7.5 (default, Jun  6 2013, 18:46:06) 
>
>
> > [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2 
> > Type "help", "copyright", "credits" or "license" for more information. 
> > >>> import django 
> > Traceback (most recent call last): 
> >   File "", line 1, in  
> > ImportError: No module named django 
> > 
> > 
> > On Mon, Jul 8, 2013 at 2:10 PM, Yves S. Garret 
> > wrote: 
> > 
> > > I've gone through the entire django install steps and when I fired up 
> > > my Python shell 
> > > (python 2.7.5, to be exact) and did import django, this is what I got: 
> > > 
> > > >>> import django 
> > > Traceback (most recent call last): 
> > >   File "", line 1, in  
> > > ImportError: No module named django 
> > > 
> > > sudo python setup.py install should have done it, yes?  If not, what 
> > > am I missing? 
> > > 
> > 
>
>
>
> -- 
> Drew Ferguson 
> AFC Commercial 
> http://www.afccommercial.co.uk 
>

Yes, 2.7 is a manual build and I'd like to use 2.7.  Any way I can go that 
route? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Drew Ferguson
Yo

You have 2 versions of python installed:

* python 2.6 installed probably in /usr/bin and using /usr/lib/python2.6

* python 2.7 installed in /usr/local/bin and possibly /usr/lib/python2.7

You need to decide which one you want to use and deal with the tools and
binaries installed for the version to be rejected e.g. pip is currently
installed for 2.6 whereas the default python is 2.7.

The fact that 2.7 is installed in /usr/local/bin suggests this was a
manual build

Also you should consider using virtualenv or similar

https://docs.djangoproject.com/en/1.5/topics/install/#install-the-django-code

 On Mon, 8 Jul 2013 15:58:10 -0400
"Yves S. Garret"  wrote:

> Ok, just installed Django anew with pip (first did uninstall, then
> install).
> 
> This is what I have:
> 
> $ django-admin.py help
> Traceback (most recent call last):
>   File "/usr/bin/django-admin.py", line 5, in 
> management.execute_from_command_line()
>   File


> "/usr/lib/python2.6/site-packages/django/core/management/__init__.py",


> line 453, in execute_from_command_line
> utility.execute()
>   File
> "/usr/lib/python2.6/site-packages/django/core/management/__init__.py",
> line 359, in execute
> version=get_version(),
>   File "/usr/lib/python2.6/site-packages/django/__init__.py", line 6, in
> get_version
> from django.utils.version import get_version
> ImportError: cannot import name get_version
> $ python


> Python 2.7.5 (default, Jun  6 2013, 18:46:06)


> [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import django
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named django
> 
> 
> On Mon, Jul 8, 2013 at 2:10 PM, Yves S. Garret
> wrote:
> 
> > I've gone through the entire django install steps and when I fired up
> > my Python shell
> > (python 2.7.5, to be exact) and did import django, this is what I got:
> >
> > >>> import django
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > ImportError: No module named django
> >
> > sudo python setup.py install should have done it, yes?  If not, what
> > am I missing?
> >
> 



-- 
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: more testing questions

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 12:06 PM, Larry Martell  wrote:
> Still working on getting my tests to run. I have 2 issues right now:
>
> 1) I want to load data from fixture files. In this case I am trying to
> load auth data to test the logins. I have this in my test code:
>
> from django.test import TestCase
> from django.contrib.auth.models import User, Permission
>
> class MeasDataTest(TestCase):
>
> fixtures = ['auth_user', 'auth_permission']
>
> The auth_user and auth_permission files are in my apps fixtures dir
> (which is a subdir of where the models.py file is). But when run the
> test, it does not pick these up. What am I doing wrong here?

I figured out what the problem is here. My fixture files did not have
any extension on the file names. Once I renamed them to auth_user.json
they got picked up. But now I'm having a problem loading then. I
changed fixtures to:

fixtures = ['django_content_type', 'auth_user', 'auth_permission''

and it loads django_content_type and auth_user, but it fails on
auth_permission with:

IntegrityError: Could not load auth.Permission(pk=151): (1062,
"Duplicate entry '2-add_group' for key 'content_type_id'")

It appesars it's trying to add a row to django_content_type and it's
already there. I tried not loading the fixture for django_content_type
but I got the same error. These fixture files contain data I dumped
from my real db, so I know it's good. Googling this I found a few
posts with people having the same problem, but they are all a few
years old. People 'solved' this by using an external package
(django-fixture-magic) or excluding the auth tables or hand
re-ordering the records in the fixtures file. None of these seem like
good solutions to me. Is this still a known problem? Shouldn't I be
able to load data generated from a dump?


>
> 2) We have a stand alone program that loads data to the db. It's a
> django program in that it picks up the apps settings and uses the
> models and django API, but it's stand along in that it runs from cron
> and not from a web request. I want to run this from my tests, so I'm
> invoking it from my test class using subprocess.Popen. I would think
> it would use the test's environment and update the test db. But it
> does not do that, but neither does it update the 'real' database. It
> gives all indications of working though. I'm going to set a breakpoint
> in it and see if I can tell more about what it's doing, but should I
> expect an externally invoked script like this to hit the test db?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Return 2 values

2013-07-08 Thread Nick Apostolakis

On 08/07/2013 02:26 μμ, Hélio Miranda wrote:

ok, I have my view like this:
*def view(request, id):*
*fs = mongoengine.fields.GridFSProxy()*
*foto = fs.get(id=ObjectId(id))*
*legenda = foto.legend*
**
*array = [foto.read(), legenda]*
*return HttpResponse(array)*

But before I had to go to the image url this:
*url(r'^view/\w+)>', 'rest.views.view'),*

And now for access to the image and caption will as I do?

Check this out. You can access each element in the list separately in 
your template.

That change in your views shouldn't affect your url.py

http://stackoverflow.com/questions/4651172/reference-list-item-by-index-within-django-template

--
 --
   Nick Apostolakis
  e-mail: nicka...@oncrete.gr
 Web Site: http://nick.oncrete.gr
 --

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
On Monday, July 8, 2013 4:36:17 PM UTC-4, larry@gmail.com wrote:
>
> On Mon, Jul 8, 2013 at 2:34 PM, Yves S. Garret 
>  wrote: 
> > On Monday, July 8, 2013 4:31:47 PM UTC-4, Yves S. Garret wrote: 
> >> 
> >> On Monday, July 8, 2013 4:03:12 PM UTC-4, larry@gmail.com wrote: 
> >>> 
> >>> On Mon, Jul 8, 2013 at 2:00 PM, Yves S. Garret 
> >>>  wrote: 
> >>> > On Monday, July 8, 2013 2:28:58 PM UTC-4, Larry@gmail.comwrote: 
> >>> >> 
> >>> >> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret 
> >>> >>  wrote: 
> >>> >> > I've gone through the entire django install steps and when I 
> fired 
> >>> >> > up my 
> >>> >> > Python shell 
> >>> >> > (python 2.7.5, to be exact) and did import django, this is what I 
> >>> >> > got: 
> >>> >> > 
> >>> >>  import django 
> >>> >> > Traceback (most recent call last): 
> >>> >> >   File "", line 1, in  
> >>> >> > ImportError: No module named django 
> >>> >> > 
> >>> >> > sudo python setup.py install should have done it, yes?  If not, 
> what 
> >>> >> > am 
> >>> >> > I 
> >>> >> > missing? 
> >>> >> 
> >>> >> What platform are you on? On my Mac when I was running 10.5 I had 
> to 
> >>> >> create this symlink: 
> >>> >> 
> >>> >> ln -s /usr/local/lib/python2.6/dist-packages/django 
> >>> >> 
> >>> >> 
> >>> >> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>  
>
> >>> >> 
> >>> >> But I did not have to do that with 10.8 - there the install just 
> >>> >> worked. 
> >>> >> 
> >>> >> On CentOS I also had to create a symlink: 
> >>> >> 
> >>> >> ln -s /usr/lib/python2.6/dist-packages/django 
> >>> >> /usr/lib/python2.6/site-packages/django 
> >>> >> 
> >>> >> Those are the only 2 platforms I have experience with, so if you're 
> on 
> >>> >> something else I can't help. 
> >>> >> 
> >>> >> You could try: 
> >>> >> 
> >>> >> import sys 
> >>> >> print sys.path 
> >>> >> 
> >>> >> and see where it's searching. 
> >>> > 
> >>> > 
> >>> > I'm running CentOS 6.3. 
> >>> > 
> >>> > This is what happens when I print sys.path. 
> >>> > 
> >>>  import sys 
> >>>  print sys.path 
> >>> > ['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1', 
> >>> > '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', 
> >>> > '/usr/local/lib/python2.7/plat-linux2', 
> >>> > '/usr/local/lib/python2.7/lib-tk', 
> >>> > '/usr/local/lib/python2.7/lib-old', 
> >>> > '/usr/local/lib/python2.7/lib-dynload', 
> >>> > '/usr/local/lib/python2.7/site-packages'] 
> >>> 
> >>> Try creating the symlink. Assuming django is in 
> >>> /usr/local/lib/python2.7/dist-packages/django: 
> >>> 
> >>> sudo ln -s /usr/local/lib/python2.7/dist-packages/django 
> >>> /usr/local/lib/python2.7/site-packages/django 
> >> 
> >> 
> >> I just checked, it's not in the path that you described.  The directory 
> >> dist-packages is not there, but there is a distutils directory. 
> >> 
> >> How would I find the location where django is installed? 
> > 
> > 
> > Ok, I just found the path, it's located here: 
> > /usr/lib/python2.6/site-packages 
> > 
> > My version of CentOS is hosted in Azure Windows virtual environment. 
>
> I don't know anything about anything related to windows, but it seems 
> you're running python 2.7 and django was installed for 2.6. 
>

How weird.  I have python2.7 set as a default.

$ python --version
Python 2.7.5 

Is there a way to force it to be 2.7?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 2:34 PM, Yves S. Garret
 wrote:
> On Monday, July 8, 2013 4:31:47 PM UTC-4, Yves S. Garret wrote:
>>
>> On Monday, July 8, 2013 4:03:12 PM UTC-4, larry@gmail.com wrote:
>>>
>>> On Mon, Jul 8, 2013 at 2:00 PM, Yves S. Garret
>>>  wrote:
>>> > On Monday, July 8, 2013 2:28:58 PM UTC-4, larry@gmail.com wrote:
>>> >>
>>> >> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret
>>> >>  wrote:
>>> >> > I've gone through the entire django install steps and when I fired
>>> >> > up my
>>> >> > Python shell
>>> >> > (python 2.7.5, to be exact) and did import django, this is what I
>>> >> > got:
>>> >> >
>>> >>  import django
>>> >> > Traceback (most recent call last):
>>> >> >   File "", line 1, in 
>>> >> > ImportError: No module named django
>>> >> >
>>> >> > sudo python setup.py install should have done it, yes?  If not, what
>>> >> > am
>>> >> > I
>>> >> > missing?
>>> >>
>>> >> What platform are you on? On my Mac when I was running 10.5 I had to
>>> >> create this symlink:
>>> >>
>>> >> ln -s /usr/local/lib/python2.6/dist-packages/django
>>> >>
>>> >>
>>> >> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>>> >>
>>> >> But I did not have to do that with 10.8 - there the install just
>>> >> worked.
>>> >>
>>> >> On CentOS I also had to create a symlink:
>>> >>
>>> >> ln -s /usr/lib/python2.6/dist-packages/django
>>> >> /usr/lib/python2.6/site-packages/django
>>> >>
>>> >> Those are the only 2 platforms I have experience with, so if you're on
>>> >> something else I can't help.
>>> >>
>>> >> You could try:
>>> >>
>>> >> import sys
>>> >> print sys.path
>>> >>
>>> >> and see where it's searching.
>>> >
>>> >
>>> > I'm running CentOS 6.3.
>>> >
>>> > This is what happens when I print sys.path.
>>> >
>>>  import sys
>>>  print sys.path
>>> > ['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1',
>>> > '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7',
>>> > '/usr/local/lib/python2.7/plat-linux2',
>>> > '/usr/local/lib/python2.7/lib-tk',
>>> > '/usr/local/lib/python2.7/lib-old',
>>> > '/usr/local/lib/python2.7/lib-dynload',
>>> > '/usr/local/lib/python2.7/site-packages']
>>>
>>> Try creating the symlink. Assuming django is in
>>> /usr/local/lib/python2.7/dist-packages/django:
>>>
>>> sudo ln -s /usr/local/lib/python2.7/dist-packages/django
>>> /usr/local/lib/python2.7/site-packages/django
>>
>>
>> I just checked, it's not in the path that you described.  The directory
>> dist-packages is not there, but there is a distutils directory.
>>
>> How would I find the location where django is installed?
>
>
> Ok, I just found the path, it's located here:
> /usr/lib/python2.6/site-packages
>
> My version of CentOS is hosted in Azure Windows virtual environment.

I don't know anything about anything related to windows, but it seems
you're running python 2.7 and django was installed for 2.6.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 2:31 PM, Yves S. Garret
 wrote:
> On Monday, July 8, 2013 4:03:12 PM UTC-4, larry@gmail.com wrote:
>>
>> On Mon, Jul 8, 2013 at 2:00 PM, Yves S. Garret
>>  wrote:
>> > On Monday, July 8, 2013 2:28:58 PM UTC-4, larry@gmail.com wrote:
>> >>
>> >> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret
>> >>  wrote:
>> >> > I've gone through the entire django install steps and when I fired up
>> >> > my
>> >> > Python shell
>> >> > (python 2.7.5, to be exact) and did import django, this is what I
>> >> > got:
>> >> >
>> >>  import django
>> >> > Traceback (most recent call last):
>> >> >   File "", line 1, in 
>> >> > ImportError: No module named django
>> >> >
>> >> > sudo python setup.py install should have done it, yes?  If not, what
>> >> > am
>> >> > I
>> >> > missing?
>> >>
>> >> What platform are you on? On my Mac when I was running 10.5 I had to
>> >> create this symlink:
>> >>
>> >> ln -s /usr/local/lib/python2.6/dist-packages/django
>> >>
>> >>
>> >> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>> >>
>> >> But I did not have to do that with 10.8 - there the install just
>> >> worked.
>> >>
>> >> On CentOS I also had to create a symlink:
>> >>
>> >> ln -s /usr/lib/python2.6/dist-packages/django
>> >> /usr/lib/python2.6/site-packages/django
>> >>
>> >> Those are the only 2 platforms I have experience with, so if you're on
>> >> something else I can't help.
>> >>
>> >> You could try:
>> >>
>> >> import sys
>> >> print sys.path
>> >>
>> >> and see where it's searching.
>> >
>> >
>> > I'm running CentOS 6.3.
>> >
>> > This is what happens when I print sys.path.
>> >
>>  import sys
>>  print sys.path
>> > ['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1',
>> > '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7',
>> > '/usr/local/lib/python2.7/plat-linux2',
>> > '/usr/local/lib/python2.7/lib-tk',
>> > '/usr/local/lib/python2.7/lib-old',
>> > '/usr/local/lib/python2.7/lib-dynload',
>> > '/usr/local/lib/python2.7/site-packages']
>>
>> Try creating the symlink. Assuming django is in
>> /usr/local/lib/python2.7/dist-packages/django:
>>
>> sudo ln -s /usr/local/lib/python2.7/dist-packages/django
>> /usr/local/lib/python2.7/site-packages/django
>
>
> I just checked, it's not in the path that you described.  The directory
> dist-packages is not there, but there is a distutils directory.
>
> How would I find the location where django is installed?

sudo find / -type d -name django -print

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
On Monday, July 8, 2013 4:31:47 PM UTC-4, Yves S. Garret wrote:
>
> On Monday, July 8, 2013 4:03:12 PM UTC-4, larry@gmail.com wrote:
>>
>> On Mon, Jul 8, 2013 at 2:00 PM, Yves S. Garret 
>>  wrote: 
>> > On Monday, July 8, 2013 2:28:58 PM UTC-4, larry@gmail.com wrote: 
>> >> 
>> >> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret 
>> >>  wrote: 
>> >> > I've gone through the entire django install steps and when I fired 
>> up my 
>> >> > Python shell 
>> >> > (python 2.7.5, to be exact) and did import django, this is what I 
>> got: 
>> >> > 
>> >>  import django 
>> >> > Traceback (most recent call last): 
>> >> >   File "", line 1, in  
>> >> > ImportError: No module named django 
>> >> > 
>> >> > sudo python setup.py install should have done it, yes?  If not, what 
>> am 
>> >> > I 
>> >> > missing? 
>> >> 
>> >> What platform are you on? On my Mac when I was running 10.5 I had to 
>> >> create this symlink: 
>> >> 
>> >> ln -s /usr/local/lib/python2.6/dist-packages/django 
>> >> 
>> >> 
>> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>>  
>>
>> >> 
>> >> But I did not have to do that with 10.8 - there the install just 
>> worked. 
>> >> 
>> >> On CentOS I also had to create a symlink: 
>> >> 
>> >> ln -s /usr/lib/python2.6/dist-packages/django 
>> >> /usr/lib/python2.6/site-packages/django 
>> >> 
>> >> Those are the only 2 platforms I have experience with, so if you're on 
>> >> something else I can't help. 
>> >> 
>> >> You could try: 
>> >> 
>> >> import sys 
>> >> print sys.path 
>> >> 
>> >> and see where it's searching. 
>> > 
>> > 
>> > I'm running CentOS 6.3. 
>> > 
>> > This is what happens when I print sys.path. 
>> > 
>>  import sys 
>>  print sys.path 
>> > ['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1', 
>> > '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', 
>> > '/usr/local/lib/python2.7/plat-linux2', 
>> '/usr/local/lib/python2.7/lib-tk', 
>> > '/usr/local/lib/python2.7/lib-old', 
>> '/usr/local/lib/python2.7/lib-dynload', 
>> > '/usr/local/lib/python2.7/site-packages'] 
>>
>> Try creating the symlink. Assuming django is in 
>> /usr/local/lib/python2.7/dist-packages/django: 
>>
>> sudo ln -s /usr/local/lib/python2.7/dist-packages/django 
>> /usr/local/lib/python2.7/site-packages/django 
>>
>
> I just checked, it's not in the path that you described.  The directory
> dist-packages is not there, but there is a distutils directory. 
>
> How would I find the location where django is installed?
>

Ok, I just found the path, it's located here:
/usr/lib/python2.6/site-packages

My version of CentOS is hosted in Azure Windows virtual environment. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
On Monday, July 8, 2013 4:03:12 PM UTC-4, larry@gmail.com wrote:
>
> On Mon, Jul 8, 2013 at 2:00 PM, Yves S. Garret 
>  wrote: 
> > On Monday, July 8, 2013 2:28:58 PM UTC-4, larry@gmail.com wrote: 
> >> 
> >> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret 
> >>  wrote: 
> >> > I've gone through the entire django install steps and when I fired up 
> my 
> >> > Python shell 
> >> > (python 2.7.5, to be exact) and did import django, this is what I 
> got: 
> >> > 
> >>  import django 
> >> > Traceback (most recent call last): 
> >> >   File "", line 1, in  
> >> > ImportError: No module named django 
> >> > 
> >> > sudo python setup.py install should have done it, yes?  If not, what 
> am 
> >> > I 
> >> > missing? 
> >> 
> >> What platform are you on? On my Mac when I was running 10.5 I had to 
> >> create this symlink: 
> >> 
> >> ln -s /usr/local/lib/python2.6/dist-packages/django 
> >> 
> >> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>  
>
> >> 
> >> But I did not have to do that with 10.8 - there the install just 
> worked. 
> >> 
> >> On CentOS I also had to create a symlink: 
> >> 
> >> ln -s /usr/lib/python2.6/dist-packages/django 
> >> /usr/lib/python2.6/site-packages/django 
> >> 
> >> Those are the only 2 platforms I have experience with, so if you're on 
> >> something else I can't help. 
> >> 
> >> You could try: 
> >> 
> >> import sys 
> >> print sys.path 
> >> 
> >> and see where it's searching. 
> > 
> > 
> > I'm running CentOS 6.3. 
> > 
> > This is what happens when I print sys.path. 
> > 
>  import sys 
>  print sys.path 
> > ['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1', 
> > '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', 
> > '/usr/local/lib/python2.7/plat-linux2', 
> '/usr/local/lib/python2.7/lib-tk', 
> > '/usr/local/lib/python2.7/lib-old', 
> '/usr/local/lib/python2.7/lib-dynload', 
> > '/usr/local/lib/python2.7/site-packages'] 
>
> Try creating the symlink. Assuming django is in 
> /usr/local/lib/python2.7/dist-packages/django: 
>
> sudo ln -s /usr/local/lib/python2.7/dist-packages/django 
> /usr/local/lib/python2.7/site-packages/django 
>

I just checked, it's not in the path that you described.  The directory
dist-packages is not there, but there is a distutils directory. 

How would I find the location where django is installed?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Managing transactions using multiple databases

2013-07-08 Thread Leandro Boscariol
Amazing work Christophe, congrats!
Lot's of new cool stuff being added to 1.6, looking forward to it.

Regarding the nested xact context managers, let's say something that I
don't like happened and I want to abort everything:

with xact(using=db1):
with xact(using=db2):
obj1 = Ob1.save(using=db1)
obj2 = Obj2.save(using=db2)
if not_cool:
raise Rollback

I'll raise Rollback since this is the way to force a rollback, as described
in the README.
But, this will roll back only whatever happened in the inner context
manager, thus obj1 will still exist, right?

Is there a way to make the Rollback reach the outer xact?
You wrote in a previous email that an exception will abort both, so
something like this should be the solution? (I have not tested):

try:
with xact(using=db1):
with xact(using=db2):
obj1 = Ob1.save(using=db1)
obj2 = Obj2.save(using=db2)
if not_cool:
raise Exception
except Exception:
return False
return True


Cheers,
Leandro


On 6 July 2013 16:44, Christophe Pettus  wrote:

>
> On Jul 6, 2013, at 8:58 PM, Leandro Boscariol wrote:
> > And also thanks for mentioning xact, I wasn't aware of that!
>
> Full disclosure: I wrote it. :)  In 1.6, the new atomic() decorator /
> context manager is the way to go, but xact() works fine for now!
>
> --
> -- Christophe Pettus
>x...@thebuild.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/WJUIVH2abjo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 2:00 PM, Yves S. Garret
 wrote:
> On Monday, July 8, 2013 2:28:58 PM UTC-4, larry@gmail.com wrote:
>>
>> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret
>>  wrote:
>> > I've gone through the entire django install steps and when I fired up my
>> > Python shell
>> > (python 2.7.5, to be exact) and did import django, this is what I got:
>> >
>>  import django
>> > Traceback (most recent call last):
>> >   File "", line 1, in 
>> > ImportError: No module named django
>> >
>> > sudo python setup.py install should have done it, yes?  If not, what am
>> > I
>> > missing?
>>
>> What platform are you on? On my Mac when I was running 10.5 I had to
>> create this symlink:
>>
>> ln -s /usr/local/lib/python2.6/dist-packages/django
>>
>> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>>
>> But I did not have to do that with 10.8 - there the install just worked.
>>
>> On CentOS I also had to create a symlink:
>>
>> ln -s /usr/lib/python2.6/dist-packages/django
>> /usr/lib/python2.6/site-packages/django
>>
>> Those are the only 2 platforms I have experience with, so if you're on
>> something else I can't help.
>>
>> You could try:
>>
>> import sys
>> print sys.path
>>
>> and see where it's searching.
>
>
> I'm running CentOS 6.3.
>
> This is what happens when I print sys.path.
>
 import sys
 print sys.path
> ['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1',
> '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7',
> '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk',
> '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload',
> '/usr/local/lib/python2.7/site-packages']

Try creating the symlink. Assuming django is in
/usr/local/lib/python2.7/dist-packages/django:

sudo ln -s /usr/local/lib/python2.7/dist-packages/django
/usr/local/lib/python2.7/site-packages/django

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
On Monday, July 8, 2013 2:28:58 PM UTC-4, larry@gmail.com wrote:
>
> On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret 
>  wrote: 
> > I've gone through the entire django install steps and when I fired up my 
> > Python shell 
> > (python 2.7.5, to be exact) and did import django, this is what I got: 
> > 
>  import django 
> > Traceback (most recent call last): 
> >   File "", line 1, in  
> > ImportError: No module named django 
> > 
> > sudo python setup.py install should have done it, yes?  If not, what am 
> I 
> > missing? 
>
> What platform are you on? On my Mac when I was running 10.5 I had to 
> create this symlink: 
>
> ln -s /usr/local/lib/python2.6/dist-packages/django 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django
>  
>
>
> But I did not have to do that with 10.8 - there the install just worked. 
>
> On CentOS I also had to create a symlink: 
>
> ln -s /usr/lib/python2.6/dist-packages/django 
> /usr/lib/python2.6/site-packages/django 
>
> Those are the only 2 platforms I have experience with, so if you're on 
> something else I can't help. 
>
> You could try: 
>
> import sys 
> print sys.path 
>
> and see where it's searching. 
>

I'm running CentOS 6.3.

This is what happens when I print sys.path.

>>> import sys
>>> print sys.path
['', '/home/user', '/home/user/Downloads/Cython/Cython-0.19.1', 
'/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', 
'/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', 
'/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', 
'/usr/local/lib/python2.7/site-packages'] 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Yves S. Garret
Ok, just installed Django anew with pip (first did uninstall, then install).

This is what I have:

$ django-admin.py help
Traceback (most recent call last):
  File "/usr/bin/django-admin.py", line 5, in 
management.execute_from_command_line()
  File
"/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line
453, in execute_from_command_line
utility.execute()
  File
"/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line
359, in execute
version=get_version(),
  File "/usr/lib/python2.6/site-packages/django/__init__.py", line 6, in
get_version
from django.utils.version import get_version
ImportError: cannot import name get_version
$ python
Python 2.7.5 (default, Jun  6 2013, 18:46:06)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named django


On Mon, Jul 8, 2013 at 2:10 PM, Yves S. Garret
wrote:

> I've gone through the entire django install steps and when I fired up my
> Python shell
> (python 2.7.5, to be exact) and did import django, this is what I got:
>
> >>> import django
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named django
>
> sudo python setup.py install should have done it, yes?  If not, what am I
> missing?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




video app

2013-07-08 Thread Tcheck
Hello!
Is there any way around for making a video chat app using django? Or even 
with python?

Thanks you!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




video app

2013-07-08 Thread Scheck Nyori
Hi,
Is there any way then i can make a video chat app in django? I searched for
this package but culdn't find. Please share your views.

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to do import django

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 12:10 PM, Yves S. Garret
 wrote:
> I've gone through the entire django install steps and when I fired up my
> Python shell
> (python 2.7.5, to be exact) and did import django, this is what I got:
>
 import django
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named django
>
> sudo python setup.py install should have done it, yes?  If not, what am I
> missing?

What platform are you on? On my Mac when I was running 10.5 I had to
create this symlink:

ln -s /usr/local/lib/python2.6/dist-packages/django
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django

But I did not have to do that with 10.8 - there the install just worked.

On CentOS I also had to create a symlink:

ln -s /usr/lib/python2.6/dist-packages/django
/usr/lib/python2.6/site-packages/django

Those are the only 2 platforms I have experience with, so if you're on
something else I can't help.

You could try:

import sys
print sys.path

and see where it's searching.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Unable to do import django

2013-07-08 Thread Yves S. Garret
I've gone through the entire django install steps and when I fired up my
Python shell
(python 2.7.5, to be exact) and did import django, this is what I got:

>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named django

sudo python setup.py install should have done it, yes?  If not, what am I
missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




more testing questions

2013-07-08 Thread Larry Martell
Still working on getting my tests to run. I have 2 issues right now:

1) I want to load data from fixture files. In this case I am trying to
load auth data to test the logins. I have this in my test code:

from django.test import TestCase
from django.contrib.auth.models import User, Permission

class MeasDataTest(TestCase):

fixtures = ['auth_user', 'auth_permission']

The auth_user and auth_permission files are in my apps fixtures dir
(which is a subdir of where the models.py file is). But when run the
test, it does not pick these up. What am I doing wrong here?

2) We have a stand alone program that loads data to the db. It's a
django program in that it picks up the apps settings and uses the
models and django API, but it's stand along in that it runs from cron
and not from a web request. I want to run this from my tests, so I'm
invoking it from my test class using subprocess.Popen. I would think
it would use the test's environment and update the test db. But it
does not do that, but neither does it update the 'real' database. It
gives all indications of working though. I'm going to set a breakpoint
in it and see if I can tell more about what it's doing, but should I
expect an externally invoked script like this to hit the test db?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to download the table generated in html as a file

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 11:10 AM, sahitya pavurala
 wrote:
> Hi ,
>
> Can you specify from where am i getting the data here .
> Should I have to retrieve the data again from the database .
>
> my view function has this code :
>   if Mice.objects.filter(pk=item).exists() == False:
>  invalidlist.append(item)
>  inputlist.remove(item)
>  for item in inputlist:
>   datalist =
> serializers.serialize('python',Mice.objects.filter(pk = item))
>   for i in datalist:
>fulldata_list.append(i)

If it's your code, you should know where you're getting the data from.
Run it in the debugger and step through it and see. I have the code
that gets the data in a function (get_data) that I can call from
different functions in my view depending on the URL.

>
>
>
> On Monday, July 8, 2013 12:59:33 PM UTC-4, larry@gmail.com wrote:
>>
>> On Mon, Jul 8, 2013 at 10:30 AM, sahitya pavurala
>>  wrote:
>> >
>> > Hi ,
>> >
>> >
>> > I am new to Django and I would be glad if i can get help on this .
>> >
>> > I am generating a html page where i get a table containing fields and
>> > values
>> > of a database .
>> > I want to download this table as a file (preferably as an excel file ) .
>> > How can i do this ?
>>
>> I use the python csv lib (http://docs.python.org/2/library/csv.html)
>> and do something like this:
>>
>> def download_table(self, request):
>> from django.http import HttpResponse
>> from datetime import date
>> import csv
>>
>> response = HttpResponse(mimetype='text/csv')
>> response['Content-disposition'] = "attachment;
>> filename=%s_%s_%s.csv" % (
>> request.user.username.lower(),
>> self.report.name,
>> date.today())
>>
>> writer = csv.writer(response, dialect=csv.excel)
>> data = self.get_data()
>> rows = []
>> rows.append(self.get_headers())
>> rows += data
>> for row in rows:
>> writer.writerow(row)
>> return response

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to download the table generated in html as a file

2013-07-08 Thread sahitya pavurala
Hi ,

Can you specify from where am i getting the data here .
Should I have to retrieve the data again from the database .
 
my view function has this code :
  if Mice.objects.filter(pk=item).exists() == False:
 invalidlist.append(item)
 inputlist.remove(item)
 for item in inputlist:
  datalist = 
serializers.serialize('python',Mice.objects.filter(pk = item))
  for i in datalist:
   fulldata_list.append(i)



On Monday, July 8, 2013 12:59:33 PM UTC-4, larry@gmail.com wrote:
>
> On Mon, Jul 8, 2013 at 10:30 AM, sahitya pavurala 
>  wrote: 
> > 
> > Hi , 
> > 
> > 
> > I am new to Django and I would be glad if i can get help on this . 
> > 
> > I am generating a html page where i get a table containing fields and 
> values 
> > of a database . 
> > I want to download this table as a file (preferably as an excel file ) . 
> > How can i do this ? 
>
> I use the python csv lib (http://docs.python.org/2/library/csv.html) 
> and do something like this: 
>
> def download_table(self, request): 
> from django.http import HttpResponse 
> from datetime import date 
> import csv 
>
> response = HttpResponse(mimetype='text/csv') 
> response['Content-disposition'] = "attachment; 
> filename=%s_%s_%s.csv" % ( 
> request.user.username.lower(), 
> self.report.name, 
> date.today()) 
>
> writer = csv.writer(response, dialect=csv.excel) 
> data = self.get_data() 
> rows = [] 
> rows.append(self.get_headers()) 
> rows += data 
> for row in rows: 
> writer.writerow(row) 
> return response 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to download the table generated in html as a file

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 10:30 AM, sahitya pavurala
 wrote:
>
> Hi ,
>
>
> I am new to Django and I would be glad if i can get help on this .
>
> I am generating a html page where i get a table containing fields and values
> of a database .
> I want to download this table as a file (preferably as an excel file ) .
> How can i do this ?

I use the python csv lib (http://docs.python.org/2/library/csv.html)
and do something like this:

def download_table(self, request):
from django.http import HttpResponse
from datetime import date
import csv

response = HttpResponse(mimetype='text/csv')
response['Content-disposition'] = "attachment;
filename=%s_%s_%s.csv" % (
request.user.username.lower(),
self.report.name,
date.today())

writer = csv.writer(response, dialect=csv.excel)
data = self.get_data()
rows = []
rows.append(self.get_headers())
rows += data
for row in rows:
writer.writerow(row)
return response

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




How to download the table generated in html as a file

2013-07-08 Thread sahitya pavurala

Hi ,


I am new to Django and I would be glad if i can get help on this .

I am generating a html page where i get a table containing fields and 
values of a database .
I want to download this table as a file (preferably as an excel file ) .
How can i do this ?



Thanks for the help in advance .

-Sahitya

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: change buttons or widgets

2013-07-08 Thread Kakar Arunachal Service
Thank you so much That's just what i needed! And while i was searching
for this, i came across this: django-crispy (
http://django-crispy-forms.readthedocs.org/en/1.1.1/index.html). Just
wanted to share!


On Mon, Jul 8, 2013 at 6:48 PM, Derek  wrote:

> Widgets: https://docs.djangoproject.com/en/dev/ref/forms/widgets/
>
> For changing the way buttons look; try Twitter Bootstrap:
> http://twitter.github.io/bootstrap/components.html
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: unit testing

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 9:36 AM, Javier Guerra Giraldez
 wrote:
> On Mon, Jul 8, 2013 at 10:13 AM, Larry Martell  
> wrote:
>> I had seen the __init__ but I thought the tests had to be in the same
>> dir as the models file.
>
>
> the tests _module_ has to be in the same dir as the models module.
> that means either a tests.py file, or a tests directory with an
> __init__.py file in it.

Thanks for the clarification.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: unit testing

2013-07-08 Thread Javier Guerra Giraldez
On Mon, Jul 8, 2013 at 10:13 AM, Larry Martell  wrote:
> I had seen the __init__ but I thought the tests had to be in the same
> dir as the models file.


the tests _module_ has to be in the same dir as the models module.
that means either a tests.py file, or a tests directory with an
__init__.py file in it.

--
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 runserver hangs in Chrome

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 9:16 AM, François Schiettecatte
 wrote:
> Its the little gear at the bottom right, took me a while to find it.

Got it! Thanks!


> On Jul 8, 2013, at 11:10 AM, Larry Martell  wrote:
>
>> On Mon, Jul 8, 2013 at 5:00 AM, Sven Bröckling  wrote:
>>> Hi,
>>>
>>> Chrome sometimes does really strange things. I use chrome with a disabled
>>> cache for development (Open Developer Tools, click on the settings menu,
>>> first option) which resolves this kind of problems for me.
>>
>> I'm frequently emptying my cache, so this would help me a lot. But I
>> can't find the setting menu when I open the Developer Tools - where is
>> that?
>>
>> Thanks!
>> -larry
>>
 I can confirm this issue. Exactly the same problem here.
Also, while Chrome is spinning, I can open Firefox and load pages
(including the problem page) just fine. So it's not that the server
is overloaded or anything like that...
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 runserver hangs in Chrome

2013-07-08 Thread François Schiettecatte
Its the little gear at the bottom right, took me a while to find it.

F.

On Jul 8, 2013, at 11:10 AM, Larry Martell  wrote:

> On Mon, Jul 8, 2013 at 5:00 AM, Sven Bröckling  wrote:
>> Hi,
>> 
>> Chrome sometimes does really strange things. I use chrome with a disabled
>> cache for development (Open Developer Tools, click on the settings menu,
>> first option) which resolves this kind of problems for me.
> 
> I'm frequently emptying my cache, so this would help me a lot. But I
> can't find the setting menu when I open the Developer Tools - where is
> that?
> 
> Thanks!
> -larry
> 
>>> I can confirm this issue. Exactly the same problem here.
>>>Also, while Chrome is spinning, I can open Firefox and load pages
>>>(including the problem page) just fine. So it's not that the server
>>>is overloaded or anything like that...
>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: unit testing

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 8:59 AM,   wrote:
>
>
> On Monday, July 8, 2013 7:49:53 AM UTC-4, larry@gmail.com wrote:
>>
>>
>>
>> Ah, I missed that in the docs. Thanks. When I renamed it to tests.py
>> it got picked up.
>>
>> But in the django/contrib dirs (e.g. django/contrib/auth) the tests
>> are in a tests sub dir and are not called tests.py and they seem to
>> get run.
>
>
> Django will run all tests imported from the tests module. Check out the
> __init__.py in django/contrib/auth/tests and you'll see it imports all of
> the tests from the other files in the test dir.

I had seen the __init__ but I thought the tests had to be in the same
dir as the models file.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 runserver hangs in Chrome

2013-07-08 Thread Larry Martell
On Mon, Jul 8, 2013 at 5:00 AM, Sven Bröckling  wrote:
> Hi,
>
> Chrome sometimes does really strange things. I use chrome with a disabled
> cache for development (Open Developer Tools, click on the settings menu,
> first option) which resolves this kind of problems for me.

I'm frequently emptying my cache, so this would help me a lot. But I
can't find the setting menu when I open the Developer Tools - where is
that?

Thanks!
-larry

>> I can confirm this issue. Exactly the same problem here.
>> Also, while Chrome is spinning, I can open Firefox and load pages
>> (including the problem page) just fine. So it's not that the server
>> is overloaded or anything like that...
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: unit testing

2013-07-08 Thread ben


On Monday, July 8, 2013 7:49:53 AM UTC-4, larry@gmail.com wrote:
>
>
>
> Ah, I missed that in the docs. Thanks. When I renamed it to tests.py 
> it got picked up. 
>
> But in the django/contrib dirs (e.g. django/contrib/auth) the tests 
> are in a tests sub dir and are not called tests.py and they seem to 
> get run. 
>

Django will run all tests imported from the tests module. Check out the 
__init__.py in django/contrib/auth/tests and you'll see it imports all of 
the tests from the other files in the test dir.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 runserver hangs in Chrome

2013-07-08 Thread Sven Bröckling

Hi,

Chrome sometimes does really strange things. I use chrome with a 
disabled cache for development (Open Developer Tools, click on the 
settings menu, first option) which resolves this kind of problems for me.


Regards
  Sven


I can confirm this issue. Exactly the same problem here.
Also, while Chrome is spinning, I can open Firefox and load pages
(including the problem page) just fine. So it's not that the server
is overloaded or anything like that...


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Advanced search in django?

2013-07-08 Thread Kamal Kaur
On Sat, Jul 6, 2013 at 9:47 PM, Kamal Kaur  wrote:
> Sorry, didn't get you.
> Can you please elaborate more?


Reply awaited.

--
Kamaljeet Kaur

Blog:http://kamalkaur188.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




bug or programmer error when using logging.config.fileConfig

2013-07-08 Thread Chris Curvey
I'm not sure if this is a bug or my error, but I'm trying to use a legacy 
logging configuration in my django 1.5 app, like so:

LOGGING = r"C:\path\to\logging.conf"
LOGGING_CONFIG="logging.config.fileConfig"

when I try to start my app, I'm getting ConfigParser.NoSectionError: No 
section: 'formatters'.  It appears that Django tries to configure it's 
logging using DEFAULT_LOGGING from django.utils.log before trying to use 
the values specified in LOGGING and LOGGING_CONFIG, and that the 
DEFAULT_LOGGING dictionary does not have a "formatters" section.

Am I doing it wrong, or do we need to add a default formatter?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: change buttons or widgets

2013-07-08 Thread Derek
Widgets: https://docs.djangoproject.com/en/dev/ref/forms/widgets/

For changing the way buttons look; try Twitter Bootstrap: 
http://twitter.github.io/bootstrap/components.html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: menu highlight issue in django

2013-07-08 Thread roopasingh250
Hi,

  Since i am using session in my application i planed to check with the use 
of session.See my edit method for editing the report.

The idea is i need to create another session for edit method and if that 
created session is their,the menu should not highlighted,so if a user is 
going to open the existing report from Action needed page,always goes to 
edit_report method ,thus menu should not highlighted.I tried in this way 
please guide me to do and see my codes below.

def edit_report(request, report_id):
"""Edit report navigation from action needed screen
"""
   
user = request.user
if 'report_id' in request.session:
del request.session['report_id']
try:
member = Members.objects.get(member=user)
account_user = member.user
except:
account_user = user.id
request.session['report_id'] = report_id
request.session['account_user'] = account_user
return redirect('incident.views.new_report')

I added the two line " if not 'report_id' in request.session and not 
'account_user' in request.session:
newreport_menu= False"

before return redirect ,but it is not working and i don't have idea how to 
do this but tried,kindly help me.

On Friday, July 5, 2013 7:55:34 PM UTC+5:30, roopas...@gmail.com wrote:
>
> Hi,
>
> In my django application,I am creating new report using django session,and 
> my application contain 3 tabs namely Reports,Search and New Report.Tab 
> highlight says that the application is in which page.If user clicks New 
> report,the New report tab will be highlighted.
>
> User can view all the reports by clicking the report link from Report tab.
>
> If the user clicks any one of the report namely "report id 5"in Report 
> tab,that will open the report under New report Tab,so the New report menu 
> gets highlighted.But i want it to not highlight because New report Tab is 
> for creating only new report,while seeing the existing report i should not 
> highlight the New report Tab.How to do it using django.
>
> Now it is done in this way.
>
> views.py
>
> def method(request):
> Some code
> return render(request, sometemplate.html',
>  {'
>   'newreport_menu': True,
>  })
>   
> In menu tab,i validated like this
>
> New Report
>
> Now "New Report" menu is always gets highlighted for creating new report 
> and if user click the existing report from Report Tab.But it should not 
> highlight if the user clicks the existing report.
>
> Need some tips how to do.
>
> Thanks 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: unit testing

2013-07-08 Thread Larry Martell
On Sun, Jul 7, 2013 at 10:05 PM, Javier Guerra Giraldez
 wrote:
> On Sun, Jul 7, 2013 at 10:47 PM, Larry Martell  
> wrote:
>> MeasDataTest is declared as:
>>
>> class MeasDataTest(TestCase):
>>
>> Why do I get "does not refer to a test"?
>
> where do you define your test?  AFAIR, it must be either in the
> models.py, or a tests.py file in the same directory.

Ah, I missed that in the docs. Thanks. When I renamed it to tests.py
it got picked up.

But in the django/contrib dirs (e.g. django/contrib/auth) the tests
are in a tests sub dir and are not called tests.py and they seem to
get run.

>
>> Then I tried:
>>
>> $ python manage.py test cdsem
>> Failed to install custom SQL for cdsem.Tool model: (1054, "Unknown
>> column 'category' in 'field list'")
>
> are you using custom SQL?

There was a .sql file in a sql dir that I hadn't noticed. It was a few
years ago before I was working on this app and it was no longer
applicable so I removed it. Thanks again.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Return 2 values

2013-07-08 Thread Hélio Miranda
ok, I have my view like this:
*def view(request, id):*
*fs = mongoengine.fields.GridFSProxy()*
*foto = fs.get(id=ObjectId(id))*
*legenda = foto.legend*
**
*array = [foto.read(), legenda]*
*return HttpResponse(array)*

But before I had to go to the image url this:
*url(r'^view/\w+)>', 'rest.views.view'),*

And now for access to the image and caption will as I do?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: type object 'DataTable' has no attribute 'datFile'

2013-07-08 Thread Daniel Roseman
On Monday, 8 July 2013 10:36:57 UTC+1, Nigel Legg wrote:

> Thanks Daniel. 
> Before trying that, I went nto the python shell, imported the DataTable 
> model, and tried DataTable.objects.all(), and got the error:
> DatabaseError: no such column: myapp_datatable.datFile. 
> I tried re-running syncdb, but still get the same error. Am I using 
> reserved names here, or is there another issue with my code?  These are the 
> most logical names for what I am trying to do. 
> Many thanks in advance. 
>

Syncdb doesn't modify your existing tables if you've changed your models 
after initially running it. You'll need to modify the db schema manually, 
or use the third-party tool South: http://south.aeracode.org/

If you're just starting out and don't have any data you need to keep, the 
easiest thing is probably to just drop the tables and re-run syncdb though.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: type object 'DataTable' has no attribute 'datFile'

2013-07-08 Thread Nigel Legg
Thanks Daniel.
Before trying that, I went nto the python shell, imported the DataTable
model, and tried DataTable.objects.all(), and got the error:
DatabaseError: no such column: myapp_datatable.datFile.
I tried re-running syncdb, but still get the same error. Am I using
reserved names here, or is there another issue with my code?  These are the
most logical names for what I am trying to do.
Many thanks in advance.

Regards,
Nigel Legg
07914 740972
http://www.treavnianlegg.co.uk
http://twitter.com/nigellegg
http://uk.linkedin.com/in/nigellegg



On 7 July 2013 18:27, Daniel Roseman  wrote:

> On Saturday, 6 July 2013 12:07:34 UTC+1, Nigel Legg wrote:
>
>> I have the following code:
>> models.py:
>> class DataTable(models.Model):
>> datFile = models.CharField(max_length = 200)
>> structFile = models.CharField(max_length = 200)
>> bannerVar = models.CharField(max_length = 50)
>> stubVar = models.CharField(max_length = 50)
>> stubNets = models.BooleanField()
>>
>> def __unicode__(self):
>> return u'%s %s %s %s' % (self.datFile, self.structFile,
>> self.bannerVar, self.stubVar)
>>
>> forms.py:
>> class DataTableForm(forms.ModelForm)**:
>>
>> class Meta:
>>
>> model = DataTable
>>
>> views.py:
>> def datatables(request):
>> if request.method == 'POST':
>> form = DataTableForm(request.POST)
>> if form.is_valid():
>> form.save()
>> return redirect('myapp/tabspec.html')
>> else:
>> form = DataTableForm()
>> return render(request, 'myapp/datatables.html', {
>> 'form': form,
>> })
>>
>> def tabspec(request):
>> try:
>> datFile = DataTable.datFile
>> context = Context({
>> 'datFile': datFile,
>> })
>> except DataTable.DoesNotExist:
>> raise Http404
>> return HttpResponse(template.render(**context))
>>
>> The DataTable view shows, as a form; I enter the values for the ields,
>> when I click the button, I get the error "type object 'DataTable' has no
>> attribute 'datFile'".  I thought maybe I should be referring to
>> DataTableForm.datFile, but this gave the same error.
>> I am confused, could any one tell me where I am going wrong?
>> Regards,
>> Nigel Legg
>> 07914 740972
>> http://www.treavnianlegg.co.uk
>> http://twitter.com/nigellegg
>> http://uk.linkedin.com/in/**nigellegg
>>
>>
> datFile (terrible name, by the way) is a field on a DataTable *instance*.
> You need to pass an ID value to the tabspec view (via the URL) from your
> form view, then use DataTable.objects.get(pk=id) in that tabspec view.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Javascript AJAX url call not responding

2013-07-08 Thread nesornet
 

> "Either way I cannot get the ajax call to succeed in triggering the django 
> backend at all"
>
 
By "django backend" I simply mean the persistent_messages/views.py, which 
should be referenced when the ajax url calls /messages/marked_read/X (as 
defined in persistent_messages/urls.py. Again a reminder that accessing the 
same link manually succeeds in calling the correct methods defined in 
persistent_messages/views.py

On Monday, July 8, 2013 2:30:56 AM UTC-5, neso...@ymail.com wrote:
>
> I added the getcookie call to grab csrftoken (ref from the link you 
> provided), 
> but the farthest I can get is by setting ajax async:false which causes the 
> status reported by chrome developer tools (for call /messages/marked_read/X 
> ) to be PENDING.
> Without async:false, it just goes to CANCELLED.
>
> Either way I cannot get the ajax call to succeed in triggering the django 
> backend at all.
> Nor do the server error logs report anything going wrong.
>
>
> On Friday, July 5, 2013 12:03:55 AM UTC-5, Peith wrote:
>>
>> If that's an AJAX POST request, then it may be because you are not 
>> passing the CSRF token in the header. Add this code before doing the AJAX 
>> call:
>>
>> function csrfSafeMethod(method) {
>> // these HTTP methods do not require CSRF protection
>> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));}$.ajaxSetup({
>> crossDomain: false, // obviates need for sameOrigin test
>> beforeSend: function(xhr, settings) {
>> if (!csrfSafeMethod(settings.type)) {
>> xhr.setRequestHeader("X-CSRFToken", csrftoken);
>> }
>> }});
>>
>> See here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>>
>>
>>
>>
>> On Fri, Jul 5, 2013 at 10:03 AM,  wrote:
>>
>>> So I have django 1.5.1 installed,
>>> have persistent messages installed, and have messages displaying in a 
>>> list
>>> via the template reference {% include 
>>> "persistent_messages/message/includes/messages.jquery.html" %}
>>>
>>> The following javascript click trigger is bound to an anchor tag within 
>>> the list:
>>>
>>> $(closeSelector).click(function(event) {
>>> event.preventDefault();
>>> $.ajax({
>>> url: "//url.com/"+$(this).attr('href')
>>> })
>>> if ($(messageSelector).length <= 2) {
>>> $(closeAllSelector).messageClose();
>>> }
>>>
>>> $(this).closest(messageSelector).messageClose();
>>> });
>>>
>>> The link being referenced is https://url.com/messages/mark_read/583/ 
>>> If I access that same link manually in the address bar, the appropriate 
>>> call in the backend
>>> gets executed and the message is marked read. The ajax equivalent never 
>>> seems to respond.
>>> I added logging to the persistent messages view and confirmed the ajax 
>>> call is never
>>> calling mark_read() method.
>>>
>>> Chrome dev tools indicates that the ajax call is "pending" and never 
>>> changes from this state.
>>>
>>> Any suggestions or ideas on what may be causing this?
>>>
>>> NOTE: I prepend the "//url.com" to avoid getting 'insecure content' 
>>> warnings, since this ajax code is being executed
>>> from a https page. This change did not seem to affect the bug in any 
>>> way, since the response is the same.
>>>
>>> Thanks in advance 
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Javascript AJAX url call not responding

2013-07-08 Thread nesornet
I added the getcookie call to grab csrftoken (ref from the link you 
provided), 
but the farthest I can get is by setting ajax async:false which causes the 
status reported by chrome developer tools (for call /messages/marked_read/X 
) to be PENDING.
Without async:false, it just goes to CANCELLED.

Either way I cannot get the ajax call to succeed in triggering the django 
backend at all.
Nor do the server error logs report anything going wrong.


On Friday, July 5, 2013 12:03:55 AM UTC-5, Peith wrote:
>
> If that's an AJAX POST request, then it may be because you are not passing 
> the CSRF token in the header. Add this code before doing the AJAX call:
>
> function csrfSafeMethod(method) {
> // these HTTP methods do not require CSRF protection
> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));}$.ajaxSetup({
> crossDomain: false, // obviates need for sameOrigin test
> beforeSend: function(xhr, settings) {
> if (!csrfSafeMethod(settings.type)) {
> xhr.setRequestHeader("X-CSRFToken", csrftoken);
> }
> }});
>
> See here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>
>
>
>
> On Fri, Jul 5, 2013 at 10:03 AM,  wrote:
>
>> So I have django 1.5.1 installed,
>> have persistent messages installed, and have messages displaying in a list
>> via the template reference {% include 
>> "persistent_messages/message/includes/messages.jquery.html" %}
>>
>> The following javascript click trigger is bound to an anchor tag within 
>> the list:
>>
>> $(closeSelector).click(function(event) {
>> event.preventDefault();
>> $.ajax({
>> url: "//url.com/"+$(this).attr('href')
>> })
>> if ($(messageSelector).length <= 2) {
>> $(closeAllSelector).messageClose();
>> }
>>
>> $(this).closest(messageSelector).messageClose();
>> });
>>
>> The link being referenced is https://url.com/messages/mark_read/583/ 
>> If I access that same link manually in the address bar, the appropriate 
>> call in the backend
>> gets executed and the message is marked read. The ajax equivalent never 
>> seems to respond.
>> I added logging to the persistent messages view and confirmed the ajax 
>> call is never
>> calling mark_read() method.
>>
>> Chrome dev tools indicates that the ajax call is "pending" and never 
>> changes from this state.
>>
>> Any suggestions or ideas on what may be causing this?
>>
>> NOTE: I prepend the "//url.com" to avoid getting 'insecure content' 
>> warnings, since this ajax code is being executed
>> from a https page. This change did not seem to affect the bug in any way, 
>> since the response is the same.
>>
>> Thanks in advance 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.