How to Structure Single App Projects

2013-10-28 Thread trojactory
Hi,

Whenever I am working on small projects, it seems like an overkill to 
create an app usually with the same name as the website (and the project's 
name with a small modification). For instance, if I am creating a project 
for a small intranet application called Foo. I usually end up with a 
structure like:

foosite/
├── foo
│   ├── __init__.py
│   ├── models.py
│   ├── templates/
│   ├── tests.py
│   └── views.py
├── foosite
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   └── wsgi.py
└── manage.py

This seems quite redundant to me. Also foo contains all the assorted things 
which cannot be reused anyway. Is there a simpler way to implement this? I 
mean something similar to the original (pre-1.2?) structure of having 
models, templates and views in the initial directory itself?

Otherwise can we explicitly create models, templates and views in foosite 
itself and turn it into an app? I like this approach for smaller sites and 
for functionality which cannot be abstracted into a separate app. Ideally I 
would've preferred something flat, since "Flat is better than nested".

Would like to know the community's views on this? Any pros and cons would 
be great too.

Thanks,
Arun

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24f6c34a-f387-4817-acad-907465c7af8e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (3rd party app) How to safely reverse a custom user model admin url?

2013-10-28 Thread Mike Dewhirst

On 29/10/2013 8:15am, Ivan VenOsdel wrote:

More simply, how do I put {{app_label}}_{{model_name}}_changelist in a
template for a custom auth_user model without knowing the details of
said model?

I am guessing I don't want to refer to settings.auth_user_model in the
template. It feels like the only way is to use the tag in that case and
instead somehow call the changelist function (wherever that is) in the
view. If so, anyone know how to do that?



You could either make a custom tag which behind the scenes can do (more 
or less) anything or write a method or class for your view which returns 
a dict or list or queryset.


I would decide which to use based on whether the result is mostly 
display oriented or mostly business logic oriented. Business logic goes 
in the view and display tweaks go in custom tags.


For a custom tag check 
https://docs.djangoproject.com/en/1.5/howto/custom-template-tags/


The view code would be something like ...

from django.template import RequestContext
from django.shortcuts import render_to_response
from wherever import special_logic# returns list or queryset

def display_whatever(request, arg):
rqcontext = RequestContext(request)
content = { whatever: special_logic(arg), }
return render_to_response('whatever.html', content, rqcontext)

hth

Mike

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/526F3A30.4090607%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Tutorials

2013-10-28 Thread Jasvir Singh
On Tue, Oct 29, 2013 at 2:05 AM, Mario R. Osorio  wrote:
>you should not feel low
> confidence for any reason. On the contrary: Had you not received any
> comments, THEN you should worry!
No, I am not feeling low. As I have already said that typography is on
top priority.
While wrting these articles, I didn't paid any attention towards
typography but It was the biggest mistake.
So, first I'll improve that, then I'll add more posts.
I'll definitely notify here when It is done so that you can review it.

Again thanks for your suggestion. :)

-- 

Jasvir Singh Grewal
Blog:http://jasvirsinghgrewal91.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN_O85sxhss-BmveXQnxX9OqKjiHviELbyeffz2YD6OaF-Ynkg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: What's the difference between assertIn and assertContains?

2013-10-28 Thread Simon Charette
assertContains performs additional assertion such as the status code of the
request and provides a way to perform comparison based on HTML semantic
instead of character-by-character equality. Under the hood it also handles
streaming and deferred response gracefully.

I suggest you take a look at the 
documentationfor
 a technical reference and
at the source 
codefor
 the implementation details.

Simon

Le lundi 28 octobre 2013 20:45:17 UTC-4, Pepsodent Cola a écrit :
>
> # List word
> def test_VIEW_Index_WORD_List_word(self):
> w = self.create_word()
> url = reverse('navi_polls:index')
> resp = self.client.get(url)
> self.assertEqual(resp.status_code, 200)
> *self.assertIn*(w.rosword, resp.content) # What's the difference 
> between
># assertIn 
> and assertContains?
> #self.assertContains(resp, "Test word")
> *self.assertContains*(resp, w.rosword)
>
>
> test_VIEW_Index_WORD_List_word (navi_polls.tests.WordTests) ... ok
>
>
>
> What's the difference between assertIn and assertContains?
> They seem to perform the same kind of test, the only difference I can see 
> is that the syntax differs.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/daa74f88-4822-42f4-9007-ae66bfea2040%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Digging up Django class-based views - 1

2013-10-28 Thread Pepsodent Cola
Thanks Leo!

I started out learning Django from the 1.5 tutorial which introduced CBVs 
but it made parts of the code inconsistent which further confused me as a 
newbie.
Having to keep track of all the new MVC concepts at the same time was 
confusing for me.





On Monday, October 28, 2013 9:01:47 AM UTC+1, Leo wrote:
>
> Hi all,
>
> I want to share with you a post about class-based views.
> Hope you find it useful.
>
>
> http://lgiordani.github.io/blog/2013/10/28/digging-up-django-class-based-views-1/
>
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub 
> page  - My Coderwall 
> profile
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a503b98f-4ce2-4cf4-bb78-35713f65a6d3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


What's the difference between assertIn and assertContains?

2013-10-28 Thread Pepsodent Cola
# List word
def test_VIEW_Index_WORD_List_word(self):
w = self.create_word()
url = reverse('navi_polls:index')
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
*self.assertIn*(w.rosword, resp.content) # What's the difference 
between
   # assertIn 
and assertContains?
#self.assertContains(resp, "Test word")
*self.assertContains*(resp, w.rosword)


test_VIEW_Index_WORD_List_word (navi_polls.tests.WordTests) ... ok



What's the difference between assertIn and assertContains?
They seem to perform the same kind of test, the only difference I can see 
is that the syntax differs.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b734ceb-31bd-4b9e-b33f-d8310bcac20c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (3rd party app) How to safely reverse a custom user model admin url?

2013-10-28 Thread Ivan VenOsdel
No takers? Maybe I am giving everyone a case of TL;DR.

More simply, how do I put {{ app_label }}_{{ model_name }}_changelist in a 
template for a custom auth_user model without knowing the details of said 
model? 

I am guessing I don't want to refer to settings.auth_user_model in the 
template. It feels like the only way is to use the tag in that case and 
instead somehow call the changelist function (wherever that is) in the 
view. If so, anyone know how to do that?

