Re: Newbie django/python with C++ background wants enums

2012-02-01 Thread Mike Dewhirst

On 2/02/2012 12:13pm, Nikolas Stevenson-Molnar wrote:

TO_USE= (
 ('Y', 'Yes'),
 ('N', 'No'),
 )

class X(models.Model):
 txt= models.CharField(db_index=True,null=True,
blank=True,max_length=30)
 use_txt=
models.CharField(blank=False,max_length=1,default='D',choices=TO_USE)

and in admin.py something as
class XForm(forms.ModelForm):
 def clean(self):
 cleaned_data=super(XForm, self).clean()
 txt= cleaned_data['txt'].strip()
 use_txt=cleaned_data['use_txt'].strip()

 if txt.__len__()==0 and use_txt==TO_USE.__getitem__(0)[0]:


Personally, I would do this in models.py so it would run in any form's 
clean method. In which case ...


class X(models.Model):
...

def clean(self):
self.txt = self.txt.strip()


Assuming you mean you only care about the contents of txt if there is 
something there AND then if so, you want the user to make a Yes/No 
selection ...


   if self.txt:
   ok = False
   for abbr, fullword in TO_USE:
   # fullword is ignored
   if abbr in self.use_txt:
   ok = True
   break
   if not ok:
   raise django.core.exceptions.ValidationError('Yes or 
No required')



The above 'in' keyword means you don't need to use_txt.strip()


 raise forms.ValidationError('This is needed!')

 return cleaned_data

The part .__getitem__(0)[0] is not very readable. I have looked for
enums in python, and if I have understood well, it seems they are not
implemented.


Have a look at list comprehension in the Python docs. It might help if 
you make TO_USE into a list of tuples instead of a tuple of tuples. I'm 
not as familiar with list comprehension as I should be and I suspect my 
verbose approach above could be squished considerably.


Just as an aside, you ought to be able to extract all the functionality 
ordinarily required without having to resort to __internal__() methods. 
They are really for people who want to tweak the language in "special" 
ways or give their own classes python-like class properties.



What is the best way to do it in python for my problem, given that I do
not want to write =='Y'.


I'm not saying the above is the "best" way but it might avoid =='Y'

Mike

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



Django version changed

2012-02-01 Thread lu uky
You can update the argument maxlength to max_length.

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



Re: Newbie django/python with C++ background wants enums

2012-02-01 Thread Chris
A different way would be to define constants:

YES = 'Y'
NO = 'N'

TO_USE= (
(YES, 'Yes'),
(NO, 'No'),
)

---

from myapp.models import YES

class XForm(forms.ModelForm):
def clean(self):
cleaned_data=super(XForm, self).clean()
txt= cleaned_data['txt'].strip()
use_txt=cleaned_data['use_txt'].strip()

if txt.__len__()==0 and use_txt == YES:
raise forms.ValidationError('This is needed!')

return cleaned_data

On Feb 1, 4:45 pm, NENAD CIKIC  wrote:
> Hello, the subject expresses my discomfort with certain python
> characteristics, given my background, and my lack of python knowledge.
> Specifically lets say that I have a model with a Text field and char field.
> The char field is length 1 and says "use or do not use the text field". The
> char field can have Y or N values.
> So using the admin interface I wanted to override the clean method but I
> did not want to write
> if text.__len__==0 and char=='Y':
>   raise exception
>
> In C/C++ you would use enum for these sort of things. So I ended with
> defining in models.py something as:
> TO_USE= (
>     ('Y', 'Yes'),
>     ('N', 'No'),
>     )
>
> class X(models.Model):
>     txt= models.CharField(db_index=True,null=True, blank=True,max_length=30)
>     use_txt=
> models.CharField(blank=False,max_length=1,default='D',choices=TO_USE)
>
> and in admin.py something as
> class XForm(forms.ModelForm):
>     def clean(self):
>         cleaned_data=super(XForm, self).clean()
>         txt= cleaned_data['txt'].strip()
>         use_txt=cleaned_data['use_txt'].strip()
>
>         if txt.__len__()==0 and use_txt==TO_USE.__getitem__(0)[0]:
>             raise forms.ValidationError('This is needed!')
>
>         return cleaned_data
>
> The part .__getitem__(0)[0] is not very readable. I have looked for enums
> in python, and if I have understood well, it seems they are not implemented.
> What is the best way to do it in python for my problem, given that I do not
> want to write =='Y'.
> Thanks
> Nenad

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



Re: Apache Segfaults

2012-02-01 Thread akaariai
On Feb 2, 4:21 am, Alex Kopp  wrote:
> Yes, the development server works fine on the server I am getting the
> apache error. The server is ubuntu and everything is installed either via
> apt-get or pip. I'm not copying any modules from machine to machine.

This is out of my expertise area... But, some other guesses & hints
below:
 - Maybe a threading issue? If you disable multi-threaded mode of
mod_wsgi in Apache conf does the segfault still happen? mod_wsgi
documentation tells you how to do this.
 - Next, I would maybe alter the installed Django to do debug printing
from various places (most notably, before the import of psycopg2 in
django/db/backends/psycopg2/base.py and in settings.py so that we can
see if even settings.py get imported, ever). This way you can likely
"bisect" the place where the error happens.
 - Next (or alternatively), try to create a minimal Django project,
adding your dependencies one at a time until you hit the error.
 - It seems a little suspicious this happens under apache, but not
under dev-server. Are there any differences in the Python used, or in
the path used?

Unfortunately this is all the help I can give you.

 - Anssi

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



Re: Apache Segfaults

2012-02-01 Thread Alex Kopp
Yes, the development server works fine on the server I am getting the
apache error. The server is ubuntu and everything is installed either via
apt-get or pip. I'm not copying any modules from machine to machine.

On Wed, Feb 1, 2012 at 9:13 PM, akaariai  wrote:

> On Feb 2, 3:47 am, Loafer  wrote:
> > Here's the setup:
> >
> > I have a Django website that is being run by Apache, and MySQL with no
> > issues. I decided to implement some GIS features as an update. Since
> > MySQL doesn't have much support for GIS, I decided to switch my
> > database over to Postgres. After committing the changes to my SVN, and
> > checking them out on my website, Apache now segfaults whenever I try
> > and load my page. My code works fine on the manage.py development
> > server though.
> >
> > I've literally spent the last 10 hours trying to figure out what is
> > going on. Here's some information:
> >
> > Apache Log, Virtual Host Config, and django.wsgi file:
> http://dpaste.org/pJBc2/
> > GDB Trace:http://dpaste.org/52pTk/
>
> You seem to have some C-based module (psycopg2?) which isn't working
> correctly under Apache, or more likely, with the Python you are using
> when running under Apache. If you are copying the psycopg2 module (or
> any other compiled C based module) from machine to machine things are
> likely to break. The hint that this is a compiled module issue is
> here:
>
> warning: Selected architecture i386:x86-64 is not compatible with
> reported target architecture i386
> 
> (gdb) where
> #0 0x2aaab82998cd in ?? () from /usr/lib/python2.7/lib-dynload/
> _ctypes.so
>
> If you run the project using "development server" in the same machine
> you get the Apache error do things work correctly?
>
>  - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Apache Segfaults

2012-02-01 Thread akaariai
On Feb 2, 3:47 am, Loafer  wrote:
> Here's the setup:
>
> I have a Django website that is being run by Apache, and MySQL with no
> issues. I decided to implement some GIS features as an update. Since
> MySQL doesn't have much support for GIS, I decided to switch my
> database over to Postgres. After committing the changes to my SVN, and
> checking them out on my website, Apache now segfaults whenever I try
> and load my page. My code works fine on the manage.py development
> server though.
>
> I've literally spent the last 10 hours trying to figure out what is
> going on. Here's some information:
>
> Apache Log, Virtual Host Config, and django.wsgi file:http://dpaste.org/pJBc2/
> GDB Trace:http://dpaste.org/52pTk/

You seem to have some C-based module (psycopg2?) which isn't working
correctly under Apache, or more likely, with the Python you are using
when running under Apache. If you are copying the psycopg2 module (or
any other compiled C based module) from machine to machine things are
likely to break. The hint that this is a compiled module issue is
here:

warning: Selected architecture i386:x86-64 is not compatible with
reported target architecture i386

(gdb) where
#0 0x2aaab82998cd in ?? () from /usr/lib/python2.7/lib-dynload/
_ctypes.so

If you run the project using "development server" in the same machine
you get the Apache error do things work correctly?

 - Anssi

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



Apache Segfaults

2012-02-01 Thread Loafer
Here's the setup:

I have a Django website that is being run by Apache, and MySQL with no
issues. I decided to implement some GIS features as an update. Since
MySQL doesn't have much support for GIS, I decided to switch my
database over to Postgres. After committing the changes to my SVN, and
checking them out on my website, Apache now segfaults whenever I try
and load my page. My code works fine on the manage.py development
server though.

I've literally spent the last 10 hours trying to figure out what is
going on. Here's some information:

Apache Log, Virtual Host Config, and django.wsgi file: http://dpaste.org/pJBc2/
GDB Trace: http://dpaste.org/52pTk/

Any help would be greatly appreciated!

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



Re: Newbie django/python with C++ background wants enums

2012-02-01 Thread Jeff Heard
*slightly* better would be:

class X(models.Model):
YES='Y'
NO='N'
DEFAULT='D'
TO_USE = ((X.YES, "Yes"), (X.NO, "No"), (X.DEFAULT, "Default"))

txt= models.CharField(db_index=True,null=True, blank=True,max_length=30)
use_txt= models.CharField(blank=False,max_length=1,default='D',
choices=X.TO_USE)

and in admin.py

class XForm(forms.ModelForm):
def clean(self):
cleaned_data=super(XForm, self).clean()
txt=cleaned_data['txt'].strip()
use_txt=cleaned_data['use_txt'].strip()

if *not txt* and use_txt==X.YES:
raise forms.ValidationError('This is needed!')

return cleaned_data

On Wed, Feb 1, 2012 at 8:13 PM, Nikolas Stevenson-Molnar <
nik.mol...@consbio.org> wrote:

>  You could use a class, such as:
>
> class TO_USE:
> Y = 'Yes'
> N = 'No'
>
> if char == TO_USE.Y:
> pass
>
> _Nik
>
>
> On 2/1/2012 1:45 PM, NENAD CIKIC wrote:
>
> Hello, the subject expresses my discomfort with certain python
> characteristics, given my background, and my lack of python knowledge.
> Specifically lets say that I have a model with a Text field and char
> field. The char field is length 1 and says "use or do not use the text
> field". The char field can have Y or N values.
> So using the admin interface I wanted to override the clean method but I
> did not want to write
> if text.__len__==0 and char=='Y':
>   raise exception
>
> In C/C++ you would use enum for these sort of things. So I ended with
> defining in models.py something as:
> TO_USE= (
> ('Y', 'Yes'),
> ('N', 'No'),
> )
>
> class X(models.Model):
> txt= models.CharField(db_index=True,null=True,
> blank=True,max_length=30)
> use_txt=
> models.CharField(blank=False,max_length=1,default='D',choices=TO_USE)
>
> and in admin.py something as
> class XForm(forms.ModelForm):
> def clean(self):
> cleaned_data=super(XForm, self).clean()
> txt= cleaned_data['txt'].strip()
> use_txt=cleaned_data['use_txt'].strip()
>
> if txt.__len__()==0 and use_txt==TO_USE.__getitem__(0)[0]:
> raise forms.ValidationError('This is needed!')
>
> return cleaned_data
>
> The part .__getitem__(0)[0] is not very readable. I have looked for enums
> in python, and if I have understood well, it seems they are not implemented.
> What is the best way to do it in python for my problem, given that I do
> not want to write =='Y'.
> Thanks
> Nenad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/oqGo6Td_lYoJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Newbie django/python with C++ background wants enums

2012-02-01 Thread Nikolas Stevenson-Molnar

You could use a class, such as:

class TO_USE:
Y = 'Yes'
N = 'No'

if char == TO_USE.Y:
pass

_Nik

On 2/1/2012 1:45 PM, NENAD CIKIC wrote:
Hello, the subject expresses my discomfort with certain python 
characteristics, given my background, and my lack of python knowledge.
Specifically lets say that I have a model with a Text field and char 
field. The char field is length 1 and says "use or do not use the text 
field". The char field can have Y or N values.
So using the admin interface I wanted to override the clean method but 
I did not want to write

if text.__len__==0 and char=='Y':
  raise exception

In C/C++ you would use enum for these sort of things. So I ended with 
defining in models.py something as:

TO_USE= (
('Y', 'Yes'),
('N', 'No'),
)

class X(models.Model):
txt= models.CharField(db_index=True,null=True, 
blank=True,max_length=30)
use_txt= 
models.CharField(blank=False,max_length=1,default='D',choices=TO_USE)


and in admin.py something as
class XForm(forms.ModelForm):
def clean(self):
cleaned_data=super(XForm, self).clean()
txt= cleaned_data['txt'].strip()
use_txt=cleaned_data['use_txt'].strip()

if txt.__len__()==0 and use_txt==TO_USE.__getitem__(0)[0]:
raise forms.ValidationError('This is needed!')

return cleaned_data

The part .__getitem__(0)[0] is not very readable. I have looked for 
enums in python, and if I have understood well, it seems they are not 
implemented.
What is the best way to do it in python for my problem, given that I 
do not want to write =='Y'.

Thanks
Nenad

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/oqGo6Td_lYoJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Newbie django/python with C++ background wants enums

2012-02-01 Thread NENAD CIKIC
Hello, the subject expresses my discomfort with certain python 
characteristics, given my background, and my lack of python knowledge.
Specifically lets say that I have a model with a Text field and char field. 
The char field is length 1 and says "use or do not use the text field". The 
char field can have Y or N values.
So using the admin interface I wanted to override the clean method but I 
did not want to write
if text.__len__==0 and char=='Y':
  raise exception

In C/C++ you would use enum for these sort of things. So I ended with 
defining in models.py something as:
TO_USE= (
('Y', 'Yes'),
('N', 'No'),
)

class X(models.Model):
txt= models.CharField(db_index=True,null=True, blank=True,max_length=30)
use_txt= 
models.CharField(blank=False,max_length=1,default='D',choices=TO_USE)

and in admin.py something as
class XForm(forms.ModelForm):
def clean(self):
cleaned_data=super(XForm, self).clean()
txt= cleaned_data['txt'].strip()
use_txt=cleaned_data['use_txt'].strip()

if txt.__len__()==0 and use_txt==TO_USE.__getitem__(0)[0]:
raise forms.ValidationError('This is needed!')

return cleaned_data

The part .__getitem__(0)[0] is not very readable. I have looked for enums 
in python, and if I have understood well, it seems they are not implemented.
What is the best way to do it in python for my problem, given that I do not 
want to write =='Y'.
Thanks 
Nenad

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



Re: Building authentication backend

2012-02-01 Thread Lee Hinde
On Feb 1, 2012, at 12:24 AM, apalsson wrote:

> Hello.
> 
> A very simple question.
> 
> I am building an authentication back end to support TWO passwords.
> This requires me to add an extra table to store the secondary password
> plus a ForeignKey to User.
> 
> The confusing part is, how I make Django automatically create the
> needed table when SyncDB is run?
> And how do I make this new table show up in the Admin-interface as
> well?
> 

https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users


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



django-compressor throwing a 500 when DEBUG = False

2012-02-01 Thread CLIFFORD ILKAY

Hello,

We're working on a Django 1.3 site on which we're using 
django-compressor . When 
DEBUG = True, everything works as expected. When DEBUG = False, 
django-compressor throws a 500 claiming that it can't find the unified 
CSS file that it just created. How do I know it created it? I can remove 
it and on the next request, I'll see a new CSS file named something like 
/static/CACHE/css/c70b102e84e3.css which I presume django-compressor 
created.


I've run "collectstatic" so the static files that compressor is supposed 
to be (and apparently is) combining/compressing are in the directory 
defined by settings.STATIC_ROOT.


In base.html, I have:

{% load compress %}
{% compress css %}








{% endcompress %}


What am I missing?
--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

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



Re: Building authentication backend

2012-02-01 Thread Mario Gudelj
I'm new to Django too, but I suspect you'd do something like this:

class AdditinoalUserInfo(models.Model):
user = models.ForeignKey(User, unique=True)
extra_password = models.CharField("Password", blank=True)

That will create a new table for you and a column for new password. You
then need to use Django functions to hash the content of the extra_password
field.

I hope that helps!

-m

On 1 February 2012 19:24, apalsson  wrote:

> Hello.
>
> A very simple question.
>
> I am building an authentication back end to support TWO passwords.
> This requires me to add an extra table to store the secondary password
> plus a ForeignKey to User.
>
> The confusing part is, how I make Django automatically create the
> needed table when SyncDB is run?
> And how do I make this new table show up in the Admin-interface as
> well?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: admin list_filter: limit choices to model values?

2012-02-01 Thread Micky Hulse
Related to my original question:

On top of needing to limit list_filter in the admin, I also needed to
limit the user choices in my FK to auth.user. This bit of code does
just that:



Just thought I would share the code to help others.

I am wondering if I can apply the same logic, as a method, to list_filter?

list_filter = SomeMethod()

(probably not, but that would be nice)

Anywho... Anyone know when Django 1.4 is scheduled to be released?

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



Problem sending an email in html with mime image

2012-02-01 Thread Ariel
Hi everybody I have a question, here is my problem I want to send an
email with content in html with an image embed so I converted the
image binary in mime text and then I put the mime code inside the src
attribute of the html like this:



Then I send the email, here is my code:

from django.template.loader import render_to_string
from django.core.mail.message import EmailMultiAlternatives

contextcopy = {}
message = render_to_string('bulletin.html', contextcopy)
subject = "TEST"
msg = EmailMultiAlternatives(subject, message,
from_email,['myem...@gmail.com''])
msg.attach_alternative(message, "text/html")
msg.send()

The problem is that if I don't put the image mime code inside the src
the email is sent but when I put the code then the email is not send
and I don't get any error message.

Could somebody please, help me ???
Why the email is not send when I put the mime code of the image in the html ???

Regards,
Ariel

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



Re: Turbogears to Dajngo

2012-02-01 Thread Ovnicraft
On Wed, Feb 1, 2012 at 2:34 PM, sajuptpm  wrote:

> HI,
>
> I have a project developed in turbogears, i want to move it to
> Django,  is it possible ???
> I am using following feature of TG2
> controller
> sqlalchemy
> tg2env
> developement.ini
> Not using any template system, since UI developed using EXTJS
>

Hello you can start here http://bit.ly/ui9piz so you can check the Model
and View layers for you.

Regards,

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


-- 
Cristian Salamea
@ovnicraft

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



Turbogears to Dajngo

2012-02-01 Thread sajuptpm
HI,

I have a project developed in turbogears, i want to move it to
Django,  is it possible ???
I am using following feature of TG2
controller
sqlalchemy
tg2env
developement.ini
Not using any template system, since UI developed using EXTJS

Reason to this change is, Pylons stopped further support for TG2.

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



Startup Chile Company Looking For Founding Developer/CTO

2012-02-01 Thread Jennifer Turliuk
Hi everyone,

My name is Jennifer Turliuk. I'm currently in Santiago, Chile for the
next 6 months as part of the Startup Chile program. I think you may be
able to help me out. We are looking to bring on a developer ASAP (see
description below).

If you are interested, we'd love to hear from you. Or, if you know of
anyone that may be interested, we'd be very grateful if you would pass
this along.

Thanks in advance, and I look forward to hearing from you.

Regards,
Jenn

*Startup Chile Company Looking for Founding Developer/CTO*

We’re building a highly curated online marketplace where people can
find others to exchange skills with on a one-to-one, offline basis.
We’re
looking for a full-time founding developer/CTO to join us, starting
with
the first 6 months in Santiago, Chile as part of the Startup Chile
program.

*About Us*: - Selected for Startup Chile program (alumni: Cruisewise,
Gym-pact) - Secured seed funding - Finalist in competition to shadow
Dave McClure (500 Startups) - Spoke on stage with Peter Thiel - First
website was featured in magazine at age 13 - Top sales associate in
one of N.A.’s most aggressive sales environments - Publicity stunt
garnered $4MM in media coverage in 24hrs - Attended the Oscars &
Grammys - Member of exclusive kiteboarding group with CEOs of
Dropbox, Scribd, Gowalla, etc.

*About the Role*: - Build an AirBnB for skills-exchanges, where
people
can list skills that they can offer and want to learn (e.g. if they
want to
learn Spanish and can teach programming, they can find people to
exchange with via trade or money) - Create a new sharing economy
where time is the currency - Join a tight team that is serious about
winning but also has a great time - Opportunity to build a team and
manage others as we grow - Flexible compensation includes flights
to South America, accommodation, salary, and equity.

*About You*: - Comfortable with backend work, particularly working
with databases and keeping an eye on application performance -
Excited
by challenges and the flexibility of a consumer-facing web startup - A
deep-seated love of efficient/elegant Python, Ruby, Node.js or Django
(front-end knowledge is also helpful) - Passionate about the business
idea - Able to relocate to Santiago, Chile for 6 months fairly
quickly.

Contact us at jenn.turl...@gmail.com by February 1st.

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



Re: what is the best IDE to use for Python / Django

2012-02-01 Thread Moises Alberto Lindo Gutarra
Aptana 3

2012/2/1 Bastian Ballmann :
> And what exact feature makes PyCharm an IDE that emacs hasnt?
> SCNR ;)
>
> Am 23.01.2012 13:41, schrieb Leandro Ostera Villalva:
>
> That's because PyCharm is an actual IDE while gedit, st2, emacs, vi and
> forth are text editors.
>
> El 23 de enero de 2012 04:35, Mario Gudelj 
> escribió:
>>
>> I've used gedit, sublime text 2, emacs, vi, but the best Django IDE by far
>> is PyCharm. I'm seriously amazed at how awesome it is. It's worth every
>> cent.
>>
>>
>> On 23 January 2012 22:20, Sandro Dutra  wrote:
>>>
>>> The best IDE is that you fell comfortable using it.
>>>
>>> 2012/1/21 goosfancito :
>>> > El 21/01/12 08:52, kenneth gonsalves escribió:
>>> >
>>> >> On Sat, 2012-01-21 at 03:34 -0800, John Yeukhon Wong wrote:
>>> >>>
>>> >>> While it has been asked a trillion times already, let me say TRY UT
>>> >>> YOURSELF.
>>> >>
>>> >> you were requested not to feed this thread. If the OP cannot search,
>>> >> here it is:
>>> >>
>>> >>
>>> >> http://duckduckgo.com/?q=site%3Agroups.google.com%2Fgroup%2Fdjango-users
>>> >> +python+IDE
>>> >
>>> > i used gedit only.
>>> >
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "Django users" group.
>>> > To post to this group, send email to django-users@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > django-users+unsubscr...@googlegroups.com.
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/django-users?hl=en.
>>> >
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
> --
> Regards,
>
> Leandro Ostera,
> BLOG - Check what I'm doing now
> EMAIL - Write me an email
> SHOWCASE - Check my latest projects
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> Bastian Ballmann / Web Developer
> Notch Interactive GmbH / Badenerstrasse 571 / 8048 Zürich
> Phone +41 43 818 20 91 / www.notch-interactive.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Atte.
Moisés Alberto Lindo Gutarra
Asesor - Desarrollador Java / Open Source
Linux Registered User #431131 - http://counter.li.org/
Cel: (511) 995081720 - Rpm: *548913
EMail: mli...@gmail.com
MSN: mli...@tumisolutions.com

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



Re: Using another database while testing

2012-02-01 Thread Denis Darii
You can redefine your database connection by adding somewhere at the end of
your settings.py something like:

import sys
if 'test' in sys.argv:
DATABASES = ...

hope this helps.

On Wed, Feb 1, 2012 at 6:01 PM, xina towner  wrote:

> I have a problem, django can't create my database because a dependency, I
> create it manually with a script, is there any way I can specify to the
> testing tool to use my database?thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

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



Which conferences for promoting a new FLOSS nanotech project?

2012-02-01 Thread Torsten Bronger
Hallöchen!

We have implemented a samples database in our nanotech research
institute using Django.  I did most of it, and we have a full time
employee working on it for three years.  So far, it's 60.000 LOC.  I
plan to make in open source, and I'm optimistic that the director of
the institute will approve it.  Now, it's time to plan to build a
community around the project.

I intent to go to DjangoCon this year, however, I wonder whether
this is the right audience.  What I'm looking for are geeks in
nanotech/biotech institutes around the world who are interested in
adapting the system to their institution.  (Because the system is
*very* flexible, this adaption process is important and tricky.)  Of
course, I hope that those people will also improve the core code so
that other institutions can benefit.

Where do you think I should go?  Are there people like the ones I'm
looking for at DjangoCon or its european counterpart?

Tschö,
Torsten.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

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



Re: template error in html forms

2012-02-01 Thread Joel Goldstick
On Wed, Feb 1, 2012 at 10:00 AM, yati sagade  wrote:

> I've never run in to a TemplateError for anything other than what I
> pointed out - maybe in the settings module it is ".../templates" and the
> name of the directory is "template" (note the 's' in the end) or the other
> way round. Anyway, check for any misspelling in the template name itself -
> or whether the template 'search_results.html' is directly under the
> template directory and not under any subdirectory therein.
>
> If you could post the entire debug info (Also the one at the far bottom of
> the error page), it might be helpful for us.
>
>
> On Wed, Feb 1, 2012 at 8:22 PM, TANYA  wrote:
>
>> yes, the path is already there. Maybe the problem is either in views.py
>> or url.py file if changed it gives different error, but i dont know what to
>> look for in those two files.
>>
>>
>> On Wed, Feb 1, 2012 at 2:40 PM, yati sagade wrote:
>>
>>> in settings.py, in the TEMPLATE_DIRS setting, add the absolute path to
>>> your templates directory - something like "/path/to/project/dir/template".
>>> This MUST be an absolute path. And if your modifying this setting for the
>>> first time, be sure to leave a comma (,) in the end of that path (Sorry if
>>> you knew that already :))
>>>
>>>
>>> On Wed, Feb 1, 2012 at 7:59 PM, TANYA  wrote:
>>>
 the installed apps has 'mysite.books', in the path and the html
 files are in a directory under mysite project directory. Is that correct?



 On Wed, Feb 1, 2012 at 12:06 PM, Ankit Rai wrote:

> Please check your template path in settings.py.
>
>
>
>
> On Wed, Feb 1, 2012 at 5:29 PM, TANYA  wrote:
>
>> In views.py, when I add this code gives template error.
>>
>> def search(request):
>> error = False
>> if 'q' in request.GET:
>> q = request.GET['q']
>> if not q:
>> error = True
>> else:
>> books = Book.objects.filter(title__icontains=q)
>> return render_to_response('search_results.html',
>> {'books': books, 'query': q})
>> return render_to_response('search_form.html',
>> {'error': error})
>>
>> I have created search_form.html and search.html and put it in
>> "template" directory but get this error ,
>>
>> TemplateDoesNotExist at /search/
>>
>> search_form.html
>>
>>  Request Method: GET  Request URL: http://127.0.0.1:8000/search/  Django
>> Version: 1.3.1  Exception Type: TemplateDoesNotExist  Exception
>> Value:
>>
>> search_form.html
>>
>>  Exception Location: 
>> /usr/local/lib/python2.6/dist-packages/django/template/loader.py
>> in find_template, line 138  Python Executable: /usr/bin/python
>> --
>> TANYA
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
>
> *Ankit Rai*
>
> *
> *
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



 --
 TANYA

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

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

Re: Django Admin completely empty

2012-02-01 Thread darwin_tech
All db tables are in place and the settings hold the correct login
info. I can interact with all models in the shell and my applications
run without problem (i.e. return data from the db).

Sam

On Feb 1, 11:17 am, Joel Goldstick  wrote:
> On Wed, Feb 1, 2012 at 12:11 PM, darwin_tech  wrote:
> > The source is also empty:
>
> >        
> >        
> >        
>
> >        
> >        
>
> > as though it is aware there should be model information but is not
> > receiving any
>
> > Any more suggestions? This is really perplexing me.
>
> > Sam
>
> > On Jan 31, 2:42 pm, Joel Goldstick  wrote:
> >> On Jan 30, 5:14 pm, darwin_tech  wrote:
>
> >> > hmmm. I am the superuser, but I went ahead and tried the createuser
> >> > command to make another. Still the same in the admin. No models or
> >> > user/privilege options. The strange thing is there are boxes where you
> >> > would expect apps/models top be, but they are totally empty.
>
> >> > Any other suggestions?
>
> >> > Sam
>
> >> > On Jan 30, 3:40 pm, Andres Reyes  wrote:
>
> >> > > Do you have permissions on the models you want to see?
>
> >> > > You can create a new superuser with
> >> > > python manage.py createsuperuser
>
> >> > > 2012/1/30 darwin_tech :
>
> >> > > > Hi,
>
> >> > > > On my development server my Django Admin works as expected, showing
> >> > > > all my
> >> > > > models and the auth models. However, on the production server, even
> >> > > > though the whole application works fine, when I log into the admin I
> >> > > > see nothing. No models, no auth. Just a stack of empty boxes.
> >> > > > If anyone has any idea as to why this might be, your input would be
> >> > > > much appreciated.
>
> >> > > > Sam
>
> >> Look at the source of the page.  Maybe there is a clue there.  I was
> >> wondering if you might have white letters on white background for some
> >> weird reason?
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> Did you port your db tables?  Do you know you can access the db with
> the username/pw in settings?  Maybe it sees the models but can't get
> to the data?
>
> --
> Joel Goldstick

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



django-mptt compared w/ django-treebeard

2012-02-01 Thread Aljosa Mohorovic
when using django-mptt or django-treebeard did anybody have bad
experience?
i've used treebeard before w/o problems but it looks like mptt is
maintained and has newer releases and treebeard last release was in
2010.

can anybody comment on possible future development/maintenance for
these projects?

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



Re: Django Admin completely empty

2012-02-01 Thread Joel Goldstick
On Wed, Feb 1, 2012 at 12:11 PM, darwin_tech  wrote:
> The source is also empty:
>
>        
>        
>        
>
>        
>        
>
> as though it is aware there should be model information but is not
> receiving any
>
> Any more suggestions? This is really perplexing me.
>
> Sam
>
> On Jan 31, 2:42 pm, Joel Goldstick  wrote:
>> On Jan 30, 5:14 pm, darwin_tech  wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > hmmm. I am the superuser, but I went ahead and tried the createuser
>> > command to make another. Still the same in the admin. No models or
>> > user/privilege options. The strange thing is there are boxes where you
>> > would expect apps/models top be, but they are totally empty.
>>
>> > Any other suggestions?
>>
>> > Sam
>>
>> > On Jan 30, 3:40 pm, Andres Reyes  wrote:
>>
>> > > Do you have permissions on the models you want to see?
>>
>> > > You can create a new superuser with
>> > > python manage.py createsuperuser
>>
>> > > 2012/1/30 darwin_tech :
>>
>> > > > Hi,
>>
>> > > > On my development server my Django Admin works as expected, showing
>> > > > all my
>> > > > models and the auth models. However, on the production server, even
>> > > > though the whole application works fine, when I log into the admin I
>> > > > see nothing. No models, no auth. Just a stack of empty boxes.
>> > > > If anyone has any idea as to why this might be, your input would be
>> > > > much appreciated.
>>
>> > > > Sam
>>
>> Look at the source of the page.  Maybe there is a clue there.  I was
>> wondering if you might have white letters on white background for some
>> weird reason?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
Did you port your db tables?  Do you know you can access the db with
the username/pw in settings?  Maybe it sees the models but can't get
to the data?



-- 
Joel Goldstick

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



Re: Django Admin completely empty

2012-02-01 Thread darwin_tech
The source is also empty:








as though it is aware there should be model information but is not
receiving any

Any more suggestions? This is really perplexing me.

Sam

On Jan 31, 2:42 pm, Joel Goldstick  wrote:
> On Jan 30, 5:14 pm, darwin_tech  wrote:
>
>
>
>
>
>
>
>
>
> > hmmm. I am the superuser, but I went ahead and tried the createuser
> > command to make another. Still the same in the admin. No models or
> > user/privilege options. The strange thing is there are boxes where you
> > would expect apps/models top be, but they are totally empty.
>
> > Any other suggestions?
>
> > Sam
>
> > On Jan 30, 3:40 pm, Andres Reyes  wrote:
>
> > > Do you have permissions on the models you want to see?
>
> > > You can create a new superuser with
> > > python manage.py createsuperuser
>
> > > 2012/1/30 darwin_tech :
>
> > > > Hi,
>
> > > > On my development server my Django Admin works as expected, showing
> > > > all my
> > > > models and the auth models. However, on the production server, even
> > > > though the whole application works fine, when I log into the admin I
> > > > see nothing. No models, no auth. Just a stack of empty boxes.
> > > > If anyone has any idea as to why this might be, your input would be
> > > > much appreciated.
>
> > > > Sam
>
> Look at the source of the page.  Maybe there is a clue there.  I was
> wondering if you might have white letters on white background for some
> weird reason?

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



Using another database while testing

2012-02-01 Thread xina towner
I have a problem, django can't create my database because a dependency, I
create it manually with a script, is there any way I can specify to the
testing tool to use my database?thanks

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



Re: what is the best IDE to use for Python / Django

2012-02-01 Thread Masklinn
On 2012-02-01, at 17:00 , Bastian Ballmann wrote:
> And what exact feature makes PyCharm an IDE that emacs hasnt?

* Semantics navigation (not via tags, it knows to find a class when you want a 
class)
* Better static analysis and language knowledge (the type inference is still 
pretty limited, but if you instantiate an object and call a method on it it 
knows and only proposes the available methods)
  - virtualenv-aware, knows to restrict its libraries search to the project's 
virtualenv
  - errors and warnings are faster to display than via flymake in my experience
  - also intentions and quickfixes, PyCharm can improve or simplify code for 
known bad or sub-par patterns, and can fix a limited number of errors (PyCharm 
will suggest importing a module you reference without you having to go to the 
module top and doing so manually)
  - display of quick references (for params) and docstrings, inline
  - finds all references to an object
* Much, much better (faster, more expansive and with less bullet holes) 
refactoring support than Rope & ropemacs (I use both)
* Good support of various template languages (Django, Jinja2 and Mako as of 
2.0) with autocompletion, basic static analysis, syntax highlighting, etc…
* Semantic knowledge of Django projects
  - jumping between a view and its template
  - or between a translation block and the corresponding PO file
* Much better debugging story
  - Pretty good visual debugger with watches and conditional breakpoints
  - Remote debugger (via a specific agent)
  - Django templates debugging
* Also supports Cython and Javascript (and CoffeeScript) with a big subset of 
the Python support goodies

It's quite a bit heavier than Emacs (often though not necessarily slower 
depending on what you use, since Emacs will lock up when it needs to work hard 
e.g. when Rope runs), but it does a lot more.

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