On Friday, October 25, 2013 7:39:59 PM UTC-5, Ivan VenOsdel wrote:
>
> My project uses a custom user model and I am trying to use a 3rd party app 
> that uses the Reversing Admin 
> URLstechnique
>  to enhance my administration interface.
>
> However problems arise when the app tries to make use of the url template 
> tag to do a reverse lookup on the auth user ModelAdmin instance. When 
> 'auth_user_(something)' is referenced directly the template will produce a 
> NoReverseMatch error. 
>
> I would like to produce a patch for the package maintainer but I am unsure 
> of how to reference the stand in user model without tying the app to my 
> project or doing something kludgy that goes against the spirit of the 
> django url tag.
>
> The specific app I have been working with is the django-blog-zinnia 
> application. Zinnia is using the following technique to provide changeset 
> details in a generic way through the Django admin. 
>
> The problem occurs when it tries to reverse auth_user_* when the site is 
> using a custom user model. For Zinnia it occurs in the following places.
>
>- 
>
> https://github.com/Fantomas42/django-blog-zinnia/blob/develop/zinnia/templates/admin/zinnia/widgets/_content_stats.html#L36
>- 
>
> https://github.com/Fantomas42/django-blog-zinnia/blob/develop/zinnia/templates/zinnia/entry_list.html#L84
>
> I have already 
> reportedthis
>  issue to the Zinnia maintainer however I would like to provide 
> something more meaningful in the way of a patch. Replacing the auth_user 
> part of the offending lines with 'myapp_customuser' will fix the issue for 
> me but how do I do something that is viable for a 3rd party application?
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/64ea3064-aa5f-41f6-b02e-58e2db49798f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Tutorials

2013-10-28 Thread Mario R. Osorio
I will say it again ... I DID read thru some of the articles, if at least
the first few lines. I did like the feeling I get from the blog. IMHO,
everyones' comment here has been for the best and you should not feel low
confidence for any reason. On the contrary: Had you not received any
comments, THEN you should worry!

As for the typography ... I have myself made many such mistakes as choosing
totally useless typography. Now that I'm 50, with diabetes and sight issues
I've come to REALLY appreciate what good ONE SIZE FITS ALL  typography is.

In a few words: Just keep your confidence up, I like what I read!


Dtb/Gby
===
Mario R. Osorio
"... Begin with the end in mind ..."
http://www.google.com/profiles/nimbiotics


On Mon, Oct 28, 2013 at 12:38 PM, Nigel Legg  wrote:

> Cool, I'll take another look at it then.
>
> Cheers, Nigel
> 07914 740972
>
>
>
> On 28 October 2013 16:35, Jasvir Singh  wrote:
>
>> On Mon, Oct 28, 2013 at 9:48 PM, Nigel Legg  wrote:
>> > I have looked at this a few times, and now I have realised what was
>> bugging
>>
>> 
>>
>> > So I think that it would be much more useful and accessible if it was a
>> > series of pages rather than a series of blog posts.
>>
>> Even I was thinking this too.
>> Soon I'll shift this content to my personal domain where there will be
>> complete section for these tutorials in a continues manner.
>>
>> --
>>
>> Jasvir Singh Grewal
>> Blog:http://jasvirsinghgrewal91.wordpress.com/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAN_O85vrgKmJ5RA0yoi2j6R%2BJTgZeyKFrtjMxGLBv82WS03aow%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/DhMrcyK_XLY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADeX7vwcA-OQtfYxwBO%3DnMiLUcGBtFp3vaaoJSBLtRnaUXdNPg%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO2PNV4p%3Dijy9m5iMC%3Dcew%2BW-8qHspaxQbSZZ%2Btb_CFCbAC4gg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Querying across Generic Relations

2013-10-28 Thread Lee Hinde
I have a table, Credit, that I want to query based on a value several hops
away. There's a CreditLineItems that has a Generic Foreign Key to one of
two tables, each of which has a Foreign Key to the table I want to search.
I've not as yet setup a reverse relation in the related tables.

My question is, given the structure below, how do I return a selection of
Credits based on a value in Registration?

class Credit(models.Model):
""" Model queried """


class CreditLineItem(models.Model):
credit = models.ForeignKey(Credit)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
 #assumed values...
# The GenericForeignKey could point to
class Enrollment(models.Model):
registration = models.ForeignKey(Registration, blank=True)

--OR--

class ProductSale(models.Model):
registration = models.ForeignKey(Registration, blank=True)

class Registration(models.Model):
registration_number =  models.IntegerField(db_index=True)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMz2s2qowuUgs%3DnBOcde6PGTZEEg1qMYJfos-dDE3VOUHA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django ManyToMany performance?

2013-10-28 Thread Ruturaj Dhekane
Thanks Daniel and Robin.

Have we seen the scales where Many-to-many DBs through Django work well?
Like 50K articles in 5K publications.
The aim of this question was to make a design choice too - whether I should
use Django constructs/calls directly or should i write my own SQL to make
queries - as my schemas are not just many-to-many but a lot more than that.

Thanks for the suggestion on getting the DB schemas reviewed by a DB
expert. I realized that is going to help me a lot for sure!


On Mon, Oct 28, 2013 at 1:40 AM, Robin St.Clair  wrote:

> First of all , any DBMS that is misused by design or in operation will
> give poor performance.. There is an excellent mature database available for
> Django developers, PostgreSQL. It works fine on the same machine as you are
> developing on.
>
> MongoDB is NOT a suitable DB for general purposes. It is fine for
> documents, less good for being updated, particularly as it locks tables
> when updating or inserting.
>
> Make sure your generated database is checked by somebody who knows about
> databases.
>
> R+C
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6007019b-b007-4d46-adab-4dcbf16b0e7d%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEGxL4nfAUJJ210T7XCL%2BHOOSijr0wY9Ya3p%2BGNLBaU%3DfDDSDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django difference between - one to one, many to one and many to many

2013-10-28 Thread C. Kirby
Those concepts are actually RDBMS (Database) ideas. You would probably be 
better off reading up on those. This looks to be a pretty good explanation:
http://net.tutsplus.com/tutorials/databases/sql-for-beginners-part-3-database-relationships/


On Monday, October 28, 2013 2:06:20 PM UTC-5, Aamu Padi wrote:
>
> So, this is my first time learning computer language. And I chose python 
> and django. Now, I got many of the basic concepts of python and also 
> django. I can create new page with the views and all other stuff. But I am 
> still confused with the relations, i.e. one to one, many to one, and many 
> to many. Will someone please please please explain it to me. How can I use 
> it? I really need to know.
>
> *N.B:* I have looked at this 
> linkfor
>  that, but 
> I still have some doubts about one-to-one and many-to-many. Suppose I 
> want to extend with some more user information in a different class. Can I 
> use ForeignKey instead of One-to-One field? And will anyone please be 
> kind enough to explain to me about many-to-many relationship, (I didn't 
> quit understood all those toppings and membership thing). 
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27324afb-d542-4d99-a0d7-6bfb60440436%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Psycopg2 on Mac OS X (Snow Leopard)

2013-10-28 Thread Skip Montanaro
> I just had this exact same problem and it took me a while to find the
> solution.
>
> On OSx there is a separate library path variable for .dylib library files. I
> added the following to my .bashrc (or.bash_env or however you set up your
> shell environment).
>
> export
> DYLD_LIBRARY_PATH="/usr/local/Cellar/openssl/1.0.1e/lib/:$DYLD_LIBRARY_PATH"

Thanks for the suggestion. Found libssl in the PostgreSQL installation:

% find / -name libssl.1.0.0.dylib 2>/dev/null
/Library/PostgreSQL/9.2/lib/libssl.1.0.0.dylib
/Library/PostgreSQL/9.2/pgAdmin3.app/Contents/Frameworks/libssl.1.0.0.dylib

I guess that makes sense. I should be able to modify the activate
script and deactivate function to set/reset DYLD_LIBRARY_PATH
appropriately.

Skip

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANc-5Uwsjcw7B3sX2XkXCH%2BqCM1QX8x2BZT55U9RApK08PTgAg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Psycopg2 on Mac OS X (Snow Leopard)

2013-10-28 Thread Adam Portier
Good afternoon,

I just had this exact same problem and it took me a while to find the 
solution.

On OSx there is a separate library path variable for .dylib library files. 
I added the following to my .bashrc (or.bash_env or however you set up your 
shell environment).

export 
DYLD_LIBRARY_PATH="/usr/local/Cellar/openssl/1.0.1e/lib/:$DYLD_LIBRARY_PATH"

The folder "/usr/local/Cellar/openssl/1.0.1e/lib/" contains 
the libssl.1.0.0.dylib file that Python is trying to load. You will need to 
find where your copy is installed (find / -name libssl.1.0.0.dylib) and 
adjust your environment variable setting accordingly. After that I was able 
to run my Django server with no problems.

On Sunday, October 27, 2013 10:20:40 AM UTC-4, Skip Montanaro wrote:
>
> I'm working my way through my first non-tutorial Django project. I 
> plan to deploy it (at least initially) on Heroku. I'm at the point 
> where I have my basic structure laid out and am proceeding to model 
> definition. Heroku's default database is PostgreSQL, which I'm 
> comfortable with, and seems to be installed properly there. The 
> locally built psycopg2 module (2.5.1) is missing libssl, however: 
>
> (venv)topten% python manage.py shell 
> ImportError: 
> dlopen(/Users/skip/heroku/topten/venv/lib/python2.7/site-packages/psycopg2/_psycopg.so,
>  
>
> 2): Library not loaded: libssl.1.0.0.dylib 
>   Referenced from: 
> /Users/skip/heroku/topten/venv/lib/python2.7/site-packages/psycopg2/_psycopg.so
>  
>
>   Reason: image not found 
>
> Looking on my Mac running Snow Leopard (10.6.8), I only see 0.9.x 
> versions of libssl in /usr/lib. I have no libssl in my MacPorts 
> directory (/opt/local/lib). 
>
> Where did whatever built psycopg2 (pip?) get the idea that I had 
> libssl 1.0? More importantly, how can I get past this bump in the 
> road? 
>
> Thanks, 
>
> Skip Montanaro 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad18ed90-ae0c-4e80-b942-0410ffc0c144%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django difference between - one to one, many to one and many to many

2013-10-28 Thread Aamu Padi
 

So, this is my first time learning computer language. And I chose python 
and django. Now, I got many of the basic concepts of python and also 
django. I can create new page with the views and all other stuff. But I am 
still confused with the relations, i.e. one to one, many to one, and many 
to many. Will someone please please please explain it to me. How can I use 
it? I really need to know.

*N.B:* I have looked at this 
linkfor 
that, but 
I still have some doubts about one-to-one and many-to-many. Suppose I want 
to extend with some more user information in a different class. Can I use 
ForeignKey instead of One-to-One field? And will anyone please be kind 
enough to explain to me about many-to-many relationship, (I didn't quit 
understood all those toppings and membership thing). 

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/baa3-232d-4614-ac1e-4ba04adc9c16%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django.utils.copycompat is deprecated

2013-10-28 Thread tino
Hello,

I am getting the following in apache error log.


[error] 
/home/findme/virtualenv/lib/python2.7/site-packages/django/utils/copycompat.py:10:
 
DeprecationWarning: django.utils.copycompat is deprecated; use the native 
copy module instead


Is this something to worry about?

Regards
Tino

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b3f4d7bd-bab8-4a50-afcc-912e985fa449%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImportError: No module named django.core.wsgi even if sys.path contains my virtualenv

2013-10-28 Thread Timothy W. Cook
Al I know is that I can run Django from a virtualenv using the development
server.  I have to disable SELinux to get Apache to run my Django app via
WSGI.

I am sure there are settings that you can make (have made) to SELinux to
allow access but I have not studied it to find out what they are.




On Mon, Oct 28, 2013 at 1:47 PM, G. Allegri  wrote:

> Hi Timothy,
> I'm on a managed server, so I cannot do system changes that would require
> reboot.
> Anyway, setenforce says that SELinux is disabled (even setenforce 1).
>
> Do you think it is SELinux to block Python module loading?
> If I activate my virtualenv from shell I can load Django.
>
> giovanni
>
>
>
> 2013/10/28 Timothy W. Cook 
>
>>
>>
>>
>> CentOS is a bit of a PITA. Because it is so secure.  Try turning off
>> SELinux
>>
>>
>> http://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html
>>
>> To test this out from the commandline:
>>
>> $setenforce 0
>>
>>
>> How to actually make it work WITH SELinux? I haven't figured that out yet.
>>
>> HTH,
>> Tim
>>
>>
>>
>> On Mon, Oct 28, 2013 at 1:06 PM, Giovanni Allegri wrote:
>>
>>> I'm getting mad with this error.
>>> I've setup Apache and wsgi configuration as usual, but this time I'm on
>>> CentOS instead of Debian, and I don't know it very well.
>>> Anyway, I tried all the ways to give mod_wsgi the chance to peak from my
>>> virtualenv libraries, both setting them with python-path argument to
>>> WSGIScriptAlias, and using site.addsitedir in my wsgi module.
>>> Printing sys.path gives me all the possible folders:
>>>
>>> ['/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn',
>>> '/home/giohappy/.virtualenvs/django/lib64/python2.6',
>>> '/home/giohappy/.virtualenvs/django/lib64/python2.6/site-packages',
>>> '/usr/lib/python2.6/site-packages/distribute-0.6.49-py2.6.egg',
>>> '/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg',
>>> '/usr/lib64/python26.zip', '/usr/lib64/python2.6',
>>> '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk',
>>> '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload',
>>> '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages',
>>> '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
>>> '/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn',
>>> '/home/giohappy/.virtualenvs/django/lib/python2.6/site-packages']
>>>
>>> but still I get  ImportError: No module named django.core.wsgi
>>>
>>> Could you help to sort it out?
>>> giovanni
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/00266e62-34b1-49d8-a981-761c374568a9%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> MLHIM VIP Signup: http://goo.gl/22B0U
>> 
>> Timothy Cook, MSc   +55 21 94711995
>> MLHIM http://www.mlhim.org
>> Like Us on FB: https://www.facebook.com/mlhim2
>> Circle us on G+: http://goo.gl/44EV5
>> Google Scholar: http://goo.gl/MMZ1o
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/lhTc7rZgoIs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WBswduqcraq0W52nZ2JFwWAdzJ5rRQpPTwJ%2BCpYucxgg%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Giovanni Allegri
> http://about.me/giovanniallegri
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAB4g1%3DwHN_bHZg_s9PXKPrG%3DbcN-qmea9TTfLu-nP1xY%3Dq_89Q%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_ou