Re: what is the best IDE to use for Python / Django

2012-02-01 Thread Bastian Ballmann

And what exact feature makes PyCharm an IDE that emacs hasnt?
SCNR ;)

Am 23.01.2012 13:41, schrieb Leandro Ostera Villalva:
That's because PyCharm is an actual IDE while gedit, st2, emacs, vi 
and forth are text editors.


El 23 de enero de 2012 04:35, Mario Gudelj > escribió:


I've used gedit, sublime text 2, emacs, vi, but the best Django
IDE by far is PyCharm. I'm seriously amazed at how awesome it is.
It's worth every cent.


On 23 January 2012 22:20, Sandro Dutra mailto:hexo...@gmail.com>> wrote:

The best IDE is that you fell comfortable using it.

2012/1/21 goosfancito mailto:goosfanc...@gmail.com>>:
> El 21/01/12 08:52, kenneth gonsalves escribió:
>
>> On Sat, 2012-01-21 at 03:34 -0800, John Yeukhon Wong wrote:
>>>
>>> While it has been asked a trillion times already, let me
say TRY UT
>>> YOURSELF.
>>
>> you were requested not to feed this thread. If the OP
cannot search,
>> here it is:
>>
>>
http://duckduckgo.com/?q=site%3Agroups.google.com%2Fgroup%2Fdjango-users
>> +python+IDE
>
> i used gedit only.
>
>
> --
> You received this message because you are subscribed to the
Google Groups
> "Django users" group.
> To post to this group, send email to
django-users@googlegroups.com
.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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