Re: Django Tutorials

2013-10-28 Thread Nigel Legg
Cool, I'll take another look at it then.

Cheers, Nigel
07914 740972



On 28 October 2013 16:35, Jasvir Singh  wrote:

> On Mon, Oct 28, 2013 at 9:48 PM, Nigel Legg  wrote:
> > I have looked at this a few times, and now I have realised what was
> bugging
>
> 
>
> > So I think that it would be much more useful and accessible if it was a
> > series of pages rather than a series of blog posts.
>
> Even I was thinking this too.
> Soon I'll shift this content to my personal domain where there will be
> complete section for these tutorials in a continues manner.
>
> --
>
> Jasvir Singh Grewal
> Blog:http://jasvirsinghgrewal91.wordpress.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN_O85vrgKmJ5RA0yoi2j6R%2BJTgZeyKFrtjMxGLBv82WS03aow%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADeX7vwcA-OQtfYxwBO%3DnMiLUcGBtFp3vaaoJSBLtRnaUXdNPg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: city selector for django

2013-10-28 Thread Nigel Legg
OK.  The readme makes it sound like it should work. maybe you should
contact the django-cities-light team?

Cheers, Nigel
07914 740972



On 28 October 2013 16:35, rush  wrote:

> Hi,
>
> nope. unfortunately test_project has only URLs.Py . anything else is
> missing or broken. like templates directory is a link to itself.
>
> 28.10.13, 20:32, "Nigel Legg" ":
> >
> > Following the link you posted I found a test project, is that not a
> usage example?
> >
> > Cheers, Nigel
> > 07914 740972
> >
> >
> >
> > On 28 October 2013 16:01, rush  wrote:
> > Hi,
> > >It's pretty hard to find lightweight and easy city selector app with
> ready to use database.
> > >After a while, I've found a django-cities-light (
> https://github.com/yourlabs/django-cities-light ), but there is no usage
> examples at all. Maybe someone could prompt me where I can find one?
> > >ps. I also tried django-cities and django-simple-cities , but the first
> one is pretty complicated and the second one has a lot of errors even
> during a database installation. And geodjango is overkill for my needs. --
> > >wbr,rush.
> > >--
> > >You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > >To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> > >To post to this group, send email to django-users@googlegroups.com.
> > >Visit this group at http://groups.google.com/group/django-users.
> > >To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/151871382976084%40web6g.yandex.ru
> .
> > >For more options, visit https://groups.google.com/groups/opt_out.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADeX7vx8w-QBNOvqYrG7BGb-FBavchxpSnEHJQMLEOfmruP6BA%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6091382978144%40web13h.yandex.ru
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADeX7vwmOhKs_-1ndWWzwndbh%2BtUAaOCRwBuRsS%2B-RTELCyuJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: city selector for django

2013-10-28 Thread rush
Hi,

nope. unfortunately test_project has only URLs.Py . anything else is missing or 
broken. like templates directory is a link to itself.

28.10.13, 20:32, "Nigel Legg" ":
> 
> Following the link you posted I found a test project, is that not a usage 
> example?
> 
> Cheers, Nigel 
> 07914 740972
> 
> 
> 
> On 28 October 2013 16:01, rush  wrote:
> Hi,
> >It's pretty hard to find lightweight and easy city selector app with ready 
> >to use database.
> >After a while, I've found a django-cities-light ( 
> >https://github.com/yourlabs/django-cities-light ), but there is no usage 
> >examples at all. Maybe someone could prompt me where I can find one?
> >ps. I also tried django-cities and django-simple-cities , but the first one 
> >is pretty complicated and the second one has a lot of errors even during a 
> >database installation. And geodjango is overkill for my needs. -- 
> >wbr,rush.
> >-- 
> >You received this message because you are subscribed to the Google Groups 
> >"Django users" group.
> >To unsubscribe from this group and stop receiving emails from it, send an 
> >email to django-users+unsubscr...@googlegroups.com.
> >To post to this group, send email to django-users@googlegroups.com.
> >Visit this group at http://groups.google.com/group/django-users.
> >To view this discussion on the web visit 
> >https://groups.google.com/d/msgid/django-users/151871382976084%40web6g.yandex.ru.
> >For more options, visit https://groups.google.com/groups/opt_out.
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CADeX7vx8w-QBNOvqYrG7BGb-FBavchxpSnEHJQMLEOfmruP6BA%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

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


Re: Django Tutorials

2013-10-28 Thread Jasvir Singh
On Mon, Oct 28, 2013 at 9:48 PM, Nigel Legg  wrote:
> I have looked at this a few times, and now I have realised what was bugging



> So I think that it would be much more useful and accessible if it was a
> series of pages rather than a series of blog posts.

Even I was thinking this too.
Soon I'll shift this content to my personal domain where there will be
complete section for these tutorials in a continues manner.

-- 

Jasvir Singh Grewal
Blog:http://jasvirsinghgrewal91.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN_O85vrgKmJ5RA0yoi2j6R%2BJTgZeyKFrtjMxGLBv82WS03aow%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: city selector for django

2013-10-28 Thread Nigel Legg
Following the link you posted I found a test project, is that not a usage
example?

Cheers, Nigel
07914 740972



On 28 October 2013 16:01, rush  wrote:

> Hi,
>
> It's pretty hard to find lightweight and easy city selector app with ready
> to use database.
>
> After a while, I've found a django-cities-light (
> https://github.com/yourlabs/django-cities-light ), but there is no usage
> examples at all. Maybe someone could prompt me where I can find one?
>
> ps. I also tried django-cities and django-simple-cities , but the first
> one is pretty complicated and the second one has a lot of errors even
> during a database installation. And geodjango is overkill for my needs.
>
> --
> wbr,
> rush.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/151871382976084%40web6g.yandex.ru
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADeX7vx8w-QBNOvqYrG7BGb-FBavchxpSnEHJQMLEOfmruP6BA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Tutorials

2013-10-28 Thread Nigel Legg
I have looked at this a few times, and now I have realised what was bugging
me.
Because this tutorial is a series of blog posts, when you access it, you
get to the most recently posted article, which may not be the article you
are looking for and will not be the start of the tutorial.
I think the blog is useful for posting tips and tricks, or articles on best
practice, but not necessarily for a tutorial, which should be read and
worked through as a structured series from beginning to end.
So I think that it would be much more useful and accessible if it was a
series of pages rather than a series of blog posts.

Cheers, Nigel
07914 740972



On 28 October 2013 16:10, Jasvir Singh  wrote:

> On Sat, Oct 26, 2013 at 9:12 PM, Pepsodent Cola 
> wrote:
> > Maybe make the text typography easier to see and read?
>
> Thanks for your suggestion. This is one the best suggestions that I
> have got about my blog.
> Now I am working on it.
> I'll let you know when it's done. Then you can again review it. :)
>
> --
>
> Jasvir Singh Grewal
> Blog:http://jasvirsinghgrewal91.wordpress.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN_O85ttvyyzG-xa6CXfC3S4RNYpMCuxu5_wFroXf86gRn9f_g%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADeX7vwHTdFc3KjBgvRzgXnSxiBkOSiRDqN-%2B2HUYzs8nx0OPw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Tutorials

2013-10-28 Thread Jasvir Singh
On Sat, Oct 26, 2013 at 9:12 PM, Pepsodent Cola  wrote:
> Maybe make the text typography easier to see and read?

Thanks for your suggestion. This is one the best suggestions that I
have got about my blog.
Now I am working on it.
I'll let you know when it's done. Then you can again review it. :)

-- 

Jasvir Singh Grewal
Blog:http://jasvirsinghgrewal91.wordpress.com/

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


Re: Backwards relation not showing up via related_name in inherited models

2013-10-28 Thread Daniel Roseman
On Monday, 28 October 2013 15:11:24 UTC, Joshua Orvis wrote:

> Thank you for responding, that's extremely helpful.  I'm still failing to 
> query against it though.  How would I implement a query for the 
> get_children() method in the example above?  That is, for any given 
> instance of FlowBlueprint how do I get all objects with a relation to it?
>

The point is that unless the M2M field has `symmetrical=False`, there's 
only one side of the relation, which is `parents`. So in this case you 
would just do `self.parents.all()`. That said, for a parent/child 
relationship like this you probably do want to set symmetrical to False, in 
which case `self.children.all()` would work.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e90e7e9e-8426-4e20-95df-807edabc18f9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Tutorials

2013-10-28 Thread Jasvir Singh
On Mon, Oct 28, 2013 at 11:01 AM, Diogene Laerce  wrote:
> I find it nice. A table of contents with links to each articles would be
> great. ;)

Thanks Diogene.
Keep reviewing it. You comments will boost up my confidence. :)

-- 

Jasvir Singh Grewal
Blog:http://jasvirsinghgrewal91.wordpress.com/

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


Re: Django Tutorials

2013-10-28 Thread Jasvir Singh
On Mon, Oct 28, 2013 at 12:20 AM, Mario Osorio  wrote:
> From a noob:

> You seem to have some good articles, but you should at the very least revise
> your typography.

Thanks Marlo.
Typography is on top priority now. I'll add new post after revising typography.

-- 

Jasvir Singh Grewal
Blog:http://jasvirsinghgrewal91.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN_O85v0v4%3DV%2B33DcThrZdAbbR7g-W2rwGyeWRZ%3Dff9eL%3DYPJg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImportError: No module named django.core.wsgi even if sys.path contains my virtualenv

2013-10-28 Thread G. Allegri
Hi Timothy,
I'm on a managed server, so I cannot do system changes that would require
reboot.
Anyway, setenforce says that SELinux is disabled (even setenforce 1).

Do you think it is SELinux to block Python module loading?
If I activate my virtualenv from shell I can load Django.

giovanni



2013/10/28 Timothy W. Cook 

>
>
>
> CentOS is a bit of a PITA. Because it is so secure.  Try turning off
> SELinux
>
>
> http://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html
>
> To test this out from the commandline:
>
> $setenforce 0
>
>
> How to actually make it work WITH SELinux? I haven't figured that out yet.
>
> HTH,
> Tim
>
>
>
> On Mon, Oct 28, 2013 at 1:06 PM, Giovanni Allegri wrote:
>
>> I'm getting mad with this error.
>> I've setup Apache and wsgi configuration as usual, but this time I'm on
>> CentOS instead of Debian, and I don't know it very well.
>> Anyway, I tried all the ways to give mod_wsgi the chance to peak from my
>> virtualenv libraries, both setting them with python-path argument to
>> WSGIScriptAlias, and using site.addsitedir in my wsgi module.
>> Printing sys.path gives me all the possible folders:
>>
>> ['/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn',
>> '/home/giohappy/.virtualenvs/django/lib64/python2.6',
>> '/home/giohappy/.virtualenvs/django/lib64/python2.6/site-packages',
>> '/usr/lib/python2.6/site-packages/distribute-0.6.49-py2.6.egg',
>> '/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg',
>> '/usr/lib64/python26.zip', '/usr/lib64/python2.6',
>> '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk',
>> '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload',
>> '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages',
>> '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
>> '/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn',
>> '/home/giohappy/.virtualenvs/django/lib/python2.6/site-packages']
>>
>> but still I get  ImportError: No module named django.core.wsgi
>>
>> Could you help to sort it out?
>> giovanni
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/00266e62-34b1-49d8-a981-761c374568a9%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/lhTc7rZgoIs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WBswduqcraq0W52nZ2JFwWAdzJ5rRQpPTwJ%2BCpYucxgg%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB4g1%3DwHN_bHZg_s9PXKPrG%3DbcN-qmea9TTfLu-nP1xY%3Dq_89Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImportError: No module named django.core.wsgi even if sys.path contains my virtualenv

2013-10-28 Thread Timothy W. Cook
CentOS is a bit of a PITA. Because it is so secure.  Try turning off SELinux

http://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html

To test this out from the commandline:

$setenforce 0


How to actually make it work WITH SELinux? I haven't figured that out yet.

HTH,
Tim



On Mon, Oct 28, 2013 at 1:06 PM, Giovanni Allegri wrote:

> I'm getting mad with this error.
> I've setup Apache and wsgi configuration as usual, but this time I'm on
> CentOS instead of Debian, and I don't know it very well.
> Anyway, I tried all the ways to give mod_wsgi the chance to peak from my
> virtualenv libraries, both setting them with python-path argument to
> WSGIScriptAlias, and using site.addsitedir in my wsgi module.
> Printing sys.path gives me all the possible folders:
>
> ['/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn',
> '/home/giohappy/.virtualenvs/django/lib64/python2.6',
> '/home/giohappy/.virtualenvs/django/lib64/python2.6/site-packages',
> '/usr/lib/python2.6/site-packages/distribute-0.6.49-py2.6.egg',
> '/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg',
> '/usr/lib64/python26.zip', '/usr/lib64/python2.6',
> '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk',
> '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload',
> '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages',
> '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
> '/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn',
> '/home/giohappy/.virtualenvs/django/lib/python2.6/site-packages']
>
> but still I get  ImportError: No module named django.core.wsgi
>
> Could you help to sort it out?
> giovanni
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/00266e62-34b1-49d8-a981-761c374568a9%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WBswduqcraq0W52nZ2JFwWAdzJ5rRQpPTwJ%2BCpYucxgg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Backwards relation not showing up via related_name in inherited models