-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.




--
Regards,

Leandro Ostera,
/BLOG - Check what I'm doing now 
EMAIL - Write me an email 
SHOWCASE - Check my latest projects /

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



--
Bastian Ballmann / Web Developer
Notch Interactive GmbH / Badenerstrasse 571 / 8048 Zürich
Phone +41 43 818 20 91 / www.notch-interactive.com

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



Re: How to get unique results from fields in sliced QuerySet ?

2012-02-01 Thread bash look

Thanks for share , Anssi.

I think the same way.
Hope another solution rather than sliced, like LIMIT options on QuerySet 
in the future.


Using raw SQL can not be avoided at this cases.

Thanks anyway

Bash

On 02/01/2012 09:14 PM, akaariai wrote:

On Feb 1, 10:24 am, bash look  wrote:

Hi all,

I have models called Books.

To get unique results from Books, usually I use order_by().values('field').
For example, I want unique writter :

Books.objects.filter(created__year=2012).order_by('writter').values('writter').distinct()

But, how to get unique results from sliced Queryset ?

books = Books.objects.filter(created__year=2012)[:5]

# Doesnt' works , Can reorder a query once  a slice has been taken
unique = books.order_by('writter').values('writter').distinct()

# Doesnt' works, it will show all queryset (not unique)
unique = books.values('writter').distinct()