2013-10-28 Thread Joshua Orvis
Thank you for responding, that's extremely helpful.  I'm still failing to 
query against it though.  How would I implement a query for the 
get_children() method in the example above?  That is, for any given 
instance of FlowBlueprint how do I get all objects with a relation to it?

On Monday, October 28, 2013 6:56:40 AM UTC-5, Daniel Roseman wrote:
>
> On Monday, 28 October 2013 07:29:39 UTC, Joshua Orvis wrote:
>
>> I'm using Django 1.6 RC1 and Python 3.3 with the following models:
>>
>> class StepBlueprint(models.Model):
>> parents = models.ManyToManyField('self', blank=True, null=True, 
>> related_name='children')
>> name   = models.CharField( max_length=100 )
>>
>> def __str__(self):
>> return self.name
>>
>> class FlowBlueprint(StepBlueprint):
>> description = models.TextField()
>> 
>> def get_children(self):
>> print("DEBUG: processing ({0})".format(self))
>> print(dir(self))
>>
>> # why isn't this working??  this is what related_name is supposed 
>> to provide
>> return self.children
>>
>> When I call get_children() here, I get the following:
>>
>> DEBUG: processing (Prodigal)
>> ['DoesNotExist', 'MultipleObjectsReturned', 'TYPES', '__class__', 
>> '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', 
>> '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', 
>> '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', 
>> '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 
>> '__weakref__', '_base_manager', '_default_manager', '_deferred', 
>> '_do_insert', '_do_update', '_get_FIELD_display', 
>> '_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', 
>> '_get_pk_val', '_get_unique_checks', '_meta', '_perform_date_checks', 
>> '_perform_unique_checks', '_save_parents', '_save_table', '_set_pk_val', 
>> '_state', 'build', 'clean', 'clean_fields', 'commandblueprint', 
>> 'conditional_code', 'date_error_message', 'delete', 'description', 
>> 'flow_set', 'flowblueprint', 'full_clean', 'get_children', 'get_command', 
>> 'get_type_display', 'id', 'name', 'objects', 'parents', 'pk', 
>> 'prepare_database_save', 'save', 'save_base', 'serializable_value', 
>> 'standalonetool_set', 'stepblueprint_ptr', 'stepblueprint_ptr_id', 'type', 
>> 'unique_error_message', 'validate_unique']
>> Traceback (most recent call last):
>>   [ call stack ... ]
>> return self.children
>> AttributeError: 'FlowBlueprint' object has no attribute 'children'
>>
>> What am I doing wrong here?  From within the FlowBlueprint object I want 
>> to be able to get the backwards relation of all those objects pointing to 
>> it, and it seems like related_name is supposed to provide that.  Its value 
>> doesn't show up in the dir() output.
>>
>> Any help would be greatly appreciated.
>>
>
>
> This has nothing to do with inheritance - you would get the same result if 
> you called `self.children` from StepBlueprint.
>
> See the documentation on many-to-many relationships with self:
>
> https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.ManyToManyField.symmetrical
> (emphasis added):
>
> "When Django processes this model, it identifies that it has a 
> ManyToManyField on itself, and as a result, it **doesn’t add a person_set 
> attribute to the Person class**. Instead, the ManyToManyField is assumed to 
> be symmetrical – that is, if I am your friend, then you are my friend.
> If you do not want symmetry in many-to-many relationships with self, set 
> symmetrical to False. This will force Django to add the descriptor for the 
> reverse relationship, allowing ManyToManyField relationships to be 
> non-symmetrical."
> --
> DR.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/66e5ec75-040b-4c36-85da-85af7365e9f2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ImportError: No module named django.core.wsgi even if sys.path contains my virtualenv

2013-10-28 Thread Giovanni Allegri
I'm getting mad with this error.
I've setup Apache and wsgi configuration as usual, but this time I'm on 
CentOS instead of Debian, and I don't know it very well.
Anyway, I tried all the ways to give mod_wsgi the chance to peak from my 
virtualenv libraries, both setting them with python-path argument to 
WSGIScriptAlias, and using site.addsitedir in my wsgi module.
Printing sys.path gives me all the possible folders:

['/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn', 
'/home/giohappy/.virtualenvs/django/lib64/python2.6', 
'/home/giohappy/.virtualenvs/django/lib64/python2.6/site-packages', 
'/usr/lib/python2.6/site-packages/distribute-0.6.49-py2.6.egg', 
'/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg', 
'/usr/lib64/python26.zip', '/usr/lib64/python2.6', 
'/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', 
'/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', 
'/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages', 
'/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', 
'/var/www/vhosts/vzqn-znxs.accessdomain.com/httpdocs/imn', 
'/home/giohappy/.virtualenvs/django/lib/python2.6/site-packages']

but still I get  ImportError: No module named django.core.wsgi

Could you help to sort it out? 
giovanni

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00266e62-34b1-49d8-a981-761c374568a9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


'module' object has no attribute 'urlpatterns'

2013-10-28 Thread abhijeet shete
Hi Folks,

I have developed one app say "XYZ" and I am using it in my django
project as symblik link.
I am trying to access urlpatterns in urls.py module from django project in
my "XYZ" app as

*from django.conf import settings*
*  from importlib import import_module
*
**
*  root_urls = import_module(settings.ROOT_URLCONF)*
*
*
*  url_patterns = root_urls.urlpatterns*
*
*
*
*
But I am getting this error

*'module' object has no attribute 'urlpatterns'*


. My qustion is how can I access urlpatterns from django project in my
"XYZ" app. I can't directly import urls module from django project in my
app because it is independent or I don't have direct access to urls module.


Any help will be highly appreciated. Thanks in advance.

Thanks and Regards.
Abhijeet Shete

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


Re: Psycopg2 on Mac OS X (Snow Leopard)

2013-10-28 Thread Tom Lockhart

On 2013-10-27, at 7:46 AM, Doug Snyder  wrote:

> I don't have a very specific answer for your question. I just started doing 
> my django dev on OSX coming from Ubuntu
> My understanding is that Home Brew is a better solution than Mac Ports, I 
> have heard some people being very critical of Mac Ports which I think was 
> once the best solution for python environments on OSX but I think has been 
> mostly replaced by Home Brew. Switching over may solve your problem 
> automatically and may make life easier down the road too. But maybe someone 
> else will have a more knowledgable, specific answer to your specific problem.

I can't address any benefits of switching. But I have been using MacPorts for 
some time and have had no problems.

Not sure who "some people" are wrt MacPorts but I haven't noticed complaints or 
problems (or in fact, any discussion of MacPorts vs Homebrew) in the context of 
Django or Postgres on the mailing list. I'm pretty sure both do this job just 
fine.

hth

 - Tom


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6EE04A48-58D9-41EF-B312-C83B0B0E5BB7%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: formating

2013-10-28 Thread fabricio mata de castro Mata
the problem is that Form.valor_ultimacompra | tag this bringing all the
input

if you Form.valor_ultimacompra.value works but then I lose the input

would make automatic?




{{Form.valor_ultimacompra | floatformat: 2}}


2013/10/28 Leonardo Giordani 

> What is foundation?
> You said that
>
> {{form.valor_ultimacompra}}
>
> works. What about
>
> {{form.valor_ultimacompra|foundation}}
>
> ?
>
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/28 fabricio 
>
>>
>> no meu modelo
>> valor_ultimacompra = models.DecimalField(u'Vlr.Ult.Compra',
>> max_digits=18, decimal_places=2, default=0, blank=True, null=True)
>>
>>
>> no template
>> {% extends "base.html" %}
>> {% load humanize %}
>> {% load foundation %}
>>
>>
>> 
>> {{form.valor_ultimacompra|foundation| floatformat:2 }}
>> 
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/9168889e-0227-4387-8dc1-fe434fecd1a1%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEhE%2BOn7V4K2enL2TiGX7%2ByNv4__JzTPfQ2uCEzn1W%2BfSpaWqw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOcDUW%2B77V%3D%3D7Emc7dwfJ1VdWR3p38cuwPDhS_M2SbiRfTu4LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: formating

2013-10-28 Thread Leonardo Giordani
What is foundation?
You said that

{{form.valor_ultimacompra}}

works. What about

{{form.valor_ultimacompra|foundation}}

?


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/28 fabricio 

>
> no meu modelo
> valor_ultimacompra = models.DecimalField(u'Vlr.Ult.Compra', max_digits=18,
> decimal_places=2, default=0, blank=True, null=True)
>
>
> no template
> {% extends "base.html" %}
> {% load humanize %}
> {% load foundation %}
>
>
> 
> {{form.valor_ultimacompra|foundation| floatformat:2 }}
> 
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9168889e-0227-4387-8dc1-fe434fecd1a1%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOn7V4K2enL2TiGX7%2ByNv4__JzTPfQ2uCEzn1W%2BfSpaWqw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: formating

2013-10-28 Thread fabricio

no meu modelo 
valor_ultimacompra = models.DecimalField(u'Vlr.Ult.Compra', max_digits=18, 
decimal_places=2, default=0, blank=True, null=True)


no template
{% extends "base.html" %}
{% load humanize %}
{% load foundation %}



{{form.valor_ultimacompra|foundation| floatformat:2 }}




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9168889e-0227-4387-8dc1-fe434fecd1a1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Digging up Django class-based views - 1

2013-10-28 Thread Timothy W. Cook
Very timely for me.  Well written post for those of us just getting started
with Django.

Thanks, looking forward to the next installment.

--Tim



On Mon, Oct 28, 2013 at 6:01 AM, Leonardo Giordani <
giordani.leona...@gmail.com> wrote:

> Hi all,
>
> I want to share with you a post about class-based views.
> Hope you find it useful.
>
>
> http://lgiordani.github.io/blog/2013/10/28/digging-up-django-class-based-views-1/
>
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEhE%2BOmuYpOYsEbHKfafJr_7XzTAhYBO794AfV0M%2BJ1jELBpmA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3U5JR_dS%2BEOayNmKdHOpmKBszYFrjqgTS7zt%3De%2BFfxFXw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: formating

2013-10-28 Thread Leonardo Giordani
Can you please paste the code with a good formatting? To pastebin or
similar?
I'd like to see model, view and template.


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/28 fabricio 

>
> does not work
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6af0e106-ce9a-47c9-87d6-6a35e8e486fa%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOnL4bg4%3D%2BqUvckWTKoGzqXQg1TLjJRr%2BGBMEq%3Drhu%3DHBg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Backwards relation not showing up via related_name in inherited models

2013-10-28 Thread Daniel Roseman
On Monday, 28 October 2013 07:29:39 UTC, Joshua Orvis wrote:

> I'm using Django 1.6 RC1 and Python 3.3 with the following models:
>
> class StepBlueprint(models.Model):
> parents = models.ManyToManyField('self', blank=True, null=True, 
> related_name='children')
> name   = models.CharField( max_length=100 )
>
> def __str__(self):
> return self.name
>
> class FlowBlueprint(StepBlueprint):
> description = models.TextField()
> 
> def get_children(self):
> print("DEBUG: processing ({0})".format(self))
> print(dir(self))
>
> # why isn't this working??  this is what related_name is supposed 
> to provide
> return self.children
>
> When I call get_children() here, I get the following:
>
> DEBUG: processing (Prodigal)
> ['DoesNotExist', 'MultipleObjectsReturned', 'TYPES', '__class__', 
> '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', 
> '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', 
> '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', 
> '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 
> '__weakref__', '_base_manager', '_default_manager', '_deferred', 
> '_do_insert', '_do_update', '_get_FIELD_display', 
> '_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', 
> '_get_pk_val', '_get_unique_checks', '_meta', '_perform_date_checks', 
> '_perform_unique_checks', '_save_parents', '_save_table', '_set_pk_val', 
> '_state', 'build', 'clean', 'clean_fields', 'commandblueprint', 
> 'conditional_code', 'date_error_message', 'delete', 'description', 
> 'flow_set', 'flowblueprint', 'full_clean', 'get_children', 'get_command', 
> 'get_type_display', 'id', 'name', 'objects', 'parents', 'pk', 
> 'prepare_database_save', 'save', 'save_base', 'serializable_value', 
> 'standalonetool_set', 'stepblueprint_ptr', 'stepblueprint_ptr_id', 'type', 
> 'unique_error_message', 'validate_unique']
> Traceback (most recent call last):
>   [ call stack ... ]
> return self.children
> AttributeError: 'FlowBlueprint' object has no attribute 'children'
>
> What am I doing wrong here?  From within the FlowBlueprint object I want 
> to be able to get the backwards relation of all those objects pointing to 
> it, and it seems like related_name is supposed to provide that.  Its value 
> doesn't show up in the dir() output.
>
> Any help would be greatly appreciated.
>


This has nothing to do with inheritance - you would get the same result if 
you called `self.children` from StepBlueprint.

See the documentation on many-to-many relationships with self:
https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.ManyToManyField.symmetrical
(emphasis added):

"When Django processes this model, it identifies that it has a 
ManyToManyField on itself, and as a result, it **doesn’t add a person_set 
attribute to the Person class**. Instead, the ManyToManyField is assumed to 
be symmetrical – that is, if I am your friend, then you are my friend.
If you do not want symmetry in many-to-many relationships with self, set 
symmetrical to False. This will force Django to add the descriptor for the 
reverse relationship, allowing ManyToManyField relationships to be 
non-symmetrical."
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b2760ab2-e7bf-4733-84a7-36281705cf8c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Backwards relation not showing up via related_name in inherited models

2013-10-28 Thread Joshua Orvis
I'm using Django 1.6 RC1 and Python 3.3 with the following models:

class StepBlueprint(models.Model):
parents = models.ManyToManyField('self', blank=True, null=True, 
related_name='children')
name   = models.CharField( max_length=100 )