# Also doesn't works
unique = books.annotate().values('writter').distinct()
unique = books.values('writter').distinct().annotate().

Anyone have this problem ? Is it possible to get unique results from
sliced queryset ?

I am afraid that using Django ORM this is not possible. The reason is,
the real SQL query would look something like:
select distinct writer from (
select writer from books where year = 2012 order by writer limit 5
);
And Django ORM just can't do that query for you. You might want to do
a raw SQL query, or just do the "distinct" step in Python, which is
probably the easiest solution (set() is your friend here).

Of course, if you want the first 5 distinct writers, thats easy to do.
But getting the distinct writer values in the 5 first rows is harder
to do.

  - Anssi



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



Re: template error in html forms

2012-02-01 Thread yati sagade
I've never run in to a TemplateError for anything other than what I pointed
out - maybe in the settings module it is ".../templates" and the name of
the directory is "template" (note the 's' in the end) or the other way
round. Anyway, check for any misspelling in the template name itself - or
whether the template 'search_results.html' is directly under the template
directory and not under any subdirectory therein.

If you could post the entire debug info (Also the one at the far bottom of
the error page), it might be helpful for us.

On Wed, Feb 1, 2012 at 8:22 PM, TANYA  wrote:

> yes, the path is already there. Maybe the problem is either in views.py or
> url.py file if changed it gives different error, but i dont know what to
> look for in those two files.
>
>
> On Wed, Feb 1, 2012 at 2:40 PM, yati sagade  wrote:
>
>> in settings.py, in the TEMPLATE_DIRS setting, add the absolute path to
>> your templates directory - something like "/path/to/project/dir/template".
>> This MUST be an absolute path. And if your modifying this setting for the
>> first time, be sure to leave a comma (,) in the end of that path (Sorry if
>> you knew that already :))
>>
>>
>> On Wed, Feb 1, 2012 at 7:59 PM, TANYA  wrote:
>>
>>> the installed apps has 'mysite.books', in the path and the html
>>> files are in a directory under mysite project directory. Is that correct?
>>>
>>>
>>>
>>> On Wed, Feb 1, 2012 at 12:06 PM, Ankit Rai wrote:
>>>
 Please check your template path in settings.py.




 On Wed, Feb 1, 2012 at 5:29 PM, TANYA  wrote:

> In views.py, when I add this code gives template error.
>
> def search(request):
> error = False
> if 'q' in request.GET:
> q = request.GET['q']
> if not q:
> error = True
> else:
> books = Book.objects.filter(title__icontains=q)
> return render_to_response('search_results.html',
> {'books': books, 'query': q})
> return render_to_response('search_form.html',
> {'error': error})
>
> I have created search_form.html and search.html and put it in
> "template" directory but get this error ,
>
> TemplateDoesNotExist at /search/
>
> search_form.html
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/search/  Django
> Version: 1.3.1  Exception Type: TemplateDoesNotExist  Exception Value:
>
> search_form.html
>
>  Exception Location: 
> /usr/local/lib/python2.6/dist-packages/django/template/loader.py
> in find_template, line 138  Python Executable: /usr/bin/python
> --
> TANYA
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



 --

 *Ankit Rai*

 *
 *

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

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



-- 
Yati Sagade 

(@yati_itay )

-- 
You received this message because you are subscribed to t

Re: template error in html forms

2012-02-01 Thread TANYA
yes, the path is already there. Maybe the problem is either in views.py or
url.py file if changed it gives different error, but i dont know what to
look for in those two files.

On Wed, Feb 1, 2012 at 2:40 PM, yati sagade  wrote:

> in settings.py, in the TEMPLATE_DIRS setting, add the absolute path to
> your templates directory - something like "/path/to/project/dir/template".
> This MUST be an absolute path. And if your modifying this setting for the
> first time, be sure to leave a comma (,) in the end of that path (Sorry if
> you knew that already :))
>
>
> On Wed, Feb 1, 2012 at 7:59 PM, TANYA  wrote:
>
>> the installed apps has 'mysite.books', in the path and the html files
>> are in a directory under mysite project directory. Is that correct?
>>
>>
>>
>> On Wed, Feb 1, 2012 at 12:06 PM, Ankit Rai  wrote:
>>
>>> Please check your template path in settings.py.
>>>
>>>
>>>
>>>
>>> On Wed, Feb 1, 2012 at 5:29 PM, TANYA  wrote:
>>>
 In views.py, when I add this code gives template error.

 def search(request):
 error = False
 if 'q' in request.GET:
 q = request.GET['q']
 if not q:
 error = True
 else:
 books = Book.objects.filter(title__icontains=q)
 return render_to_response('search_results.html',
 {'books': books, 'query': q})
 return render_to_response('search_form.html',
 {'error': error})

 I have created search_form.html and search.html and put it in
 "template" directory but get this error ,

 TemplateDoesNotExist at /search/

 search_form.html

  Request Method: GET  Request URL: http://127.0.0.1:8000/search/  Django
 Version: 1.3.1  Exception Type: TemplateDoesNotExist  Exception Value:

 search_form.html

  Exception Location: 
 /usr/local/lib/python2.6/dist-packages/django/template/loader.py
 in find_template, line 138  Python Executable: /usr/bin/python
 --
 TANYA

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

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



-- 
TANYA

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



Re: template error in html forms

2012-02-01 Thread yati sagade
in settings.py, in the TEMPLATE_DIRS setting, add the absolute path to your
templates directory - something like "/path/to/project/dir/template". This
MUST be an absolute path. And if your modifying this setting for the first
time, be sure to leave a comma (,) in the end of that path (Sorry if you
knew that already :))

On Wed, Feb 1, 2012 at 7:59 PM, TANYA  wrote:

> the installed apps has 'mysite.books', in the path and the html files
> are in a directory under mysite project directory. Is that correct?
>
>
>
> On Wed, Feb 1, 2012 at 12:06 PM, Ankit Rai  wrote:
>
>> Please check your template path in settings.py.
>>
>>
>>
>>
>> On Wed, Feb 1, 2012 at 5:29 PM, TANYA  wrote:
>>
>>> In views.py, when I add this code gives template error.
>>>
>>> def search(request):
>>> error = False
>>> if 'q' in request.GET:
>>> q = request.GET['q']
>>> if not q:
>>> error = True
>>> else:
>>> books = Book.objects.filter(title__icontains=q)
>>> return render_to_response('search_results.html',
>>> {'books': books, 'query': q})
>>> return render_to_response('search_form.html',
>>> {'error': error})
>>>
>>> I have created search_form.html and search.html and put it in "template"
>>> directory but get this error ,
>>>
>>> TemplateDoesNotExist at /search/
>>>
>>> search_form.html
>>>
>>>  Request Method: GET  Request URL: http://127.0.0.1:8000/search/  Django
>>> Version: 1.3.1  Exception Type: TemplateDoesNotExist  Exception Value:
>>>
>>> search_form.html
>>>
>>>  Exception Location: 
>>> /usr/local/lib/python2.6/dist-packages/django/template/loader.py
>>> in find_template, line 138  Python Executable: /usr/bin/python
>>> --
>>> TANYA
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> --
>>
>> *Ankit Rai*
>>
>> *
>> *
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> TANYA
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Yati Sagade 

(@yati_itay )

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



Re: template error in html forms

2012-02-01 Thread TANYA
the installed apps has 'mysite.books', in the path and the html files
are in a directory under mysite project directory. Is that correct?


On Wed, Feb 1, 2012 at 12:06 PM, Ankit Rai  wrote:

> Please check your template path in settings.py.
>
>
>
>
> On Wed, Feb 1, 2012 at 5:29 PM, TANYA  wrote:
>
>> In views.py, when I add this code gives template error.
>>
>> def search(request):
>> error = False
>> if 'q' in request.GET:
>> q = request.GET['q']
>> if not q:
>> error = True
>> else:
>> books = Book.objects.filter(title__icontains=q)
>> return render_to_response('search_results.html',
>> {'books': books, 'query': q})
>> return render_to_response('search_form.html',
>> {'error': error})
>>
>> I have created search_form.html and search.html and put it in "template"
>> directory but get this error ,
>>
>> TemplateDoesNotExist at /search/
>>
>> search_form.html
>>
>>  Request Method: GET  Request URL: http://127.0.0.1:8000/search/  Django
>> Version: 1.3.1  Exception Type: TemplateDoesNotExist  Exception Value:
>>
>> search_form.html
>>
>>  Exception Location: 
>> /usr/local/lib/python2.6/dist-packages/django/template/loader.py
>> in find_template, line 138  Python Executable: /usr/bin/python
>> --
>> TANYA
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
>
> *Ankit Rai*
>
> *
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
TANYA

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



Re: ANN: OGC Web Feature Service for GeoDjango

2012-02-01 Thread Jeff Heard
Great.  There's more coming down the pipe.  WFS was the first thing I had
reasonably finished...

On Tue, Jan 31, 2012 at 10:16 AM, George Silva wrote:

> Wow! Congratulations on this release.
>
> I'm looking at it right now.
>
> :D
>
> On Tue, Jan 31, 2012 at 1:11 PM, Jeff Heard 
> wrote:
>
>> https://github.com/JeffHeard/ga_ows
>>
>> http://geoanalytics.renci.org/uncategorized/ogc-wfs-for-django-released-on-github/
>>
>> It's not feature complete yet by any means, but it is quite usable.
>>  There is also an implementation of WMS included, but it is currently
>> undocumented as I clean up that code and make it similar to my more
>> recently implemented WFS.  This package is a reusable app that will allow
>> you to expose any GeoDjango model as a Web Feature Service.
>>
>> Supported formats for output are currently anything that is supported by
>> a single-file format in OGR.  Shapefiles are not yet supported for output
>> but will be soon.
>>
>> Also, you can adapt WFS to any python object (including other ORMs) by
>> deriving from WFSAdapter.
>>
>> -- Jeff
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> George R. C. Silva
>
> Desenvolvimento em GIS
> http://geoprocessamento.net
> http://blog.geoprocessamento.net
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Using Context Processor as form with HttpResponseRedirect

2012-02-01 Thread Jenna Pullen
Hi Daniel thanks for your reply that makes much more sense now.


On Wednesday, February 1, 2012, richard  wrote:
> Hi i have seen alot of people saying to use a context processor to
> include forms in multiple page. I have written a context processor
> login form that just returns the django Authentication form and
> everything works great including the form.errors etc except that I
> cant seem to redirect from the context processor after is_valid is
> called. Are context processors not supposed ot be used in this way? My
> thoughts inititally were that if it seems to support a request and can
> do the validation why not? Basically stuck on using
> HttpResponseRedirect in a context processor. I have managed to get
> this working by passing a variable called redirect in the dictionary
> returned to my template and then saying if the redirect tag is
> available use the browsers meta tag to redirect me but i dont think
> this is the way it should work. code below please advise thanks.
>
> context_processors.py
>
> from django.contrib.auth.forms import AuthenticationForm
> from django.http import HttpResponseRedirect
>
>
> def login_form(request):
>if request.method == 'POST':
>form = AuthenticationForm(data=request.POST)
>if form.is_valid():
>#return HttpResponseRedirect('/home') ONLY THING THATS NOT
> WORKING
>return {'login_form': form, 'redirect': '/home'}
>else:
>form = AuthenticationForm(request)
>return {'login_form': form}
>
> template.html
> {{ form.non_field_errors}} # works fine after post with errors showing
> {{ form.username}}
> {{ form.password}}
> {% if redirect %}
>   
>  {% endif %}

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



Re: Help Me With omab/django-socialauth

2012-02-01 Thread Thorsten Sanders
Some sort of error traceback/description would be helpful, from a quick 
look it seems all right.


On 01.02.2012 13:23, coded kid wrote:

Hey guys, I'm facing a huge  problem with omab/django/socialauth.

After setting all the necessary settings, I clicked on the “Enter
using Twitter” link on my homepage, it couldn’t redirect me to where I
will enter my twitter username and password. Below are my settings.
In settings.py

INSTALLED_APPS = (
'social_auth',
}

TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
   "django.contrib.messages.context_processors.messages",
   "django.core.context_processors.request",
   “social_auth.context_processors.social_auth_by_type_backends”,

)
AUTHENTICATION_BACKENDS = (
'social_auth.backends.twitter.TwitterBackend',
   'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')

TWITTER_CONSUMER_KEY = '0hdgdhsnmzHDGDK'
TWITTER_CONSUMER_SECRET  = 'YyNngsgw[1jw lcllcleleedfejewjuw'

LOGIN_URL = '/accounts/login/' #login form for users to log in with
their username and password!
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/homi/'  #page after user get
authenticated
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/homi/'   '  #page after
user get authenticated
SOCIAL_AUTH_ERROR_KEY='social_errors'

SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'

from django.template.defaultfilters import slugify
SOCIAL_AUTH_USERNAME_FIXER = lambda u: slugify(u)
SOCIAL_AUTH_UUID_LENGTH = 16
SOCIAL_AUTH_EXTRA_DATA = False

In urls.py
url(r'', include('social_auth.urls')),

In my template:

  Enter using Twitter
  

What do you think I’m doing wrong? Hope to hear from you soon. Thanks
so much!
N:B : I’m coding on windows machine. And in the development
environment using localhost:8000.

   


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



Re: ManyRelatedManager reference

2012-02-01 Thread akaariai

On Feb 1, 2:02 pm, "Demetrio Girardi" 
wrote:
> I can't find a reference for ManyRelatedManager in the django docs. I have
> a few questions that you can ignore if there is in fact a reference somewhere
> and you can point me to it.
>
> If my model is
>
> class Model(models.Model):
>         many = models.ManyToManyField(OtherModel)
>
> what does this do?
>         Model.objects.filter(many = instance_of_other_model)
>
> why do these not work, and what is the correct way to do it?
>         instance_of_model.many = another_instance.many
>         instance_of_model.many.add(another_instance.many)

Something like instance_of_model.many.add(another_instance.many.all())
might work.

> If I have two instances of OtherModel, how do construct a queryset that
> matches all instances of Model that reference both?

I think, but I am not sure, that you should do two chained .filter()
calls. Something like:
qs.filter(many__pk=other_instance1.pk).filter(many__pk=other_instance2.pk).
No guarantees of that doing anything sane :)

 - Anssi

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



Re: How to get unique results from fields in sliced QuerySet ?

2012-02-01 Thread akaariai
On Feb 1, 10:24 am, bash look  wrote:
> Hi all,
>
> I have models called Books.
>
> To get unique results from Books, usually I use order_by().values('field').
> For example, I want unique writter :
>
> Books.objects.filter(created__year=2012).order_by('writter').values('writter').distinct()
>
> But, how to get unique results from sliced Queryset ?
>
> books = Books.objects.filter(created__year=2012)[:5]
>
> # Doesnt' works , Can reorder a query once  a slice has been taken
> unique = books.order_by('writter').values('writter').distinct()
>
> # Doesnt' works, it will show all queryset (not unique)
> unique = books.values('writter').distinct()
>
> # Also doesn't works
> unique = books.annotate().values('writter').distinct()
> unique = books.values('writter').distinct().annotate().
>
> Anyone have this problem ? Is it possible to get unique results from
> sliced queryset ?

I am afraid that using Django ORM this is not possible. The reason is,
the real SQL query would look something like:
select distinct writer from (
   select writer from books where year = 2012 order by writer limit 5
);
And Django ORM just can't do that query for you. You might want to do
a raw SQL query, or just do the "distinct" step in Python, which is
probably the easiest solution (set() is your friend here).

Of course, if you want the first 5 distinct writers, thats easy to do.
But getting the distinct writer values in the 5 first rows is harder
to do.

 - Anssi

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



Django admin set column width in change list

2012-02-01 Thread SvilenMinkov
Hello ,

Newbie question here : I need to change the column width in django-
admin change list.
Can I do it in admin.ModelAdmin or models.Model.

Thanks,
Svilen.

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



Building authentication backend

2012-02-01 Thread apalsson
Hello.

A very simple question.

I am building an authentication back end to support TWO passwords.
This requires me to add an extra table to store the secondary password
plus a ForeignKey to User.

The confusing part is, how I make Django automatically create the
needed table when SyncDB is run?
And how do I make this new table show up in the Admin-interface as
well?

Thanks.

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



How to get unique results from fields in sliced QuerySet ?

2012-02-01 Thread bash look

Hi all,

I have models called Books.

To get unique results from Books, usually I use order_by().values('field').
For example, I want unique writter :

Books.objects.filter(created__year=2012).order_by('writter').values('writter').distinct()

But, how to get unique results from sliced Queryset ?

books = Books.objects.filter(created__year=2012)[:5]

# Doesnt' works , Can reorder a query once  a slice has been taken
unique = books.order_by('writter').values('writter').distinct()

# Doesnt' works, it will show all queryset (not unique)
unique = books.values('writter').distinct()

# Also doesn't works
unique = books.annotate().values('writter').distinct()
unique = books.values('writter').distinct().annotate().

Anyone have this problem ? Is it possible to get unique results from 
sliced queryset ?



Thanks

Bashlook


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



Re: Error making fixtures