def __str__(self):
return self.name

class FlowBlueprint(StepBlueprint):
description = models.TextField()

def get_children(self):
print("DEBUG: processing ({0})".format(self))
print(dir(self))

# why isn't this working??  this is what related_name is supposed 
to provide
return self.children

When I call get_children() here, I get the following:

DEBUG: processing (Prodigal)
['DoesNotExist', 'MultipleObjectsReturned', 'TYPES', '__class__', 
'__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', 
'__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', 
'__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', 
'__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 
'__weakref__', '_base_manager', '_default_manager', '_deferred', 
'_do_insert', '_do_update', '_get_FIELD_display', 
'_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', 
'_get_pk_val', '_get_unique_checks', '_meta', '_perform_date_checks', 
'_perform_unique_checks', '_save_parents', '_save_table', '_set_pk_val', 
'_state', 'build', 'clean', 'clean_fields', 'commandblueprint', 
'conditional_code', 'date_error_message', 'delete', 'description', 
'flow_set', 'flowblueprint', 'full_clean', 'get_children', 'get_command', 
'get_type_display', 'id', 'name', 'objects', 'parents', 'pk', 
'prepare_database_save', 'save', 'save_base', 'serializable_value', 
'standalonetool_set', 'stepblueprint_ptr', 'stepblueprint_ptr_id', 'type', 
'unique_error_message', 'validate_unique']
Traceback (most recent call last):
  [ call stack ... ]
return self.children
AttributeError: 'FlowBlueprint' object has no attribute 'children'

What am I doing wrong here?  From within the FlowBlueprint object I want to 
be able to get the backwards relation of all those objects pointing to it, 
and it seems like related_name is supposed to provide that.  Its value 
doesn't show up in the dir() output.

Any help would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ae3bcd5-ebc1-4284-a3b8-f4c2866a9b0b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Digging up Django class-based views - 1

2013-10-28 Thread Michal Sládek
Very nice, thank you!

Looking forward to read the next part.

Michal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62adad3a-6904-4d71-95a7-40229358501d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: formating

2013-10-28 Thread fabricio


> does not work
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6af0e106-ce9a-47c9-87d6-6a35e8e486fa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


South migration when custom field definitions change

2013-10-28 Thread graeme
I have an app that uses some custom model fields. These are subclasses of 
standard fields.

I have tried to include as many defaults as possible in custom field to 
stick to DRY.

I have written South introspection rules for these that work fine when I 
change a model

What happens when I change the custom field itself?

For example, if I have a subclass of CharField with a default max_length, 
and I change the
default max_length in the custom field? What if I decide I want no
max_length and decide to subclass TextField instead?

South cannot see the change and running schemamigration --auto gives 
"nothing seems to have changed"

Is there some way to create a migration easily, or would it require 
creating a migration manually?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27046567-99c5-4e3b-a6b9-30ae91347d36%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django-stdimage NoneType problem

2013-10-28 Thread Oscar Carballal
Hi,

I'm starting to port my project (e-cidadania) into python 3 and django
1.6rc1, but I'm currently facing a problem that I can't understand.

When I try to do a runserver or a syncdb or any other command, it breaks
with this message:

➜  src git:(python3) ✗ ./manage.py syncdb
TypeError: 'NoneType' object is not callable

This is the full traceback:

➜  src git:(python3) ✗ ./manage.py syncdb --traceback
Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/django/core/management/base.py",
line 222, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/lib/python3.3/site-packages/django/core/management/base.py",
line 254, in execute
self.validate()
  File "/usr/lib/python3.3/site-packages/django/core/management/base.py",
line 280, in validate
num_errors = get_validation_errors(s, app)
  File
"/usr/lib/python3.3/site-packages/django/core/management/validation.py",
line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "/usr/lib/python3.3/site-packages/django/db/models/loading.py", line
166, in get_app_errors
self._populate()
  File "/usr/lib/python3.3/site-packages/django/db/models/loading.py", line
72, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python3.3/site-packages/django/db/models/loading.py", line
96, in load_app
models = import_module('.models', app_name)
  File "/usr/lib/python3.3/site-packages/django/utils/importlib.py", line
35, in import_module
__import__(name)
  File "/usr/lib/python3.3/site-packages/guardian/models.py", line 89, in

User = get_user_model()
  File "/usr/lib/python3.3/site-packages/django/contrib/auth/__init__.py",
line 127, in get_user_model
user_model = get_model(app_label, model_name)
  File "/usr/lib/python3.3/site-packages/django/db/models/loading.py", line
230, in get_model
self._populate()
  File "/usr/lib/python3.3/site-packages/django/db/models/loading.py", line
72, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python3.3/site-packages/django/db/models/loading.py", line
96, in load_app
models = import_module('.models', app_name)
  File "/usr/lib/python3.3/site-packages/django/utils/importlib.py", line
35, in import_module
__import__(name)
  File
"/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/models.py", line
31, in 
class Space(models.Model):
  File
"/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/models.py", line
56, in Space
blank=True, null=True)
  File
"/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/fields.py", line
129, in __init__
setattr(self, att_name, dict(map(None, params_size, att)))
TypeError: 'NoneType' object is not callable


I though it might be a problem from django-stdimage, but doing an ipdb over
the affected code returned this:

ipdb> n
TypeError: 'NoneType' object is not callable
>
/home/oscarcp/devel/cidadania/ecidadania/src/core/spaces/models.py(31)()
 30
---> 31 class Space(models.Model):
 32

Anyone has a clue of where could be the problem? The code runs just fine
with python 2.7.5 and django 1.5.5

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BXe2iZ2-CCQ_DKtafRuxVr-X976Z7x3LYiZpaFCR9Dcg1LEZg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Digging up Django class-based views - 1

2013-10-28 Thread Leonardo Giordani
Hi all,

I want to share with you a post about class-based views.
Hope you find it useful.

http://lgiordani.github.io/blog/2013/10/28/digging-up-django-class-based-views-1/


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOmuYpOYsEbHKfafJr_7XzTAhYBO794AfV0M%2BJ1jELBpmA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: formating

2013-10-28 Thread Leonardo Giordani
I think that the extra space between "floatformat:" and "2" is confusing
the template system. Try using "floatformat:2" without spaces.

Leo

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/26 fabricio mata 

> even through the code {{form.valor_ultimacompra | floatformat: 2}} does
> not return anything.
>
> my model is
>
> valor_ultimacompra = models.DecimalField (u'Vlr. Ult.Compra 'max_digits =
> 18, decimal_places = 2, default = 0, blank = True, null = True)
>
>
> when you step this way}} {{form.valor_ultimacompra works
>
>
> can someone ajuadar me?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/abddc39f-4379-4ecf-88bc-c178d895ea50%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOm1k%3DOTBZtC2VQtydOnnrgZ0Ao-%2BYV23TLQ_Wo3%2BvQxQg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.