2012-02-01 Thread akaariai
On Feb 1, 12:26 pm, xina towner  wrote:
> Hello, I'm tryng to do fixtures with dumpdata. I write this command:
>
> python manage.py dumpdata quests --indent=4 >
> quests/fixtures/quests_views_testdata.json
>
> But I get this error message:
>
> _mysql_exceptions.OperationalError: (1054, "Unknown column
> 'quests_quest.availability' in 'field list'")

It seems your table quests_quest is missing the column availability.
You probably have added this at some point to your model, but you
haven't added it to your database table. The most straightforward way
to do this synchronization is by good old SQL. You might also want to
look into south (database migrations tool).

 - Anssi

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



Help Me With omab/django-socialauth

2012-02-01 Thread coded kid
Hey guys, I'm facing a huge  problem with omab/django/socialauth.

After setting all the necessary settings, I clicked on the “Enter
using Twitter” link on my homepage, it couldn’t redirect me to where I
will enter my twitter username and password. Below are my settings.
In settings.py

INSTALLED_APPS = (
'social_auth',
}

TEMPLATE_CONTEXT_PROCESSORS = (
   "django.core.context_processors.auth",
   "django.core.context_processors.debug",
   "django.core.context_processors.i18n",
   "django.core.context_processors.media",
   "django.core.context_processors.static",
  "django.contrib.messages.context_processors.messages",
  "django.core.context_processors.request",
  “social_auth.context_processors.social_auth_by_type_backends”,

)
AUTHENTICATION_BACKENDS = (
   'social_auth.backends.twitter.TwitterBackend',
  'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')

TWITTER_CONSUMER_KEY = '0hdgdhsnmzHDGDK'
TWITTER_CONSUMER_SECRET  = 'YyNngsgw[1jw lcllcleleedfejewjuw'

LOGIN_URL = '/accounts/login/' #login form for users to log in with
their username and password!
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/homi/'  #page after user get
authenticated
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/homi/'   '  #page after
user get authenticated
SOCIAL_AUTH_ERROR_KEY='social_errors'

SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'

from django.template.defaultfilters import slugify
SOCIAL_AUTH_USERNAME_FIXER = lambda u: slugify(u)
SOCIAL_AUTH_UUID_LENGTH = 16
SOCIAL_AUTH_EXTRA_DATA = False

In urls.py
url(r'', include('social_auth.urls')),

In my template:

 Enter using Twitter
 

What do you think I’m doing wrong? Hope to hear from you soon. Thanks
so much!
N:B : I’m coding on windows machine. And in the development
environment using localhost:8000.

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



ManyRelatedManager reference

2012-02-01 Thread Demetrio Girardi
I can't find a reference for ManyRelatedManager in the django docs. I have 
a few questions that you can ignore if there is in fact a reference somewhere 
and you can point me to it.

If my model is 

class Model(models.Model):
many = models.ManyToManyField(OtherModel)


what does this do?
Model.objects.filter(many = instance_of_other_model)

why do these not work, and what is the correct way to do it?
instance_of_model.many = another_instance.many
instance_of_model.many.add(another_instance.many)

If I have two instances of OtherModel, how do construct a queryset that 
matches all instances of Model that reference both?

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



template error in html forms

2012-02-01 Thread TANYA
In views.py, when I add this code gives template error.

def search(request):
error = False
if 'q' in request.GET:
q = request.GET['q']
if not q:
error = True
else:
books = Book.objects.filter(title__icontains=q)
return render_to_response('search_results.html',
{'books': books, 'query': q})
return render_to_response('search_form.html',
{'error': error})

I have created search_form.html and search.html and put it in "template"
directory but get this error ,

TemplateDoesNotExist at /search/

search_form.html

 Request Method: GET  Request URL: http://127.0.0.1:8000/search/  Django
Version: 1.3.1  Exception Type: TemplateDoesNotExist  Exception Value:

search_form.html

 Exception Location:
/usr/local/lib/python2.6/dist-packages/django/template/loader.py
in find_template, line 138  Python Executable: /usr/bin/python
-- 
TANYA

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



Re: Using Context Processor as form with HttpResponseRedirect

2012-02-01 Thread Daniel Roseman
On Wednesday, 1 February 2012 01:34:03 UTC, richard wrote:
>
> Hi i have seen alot of people saying to use a context processor to 
> include forms in multiple page. I have written a context processor 
> login form that just returns the django Authentication form and 
> everything works great including the form.errors etc except that I 
> cant seem to redirect from the context processor after is_valid is 
> called. Are context processors not supposed ot be used in this way? My 
> thoughts inititally were that if it seems to support a request and can 
> do the validation why not? Basically stuck on using 
> HttpResponseRedirect in a context processor. I have managed to get 
> this working by passing a variable called redirect in the dictionary 
> returned to my template and then saying if the redirect tag is 
> available use the browsers meta tag to redirect me but i dont think 
> this is the way it should work. code below please advise thanks. 
>
> context_processors.py 
>
> from django.contrib.auth.forms import AuthenticationForm 
> from django.http import HttpResponseRedirect 
>
>
> def login_form(request): 
> if request.method == 'POST': 
> form = AuthenticationForm(data=request.POST) 
> if form.is_valid(): 
> #return HttpResponseRedirect('/home') ONLY THING THATS NOT 
> WORKING 
> return {'login_form': form, 'redirect': '/home'} 
> else: 
> form = AuthenticationForm(request) 
> return {'login_form': form} 
>
> template.html 
> {{ form.non_field_errors}} # works fine after post with errors showing 
> {{ form.username}} 
> {{ form.password}} 
> {% if redirect %} 
> 
>  {% endif %}


No, of course this is not what context processors are for. They are for, 
er, processing the context. The only thing they can do is add items to the 
template context before it is rendered. They have no control at all over 
the response - the template that is being rendered may not even be part of 
the response (think of an email being created from a template within a 
view, but the response is rendered from a separate 'confirmation' template).

Rather than putting the form in a context processor, I would use a template 
tag that only renders the original form. The form itself should post to a 
specific view, so that the POST is processed there instead of in the 
context processor.
--
DR.

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



Re: Django Model Errors : TypeError: 'class Meta' got invalid attribute(s): using

2012-02-01 Thread Daniel Roseman
On Tuesday, 31 January 2012 19:22:27 UTC, Subhodip Biswas wrote:
>
> Hi all,
> I am newbie in django and while trying to write a database router for
> using multiple database  I did something like :
>
> class Meta:
> using = 'somedatabasename'
>
> in Django models.py.
>
> However while doing a syncdb I get an error like this :
>
> TypeError: 'class Meta' got invalid attribute(s): using
>
> what am I missing here??
>
> any pointers or docs will be of great help.
>
> -
> Regards
> Subhodip Biswas
>
The error is quite clear: there's no 'using' attribute in Meta. Where did 
you get the impression that there was? It's certainly not mentioned in the 
comprehensive documentation on multiple databases here:
https://docs.djangoproject.com/en/1.3/topics/db/multi-db/

As that doc shows, the decision of what db to use for a model or query is 
made by the router, not by the model.
--
DR.

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



Error making fixtures

2012-02-01 Thread xina towner
Hello, I'm tryng to do fixtures with dumpdata. I write this command:

python manage.py dumpdata quests --indent=4 >
quests/fixtures/quests_views_testdata.json


But I get this error message:

_mysql_exceptions.OperationalError: (1054, "Unknown column
'quests_quest.availability' in 'field list'")


-- 
Thanks,

Rubén

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



Re: about QuerySet

2012-02-01 Thread Daniel Roseman
On Wednesday, 1 February 2012 08:34:14 UTC, akaariai wrote:
>
> On Feb 1, 9:36 am, newme  wrote: 
> > do you mean that queryset will query database every time i call 
> > user[0]? 
>
> Yes. That is exactly what happens: 
> In [7]: qs[0] 
> Out[7]:  
> In [9]: print connection.queries 
> [{'time': '0.011', 'sql': 'SELECT ... FROM "organisaatio_osa" LIMIT 
> 1'}] 
>
> In [10]: qs[0] 
> Out[10]:  
> In [11]: print connection.queries 
> [{'time': '0.011', 'sql': 'SELECT ... FROM "organisaatio_osa" LIMIT 
> 1'}, 
>  {'time': '0.001', 'sql': 'SELECT ... FROM "organisaatio_osa" LIMIT 
> 1'}] 
>
> If you do not want this to happen, you can evaluate your queryset into 
> a list first by: 
> objlist = list(qs[0:wanted_limit]) 
> and now objlist is just a regular Python list. 
>
> The lazy evaluation of querysets can be a little surprising sometimes. 
> Using django-debug-toolbar or just settings.DEBUG = True, and then 
> print connection.queries is recommended :) 
>
>  - Anssi


Slight clarification: the slicing will only trigger a db call if the 
queryset has not been evaluated. Converting it to a list is one way of 
doing that, but if you iterate the queryset in any way it will populate the 
internal cache and not call the database on subsequent slices.
--
DR.

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



Re: about QuerySet

2012-02-01 Thread akaariai
On Feb 1, 9:36 am, newme  wrote:
> do you mean that queryset will query database every time i call
> user[0]?

Yes. That is exactly what happens:
In [7]: qs[0]
Out[7]: 
In [9]: print connection.queries
[{'time': '0.011', 'sql': 'SELECT ... FROM "organisaatio_osa" LIMIT
1'}]

In [10]: qs[0]
Out[10]: 
In [11]: print connection.queries
[{'time': '0.011', 'sql': 'SELECT ... FROM "organisaatio_osa" LIMIT
1'},
 {'time': '0.001', 'sql': 'SELECT ... FROM "organisaatio_osa" LIMIT
1'}]

If you do not want this to happen, you can evaluate your queryset into
a list first by:
objlist = list(qs[0:wanted_limit])
and now objlist is just a regular Python list.

The lazy evaluation of querysets can be a little surprising sometimes.
Using django-debug-toolbar or just settings.DEBUG = True, and then
print connection.queries is recommended :)

 - Anssi

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



Re: Dynamic runtime modeling: which is the best choice?

2012-02-01 Thread Alessandro Candini
>         This sounds more like a need for shapefile translators (codecs, if
> you will)... On input you'd convert the contents into a common database
> format; reverse the process on output.

What is a "common database format"? If a shape file has 5 fields and
another one 10 (and I dont' know the fields name!) how can I
generalize this situation before getting those files?

>         IOWs, my view is that you should be storing the "shape" and not the
> "file".

What do yuo mean? LayerMapping is not the right 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Inherited manytomany field not showing up in django shell

2012-02-01 Thread Kabir Kukreti
I am working on blog application. I have made class "GenericBlog",
which I am inheriting to a class Blog.There is a manytomany field in
the GenericBlog class called "sites".

The problem in this that when I try to create an object of "Blog", in
the django shell, it gives an error "sites si an invalid keyword".

I would be very grateful, if you can help me with a possible solution
to this problem


Kabir

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