Django GeoIP

2010-07-16 Thread haibin
hi,

I am trying to use GeoIP part of GeoDjango. I importing it by from
django.contrib.gis.utils import GeoIP but getting import error. Do I
have to install someting or do the whole installation process for
GeoDjango? Or what is the minimum requirements just for GeoIP

Thanks,
James

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



Re: should i use django

2010-07-16 Thread Venkatraman S
On Sat, Jul 17, 2010 at 7:26 AM, gary_p  wrote:

> I read data from instruments, and/or
> enter parameters by hand, then run an app that crunches the data
> producing graphs and, in my dreams, animations.  Can Django do this
> smoothly?


Sure. But, when you are doing charts etc, you need to involve any charting
libraries that do this. Django does not come bundled with charting libs.


> Is it the wrong tool for this kind of thing? What would be
> the right tool?
>

Django does it. But you may want to have a cursory glance at others just to
give you the level of comfort and the final 'i know Django wins here'
feeling.


>
> I've never in my life needed or used a database, but most Django
> tutorials I see involve databases.  I store data in hdf5 files.  Are
> there examples of Django programing that don't depend on a database?
>

Lots. Django is a tool - you can craft an elephant or an ant of the
resources provided to you.
When you are dealing with other data formats then the onus is on you to
'handle' them.
Probably, you can write bridges which convert/migrate hdf5 to databases and
vice versa.

You dont need to learn databases fully, but probably a quick 101 course on
DB would be good from a programming standpoint.
Django ORM makes it easy for you if you do not like SQL queries(though
again, i would press that you learn SQL just in case that you know what you
are doing).

Are databases an essential part of using Django?  (I really would
> rather not learn about databases for the sole purpose of understanding
> a tutorial.)


Nope. You dont need to develop a DB centric app. As i said earlier, Django
is much powerful when you have a data driven (from a DB) app, but it always
works with 'others' too with equal niceties.

Should I be looking at other solutions (pyjamas?)  ?
>

You can always learn new things , compare and choose the best. 'Freedom of
Choice'

I generally find Django to be extremely great when dealing with data -
especially those that are stored in the databases, the admin is a great
utility. Having said that, i can go ahead and boast that for data processing
i find Python+Django to be the best and develop any 'structured' app with a
reasonable schema in a matter of a week's time - thats how easy it is with
Django (or probably my level of ease of development)

-V-
http://twitter.com/venkasub
http://theindianstreet.blogspot.com/

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



Virtual Private Queries/Databases

2010-07-16 Thread Venkatraman S
Hi,

I was wondering whether its possible to have something similar to virtual
private queries/databases via the django ORM?
As in, the Oracle database provides something called VPD by which policies
can be enforced wherein a user sees data only that he is allowed to see. (
http://www.oracle.com/technology/deploy/security/database-security/virtual-private-database/index.html)


What i was looking for : lets say i have a app in which i let the User
create many different types of things - so i have a User table and many
other tables with which the user interacts, now i want to let the user view
only those records that he had created. One obvious solution is to add a
predicate(WHERE clause/filter) which checks for the user's identity when the
records are retrieved - but this is not what i am looking for.

Note:I do understand that VPD is at the DB level and ORM is a level higher
than that - like a wrapper,  but i was wondering whether in django ORM is
being used in other databases like SQLite3/mysql/pg, does the ORM provide
any *intrinsic capability *by which the VPD could be achieved.

Regards,
Venkat
http://twitter.com/venkasub

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



Cisco Systems, Django developer opening in Austin, Texas

2010-07-16 Thread Ashok
Hello Django users/developers
  We are looking for senior Django developers for Austin/San Jose with
excellent pay and premium benefits. You can see job opening at
http://www.cisco.apply2jobs.com/index.cfm?fuseaction=mExternal.showJob=872502=1.

 Java is not a must skill set but Django & Python are must.

Ashok

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



Re: should i use django

2010-07-16 Thread gary_p


On Jul 16, 7:46 pm, uday  wrote:
> Hi,
>
>    I need to design a simple web app that would mostly display data
> from an xml file in different forms(like graphs,charts etc) after some
> processing.I have to do this in two weeks
>    I don't have any web development background.I am more of a systems
> programmer and thus use C/C++ a lot.But since i have used and liked
> python i turned to django.Have i made the right choice ? Is django too
> much complexity for what i want to do ? Are there lighter options that
> i can turn to ?
>
> Udayan

I have a question that is so similar to this that I've decided to jump
on this thread.

I program scientific desktop apps in python, usually using the
Enthought Tool Suite.  I know nothing about web programming.
I'm now considering running my apps on some kind of server and
controlling with a browser.  I read data from instruments, and/or
enter parameters by hand, then run an app that crunches the data
producing graphs and, in my dreams, animations.  Can Django do this
smoothly?  Is it the wrong tool for this kind of thing? What would be
the right tool?

I've never in my life needed or used a database, but most Django
tutorials I see involve databases.  I store data in hdf5 files.  Are
there examples of Django programing that don't depend on a database?
Are databases an essential part of using Django?  (I really would
rather not learn about databases for the sole purpose of understanding
a tutorial.)  Should I be looking at other solutions (pyjamas?)  ?

-gary

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



Re: Logic

2010-07-16 Thread Kenneth Gonsalves
On Friday 16 July 2010 18:56:12 Ravango wrote:
> ust call the Bioinformatics application from the "views.py".
> 

yes
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: Database systems

2010-07-16 Thread Kenneth Gonsalves
On Friday 16 July 2010 20:33:47 Venkatraman S wrote:
> > wrote:
> >
> > PostgreSQL is better supported by South, the leading django database
> > migration tool.
> 
> Is it so?? I didnt know this. Doesnt work 'properly' with SQLite3/MySQL?
> What do you mean by 'support' here?
> I thought South was DB agnostic.
> 

come on IRC and watch all the complaints from MySQL users when south advises 
them to use a proper RDBMS.
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Re: What is a good source code control software?

2010-07-16 Thread Javier Guerra Giraldez
On Fri, Jul 16, 2010 at 7:09 PM, Greg Pelly  wrote:
> I recommend finding an external host. They are cheap and you won't have to
> worry about hardware/backups/administration yourself.

i second that.  if you have a distributed team, this is a huge
timesaver.  i'm happily using repositoryhosting.com, it's very cheap
bug good solid service, not only SCM (SVN, Git or Mercurial) but also
unlimited Trac instances.

a totally different option i really like is Fossil
(http://www.fossil-scm.org/); it's a distributed SCM, wiki and ticket
system on a self-contained executable, very handy, very comfortable
(by the same author as SQLite).  you can also set it as a centralized
server with apache and two lines of bash.  the only downside is that
it's not as popular as SVN, Git or Mercurial.

-- 
Javier

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



Re: What is a good source code control software?

2010-07-16 Thread Greg Pelly
This doesn't really have much to do with Django, but here is my 2 cents:

If you have no experience with version control software, I'd recommend that
you start with subversion.  There are more advanced tools (git and mercurial
being the favorites right now), but there is a steep learning curve if you
are a beginner.  I chose git for my company after using subversion for
years, and I had to learn its nuances over time (ie, it was really
frustrating at times).  For a while you'll find yourself unable to do basic
things (adding files, merging changes, making commits) when you encounter
problems.  If the danger of this sounds worse to you than the advanced
features/benefits of a distributed VCS, go with subversion.  If your team is
highly tech savvy (perhaps they already know git/mercurial), then those may
be better options, but it doesn't sound like that is the case (or they
probably would have recommended one to you).

I recommend finding an external host. They are cheap and you won't have to
worry about hardware/backups/administration yourself.

On Fri, Jul 16, 2010 at 4:56 PM, Hooshyar  wrote:

> Hello Django users,
>
> My Django-driven web application has grown fast and large enough and
> more programmers are contributing code and UI components that I would
> like to set up a source code management software. I would be glad if
> you could share your experience as to what software I should use. I am
> new to this task, so I would appreciate your pointers too. What to
> look for? What the future expansion might compel me to adapt, etc.
>
> One of the first questions I thought I would need to address is
> whether I should install the source code management software on our
> dedicated server or use a hosted service? My immediate need is to
> expedite development cycle, as more programmers are working on
> different components and need to update the source code frequently. To
> give you an idea of our development environment, we have pure Python
> developers, Django developers, and we have UI/UX designers constantly
> working on Django templates. We also have Javascript coders working on
> various aspects of jQuery and our in-house developed Ajax
> functionality.
>
> I am willing to pay a service provider and be up and running. But in
> reality, is it how it is going to work out? In the category of hosted
> services, I found one entity http://www.svnrepository.com (it seems it
> is a public-facing web site to another destination
> http://www.SourceRepo.com).
> Has anyone experience with either of these? Or, would you recommend
> the installation is really easy, if I install the software myself.
>
> My application is NOT open-source and will not become one in the
> immediate future. It is a proprietary SaaS (software as a Service),
> although for some reasons I prefer to call it a PaaS (Platform as a
> Service). Either description, the final product will be proprietary
> and we would like to protect our code. Would this imply a hosted
> service is out of question?
>
> Thank you in advance.
>
> Regards,
> Hooshyar F. Naraghi
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Greg Pelly
CEO / CTO, Munchly Inc.

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



What is a good source code control software?

2010-07-16 Thread Hooshyar
Hello Django users,

My Django-driven web application has grown fast and large enough and
more programmers are contributing code and UI components that I would
like to set up a source code management software. I would be glad if
you could share your experience as to what software I should use. I am
new to this task, so I would appreciate your pointers too. What to
look for? What the future expansion might compel me to adapt, etc.

One of the first questions I thought I would need to address is
whether I should install the source code management software on our
dedicated server or use a hosted service? My immediate need is to
expedite development cycle, as more programmers are working on
different components and need to update the source code frequently. To
give you an idea of our development environment, we have pure Python
developers, Django developers, and we have UI/UX designers constantly
working on Django templates. We also have Javascript coders working on
various aspects of jQuery and our in-house developed Ajax
functionality.

I am willing to pay a service provider and be up and running. But in
reality, is it how it is going to work out? In the category of hosted
services, I found one entity http://www.svnrepository.com (it seems it
is a public-facing web site to another destination http://www.SourceRepo.com).
Has anyone experience with either of these? Or, would you recommend
the installation is really easy, if I install the software myself.

My application is NOT open-source and will not become one in the
immediate future. It is a proprietary SaaS (software as a Service),
although for some reasons I prefer to call it a PaaS (Platform as a
Service). Either description, the final product will be proprietary
and we would like to protect our code. Would this imply a hosted
service is out of question?

Thank you in advance.

Regards,
Hooshyar F. Naraghi



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



should i use django

2010-07-16 Thread uday
Hi,

   I need to design a simple web app that would mostly display data
from an xml file in different forms(like graphs,charts etc) after some
processing.I have to do this in two weeks
   I don't have any web development background.I am more of a systems
programmer and thus use C/C++ a lot.But since i have used and liked
python i turned to django.Have i made the right choice ? Is django too
much complexity for what i want to do ? Are there lighter options that
i can turn to ?

Udayan

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



Re: URL didn't match

2010-07-16 Thread Duncan
Thanks, that was able to get that fixed!

On Jul 16, 4:10 pm, Tim Chase  wrote:
> On 07/16/2010 04:26 PM, Duncan wrote:
>
> > Request URL:http://[redacted]/seeds/
> ...
> >     1. ^seeds/ ^/$
> ...
> > urlpatterns = patterns('',
> >      (r'^seeds/', include('seeds.general.urls')),
>
> While you don't include seeds.general.urls in your post, given
> the traceback you kindly included, it looks like you have a
> pattern there like
>
>    r'^/$'
>
> but that should probably be just
>
>    r'^$'
>
> As it currently stands, your pattern should match
>
>    http://example.com/seeds//
>
> (with *2* trailing slashes...one for the root "seeds/" and one
> for the "^/$" in  your seeds.general.urls file).  Remove that
> slash from the included file and I expect you'll be good.
>
> -tkc

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



Get all tables in one query that use OneToOne relationship

2010-07-16 Thread Sells, Fred
I've got a logical record 0f 500 columns that is broken up into about 20
tables based on an implicit logical grouping of the data.  Most of the
time this works well and the code is clean; but there are a few use
cases where I need to get all the equivalent fields for a single record
from all the tables.  The "select_related()" seems to only follow to the
"parent" table, while I want to use the parent table to get all the
related "child" (or sibling to be more precise) columns.  I know I could
use a for loop and a __dict__.update() to make multiple queries of the
DB and get the data, or I could write some SQL to select all; but
neither seem very Pythonic.  

Is there a clean way to do this in Django?



My models.py contains this code (snipped for brevity)

class Assessment(models.Model):
facility= models.ForeignKey(Facility, default='MZ')
resid= models.CharField(max_length=7, default='MZ1')
status   = models.IntegerField(default=0)

class MDSSection(models.Model):
assessment = models.OneToOneField(Assessment, primary_key=True)

class Meta:
abstract= True

class A(MDSSection):
A0100A= models.CharField(max_length=10, help_text='''Text  :
Facility National Provider Identifier (NPI)''') 
A0100B= models.CharField(max_length=12, help_text='''Text  :
Facility CMS Certification Number (CCN)''') 
A0100C= models.CharField(max_length=15, help_text='''Text  :
State provider number''')

class B(MDSSection):
B0100 = models.CharField(max_length= 1, help_text='''Code  :
Comatose''') 
B0200 = models.CharField(max_length= 1, help_text='''Code  :
Hearing''') 
B0300 = models.CharField(max_length= 1, help_text='''Code  :
Hearing aid''')

...

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



Re: how to install django-mingus blog? installed vrtualenv + virtualenvwrapper now I'm stuck

2010-07-16 Thread justin jools
aha...
thanks for that
My development server is linux but I always test locally on windows
before uploading...
Will try this out, thanks...
Maybe I should setup a linux local test environment

On 16 July, 23:40, Ivan  wrote:
> Hi Justin,
>
> I guess, you are using Windows OS,
>
> Fromhttp://stackoverflow.com/questions/2615968/installing-virtualenvwrapp...
> virtualenvwrapper does not work in Windows, unless you are using cygwin.
>
> Alternate solution is Virtualenv Helper for Windows
> (http://justindriscoll.us/2009/03/virtualenv-helper-for-windows.html)
>
> Hope it helps.
>
> Cheers,
> Ivan
>
> On Sat, Jul 17, 2010 at 7:42 AM, justin jools  wrote:
> > Hi,
> > sorry was
>
> > c:\django>mkvirtualenv myblog
> > 'mkvirtualenv' is not recognized as an internal or external command,
> > operable program or batch file.
>
> > but I figured out that on windows virtualenv myblog works
>
> > but now (folowing tutorial as bottom),
> > workon myblog porduces error:
>
> > c:\django>workon myblog
> > 'workon' is not recognized as an internal or external command,
> > operable program or batch file.
>
> > -
>
> > mkvirtualenv myblog —-no-site-packages
> > workon myblog
> > cdvirtualenv
> > git clone git://github.com/montylounge/django-mingus.git
> > cd django-mingus/mingus
> > pip install -r stable-requirements.txt
> > cp local_settings.py.template local_settings.py
> > ./manage.py syncdb
> > ./manage.py loaddata test_data.json
> > ./manage.py runserver
>
> > On 16 July, 22:29, Ivan  wrote:
> >> Hi Justin,
>
> >> What is the error message?
>
> >> Cheers,
> >> Ivan
>
> >> On Sat, Jul 17, 2010 at 7:09 AM, justin jools  
> >> wrote:
> >> > RE:http://djangoadvent.com/1.2/everything-i-hate-about-mingus/
> >> > I tried following this to install Django-Mingus, it says it is easy
> >> > but not for a newbie who knows nothing about virtualenv! tsk!
>
> >> > I don't have pip so I ran easy_install
> >> > 1. easy_install virtualenv... no problem
> >> > 2. easy_instal virtualenvwrapper... no problem
> >> > 3. mkvirtualenv myblog —-no-site-packages
> >> > I get error: mkvirtualenv myblog —-no-site-packages
>
> >> > What am I doing wrong...
>
> >> > thanks for your help
>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "Django users" group.
> >> > To post to this group, send email to django-us...@googlegroups.com.
> >> > To unsubscribe from this group, send email to 
> >> > django-users+unsubscr...@googlegroups.com.
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Re: URL didn't match

2010-07-16 Thread Tim Chase

On 07/16/2010 04:26 PM, Duncan wrote:

Request URL: http://[redacted]/seeds/

...

1. ^seeds/ ^/$

...

urlpatterns = patterns('',
 (r'^seeds/', include('seeds.general.urls')),


While you don't include seeds.general.urls in your post, given 
the traceback you kindly included, it looks like you have a 
pattern there like


  r'^/$'

but that should probably be just

  r'^$'

As it currently stands, your pattern should match

  http://example.com/seeds//

(with *2* trailing slashes...one for the root "seeds/" and one 
for the "^/$" in  your seeds.general.urls file).  Remove that 
slash from the included file and I expect you'll be good.


-tkc



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



Re: Django bases blog solutions

2010-07-16 Thread Peter Herndon
"What am I doing wrong..."

First, you aren't asking for help in the proper venue. I'm Cc'ing the 
django-users mailing list, which is where your question belongs, and to which I 
know  you subscribe. 

Second, your question is badly put together. You need to learn to ask better 
questions. In this case, you mention you get an error when you try to create a 
virtualenv.  That's a start, but you should include the text of the error stack 
trace. You should also include such pertinent details as your OS, your Python 
version. 

Third, consider searching for the answer. Chances are that others have 
encountered a similar problem, and their solutions are documented somewhere 
that Google can find for you.  The first thing I do when confronted with an 
error I've never seen before is search for the text of the error. This usually 
obviates the need for asking questions, and is faster than waiting for a reply. 

HTH,

---Peter

On Jul 16, 2010, at 5:10 PM, justin jools  wrote:

> How do i install it?
> RE: http://djangoadvent.com/1.2/everything-i-hate-about-mingus/
> I tried following this to install Django-Mingus, it says it is easy
> but not for a newbie who knows nothing about virtualenv! tsk!
> 
> I don't have pip so I ran easy_install
> 1. easy_install virtualenv... no problem
> 2. easy_instal virtualenvwrapper... no problem
> 3. mkvirtualenv myblog —-no-site-packages
> I get error: mkvirtualenv myblog —-no-site-packages
> 
> What am I doing wrong...
> 
> thanks for your help
> 
> On 4 Feb, 17:09, Peter Herndon  wrote:
>> On Feb 4, 2010, at 10:02 AM, Joel Stransky wrote:
>> 
>>> Hi all,
>>> I'm brand new to Django/Python but not software development. I just to say 
>>> hi and ask for your understanding on my newbish questions.
>>> I realize Django, when used correctly makes it stupidly easy to create 
>>> webblogs but I'm curious as to whats out there as far as django based blog 
>>> installs go a la wordpress.
>> 
>>> Any input is appreciated.
>> 
>> Hi Joel,
>> 
>> I'm tempted to suggest you write your own blog engine, as that seems to be 
>> the first thing every new-to-Django programmer does, and it will provide a 
>> good learning experience.  However, if you are looking for an actual really 
>> good, pre-built blog app, you can't really go wrong with 
>> django-mingus(http://github.com/montylounge/django-mingus).  There are 
>> dozens of other options out there (since, as written above, darn near 
>> everyone writes their own at some point), but django-mingusis both easy to 
>> use and provides an excellent example of both good software engineering and 
>> good deployment practices.  
>> 
>> ---Peter Herndon

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



Re: how to install django-mingus blog? installed vrtualenv + virtualenvwrapper now I'm stuck

2010-07-16 Thread Ivan
Hi Justin,

I guess, you are using Windows OS,

From
http://stackoverflow.com/questions/2615968/installing-virtualenvwrapper-on-windows
virtualenvwrapper does not work in Windows, unless you are using cygwin.

Alternate solution is Virtualenv Helper for Windows
(http://justindriscoll.us/2009/03/virtualenv-helper-for-windows.html)

Hope it helps.

Cheers,
Ivan



On Sat, Jul 17, 2010 at 7:42 AM, justin jools  wrote:
> Hi,
> sorry was
>
> c:\django>mkvirtualenv myblog
> 'mkvirtualenv' is not recognized as an internal or external command,
> operable program or batch file.
>
> but I figured out that on windows virtualenv myblog works
>
> but now (folowing tutorial as bottom),
> workon myblog porduces error:
>
> c:\django>workon myblog
> 'workon' is not recognized as an internal or external command,
> operable program or batch file.
>
> -
>
> mkvirtualenv myblog —-no-site-packages
> workon myblog
> cdvirtualenv
> git clone git://github.com/montylounge/django-mingus.git
> cd django-mingus/mingus
> pip install -r stable-requirements.txt
> cp local_settings.py.template local_settings.py
> ./manage.py syncdb
> ./manage.py loaddata test_data.json
> ./manage.py runserver
>
> On 16 July, 22:29, Ivan  wrote:
>> Hi Justin,
>>
>> What is the error message?
>>
>> Cheers,
>> Ivan
>>
>> On Sat, Jul 17, 2010 at 7:09 AM, justin jools  wrote:
>> > RE:http://djangoadvent.com/1.2/everything-i-hate-about-mingus/
>> > I tried following this to install Django-Mingus, it says it is easy
>> > but not for a newbie who knows nothing about virtualenv! tsk!
>>
>> > I don't have pip so I ran easy_install
>> > 1. easy_install virtualenv... no problem
>> > 2. easy_instal virtualenvwrapper... no problem
>> > 3. mkvirtualenv myblog —-no-site-packages
>> > I get error: mkvirtualenv myblog —-no-site-packages
>>
>> > What am I doing wrong...
>>
>> > thanks for your help
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Most common uses of Django templates

2010-07-16 Thread Antoni Aloy
2010/7/15 fabiofz :
> Hi All,
>
> I'm currently working on providing an editor for django templates in
> Pydev (http://pydev.org).
>
> Now, while I do work with django templates sometimes, my experience is
> a bit limited with it -- so far I used it only for .html files,
> sometimes with some javascript in it, so, that's what I'm covering in
> the first step (mostly an html editor which knows about django
> templates and acts accordingly, giving syntax highlighting and code-
> completion for the common django constructs -- besides the code-
> completion for html).
>
> So, my doubt is: what are the other common use cases that a django
> templates editor should support? (is css common in django templates?
> Any other format?)
>
> Another thing: would the django structures be expected to be shown in
> the outline (or mostly just the language structure -- in this case
> html)?
>
> Thanks,
>
> Fabio
>

Hi Fabio!

These  are very good news. Perhaps with the title the question hasn't
given the right attention. In my oppinion you should remade it to
something like "RFC Django support in Eclipse using PyDev". Even with
the high memory comsumtion of Eclipse, the combination Eclipse + pyDev
is my first recommended option for Python and Django development IDE.
I have to confess my actual IDE is Vim and one of the reason that
makes me to made the editor change was the lack of support of Django
templates and (the biggest one) the high machine requisites of
Eclipse.

Django templates shoud support Django tags and filters, HTML, CSS and
Javascript, This is enougth. Code completion on Django tags would be a
nice add on, but Eclipse templates is usually enought.

Best regards,

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

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



ModelForm and a new model instance

2010-07-16 Thread Joel Klabo
I am using modelForm to make a form for my Brew model. The form shows
up and works fine. And saves it when I call save. But it does not
catch the errors correctly. I set it up mostly based on this example:

from django.core.validators import ValidationError, NON_FIELD_ERRORS
try:
article.full_clean()
except ValidationError, e:
non_field_errors = e.message_dict[NON_FIELD_ERRORS]


First of all, NON_FIELD_ERRORS was unknown to django and caused an
error.

What I really want is to see a full code example of how to do this
seemingly simple thing. Just a form from a model that allows users to
create a new instance of the model and save it to the database. And
how the errors are dealt with. Please help, I swear I have looked all
through the docs.

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



Re: CSRF verification failed - 403 error

2010-07-16 Thread Joel Klabo
I had this same problem. Try this for your return statements, if
you're using render_to_response:

return render_to_response("a_template.html", c,
context_instance=RequestContext(request))

The context_instance was the key in my case. You'll need to add it to
all your views though.

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



URL didn't match

2010-07-16 Thread Duncan
Hello,

I'm trying to figure out why a django app on my server isn't running.
I've attempted to validate my django install by setting up a test
application as per http://www.djangobook.com/en/1.0/. The test app
lets me load pages just fine, with the Hello World and Time examples
they give working. My server is running Apache 2, mod_python 3.3.1-r1,
Python 3.1.2-r3, and Django 1.2.1.

However, a more complex app installed on the same server but in a
different virtual host does not work. I can't see any errors in the
config, as the config is the same (with paths changed as needed) on my
working test site. However, every time I try to access the
application, it gives this error:

Page not found (404)
Request Method: GET
Request URL: http://[redacted]/seeds/

Using the URLconf defined in seeds.urls, Django tried these URL
patterns, in this order:

   1. ^seeds/ ^/$
   2. ^activities/
   3. ^news/
   4. ^site_media(?P.*)$
   5. ^admin/
   6. ^photologue/
   7. ^i18n/
   9. ^accounts/login/$
   9. ^accounts/log_out/$

The current URL, seeds/, didn't match any of these.

Out of those URLs, admin/ will pull up a login page but all other URLs
fail.

The urls.py file is:
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
(r'^seeds/', include('seeds.general.urls')),
(r'^activities/', include('seeds.activities.urls')),
(r'^news/', include('seeds.news.urls')),
(r'^site_media(?P.*)$', 'django.views.static.serve',
{'document_root': 'site_media', 'show_indexes': True}),
(r'^admin/', include(admin.site.urls)),
(r'^photologue/', include('photologue.urls')),
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
(r'^accounts/log_out/$', 'django.contrib.auth.views.logout',
{'template_name': 'general/templates/registration/
logged_out.html'}),
)

Lastly, the Django/Python config is being set in a .htaccess file,
just as on my test site. The .htaccess is:
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "[ '/home/[redacted]/pypi' ] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE seeds.settings
SetEnv PYTHON_EGG_CACHE /tmp/.python-eggs
PythonDebug On
PythonOption django.root

Can anyone shed some light on this? I've spent a reasonable amount of
time Googling and I haven't found many resources that would help me
fix this.

Thanks,
Duncan

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



Re: how to install django-mingus blog? installed vrtualenv + virtualenvwrapper now I'm stuck

2010-07-16 Thread justin jools
Hi,
sorry was

c:\django>mkvirtualenv myblog
'mkvirtualenv' is not recognized as an internal or external command,
operable program or batch file.

but I figured out that on windows virtualenv myblog works

but now (folowing tutorial as bottom),
workon myblog porduces error:

c:\django>workon myblog
'workon' is not recognized as an internal or external command,
operable program or batch file.

-

mkvirtualenv myblog —-no-site-packages
workon myblog
cdvirtualenv
git clone git://github.com/montylounge/django-mingus.git
cd django-mingus/mingus
pip install -r stable-requirements.txt
cp local_settings.py.template local_settings.py
./manage.py syncdb
./manage.py loaddata test_data.json
./manage.py runserver

On 16 July, 22:29, Ivan  wrote:
> Hi Justin,
>
> What is the error message?
>
> Cheers,
> Ivan
>
> On Sat, Jul 17, 2010 at 7:09 AM, justin jools  wrote:
> > RE:http://djangoadvent.com/1.2/everything-i-hate-about-mingus/
> > I tried following this to install Django-Mingus, it says it is easy
> > but not for a newbie who knows nothing about virtualenv! tsk!
>
> > I don't have pip so I ran easy_install
> > 1. easy_install virtualenv... no problem
> > 2. easy_instal virtualenvwrapper... no problem
> > 3. mkvirtualenv myblog —-no-site-packages
> > I get error: mkvirtualenv myblog —-no-site-packages
>
> > What am I doing wrong...
>
> > thanks for your help
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Re: how to install django-mingus blog? installed vrtualenv + virtualenvwrapper now I'm stuck

2010-07-16 Thread Ivan
Hi Justin,

What is the error message?

Cheers,
Ivan



On Sat, Jul 17, 2010 at 7:09 AM, justin jools  wrote:
> RE: http://djangoadvent.com/1.2/everything-i-hate-about-mingus/
> I tried following this to install Django-Mingus, it says it is easy
> but not for a newbie who knows nothing about virtualenv! tsk!
>
> I don't have pip so I ran easy_install
> 1. easy_install virtualenv... no problem
> 2. easy_instal virtualenvwrapper... no problem
> 3. mkvirtualenv myblog —-no-site-packages
> I get error: mkvirtualenv myblog —-no-site-packages
>
> What am I doing wrong...
>
> thanks for your help
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



CSRF verification failed - 403 error

2010-07-16 Thread zenr
  I am having some problems with CSRF and I need some directions.

  In my project (using version 1.2 django), I have included both
CSRFResponseMiddleware and CSRFViewMiddleware in the settings.py file.
I also including the tag {% csrf_token %} in my template next to the
form tag. Even after all these, I get " Forbidden (403) CSRF
verification failed. Request aborted." on a random basis. It works
most of the time but fails in few instances. I could not find any
common pattern among them and hence the error is not reproducible. I
also noticed that the page that gave the error message had the CSRF
token in the rendered html. If the token is present I am wondering why
would it still fail?

 Any ideas? Thanks.

Ravi

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



how to install django-mingus blog? installed vrtualenv + virtualenvwrapper now I'm stuck

2010-07-16 Thread justin jools
RE: http://djangoadvent.com/1.2/everything-i-hate-about-mingus/
I tried following this to install Django-Mingus, it says it is easy
but not for a newbie who knows nothing about virtualenv! tsk!

I don't have pip so I ran easy_install
1. easy_install virtualenv... no problem
2. easy_instal virtualenvwrapper... no problem
3. mkvirtualenv myblog —-no-site-packages
I get error: mkvirtualenv myblog —-no-site-packages

What am I doing wrong...

thanks for your help

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



Re: No module named site - error deploying a django-jython war in tomcat

2010-07-16 Thread Tim Sawyer
I got around this problem by downgrading from jython 2.5.2beta1 to 
jython 2.5.1.


Hope that helps!

Tim.

On 15/07/10 22:47, Jose Flores wrote:

Hi guys,
Any workaround on this issue?

Regards,
Jose

On Jul 8, 2:43 pm, Rafael Nunes  wrote:

Same problem here.

Any thoughts?

On Jun 29, 10:50 am, tobycatlin  wrote:




Hello everybody,



I have followed the install instructions for the latest versions of
the following: jython (version: jython-2.5.2b1), django (1.2.1) and
jython-django (version 1.1.1) and have built a war of my very simple
test application.



Oh i built the war on my linux box and have tested in tomcat on both
windows and linux machines. When i went to the url i got a 500
exception:



javax.servlet.ServletException: Exception creating modjy servlet:
ImportError: No module named site



 com.xhaus.modjy.ModjyJServlet.init(ModjyJServlet.java:124)
 javax.servlet.GenericServlet.init(GenericServlet.java:211)



org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105)
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
541)



org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148)
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
869)
 org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
664)



org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.ja va:
527)



org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerW 
orkerThread.java:
80)
 org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
 java.lang.Thread.run(Thread.java:619)



I have managed to find a fair amount of documentation on building the
war but all the docs say "just deploy the war normally" so i guess i
have missed something in building the war itself. I set a JYTHONPATH
env var, is there anything else i should have done?



I can supply the war file, but it is 30mb so if it helps i'll post a
link to it for folk to download



Thanks for any and all help



toby




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



Re: Database systems

2010-07-16 Thread Simon Riggs
On Fri, 2010-07-16 at 20:33 +0530, Venkatraman S wrote:

> I thought South was DB agnostic.

It is, but databases provide different feature sets. If databases were
all the same there would not be so many to choose from.

-- 
 Simon Riggs   www.2ndQuadrant.com
 PostgreSQL Development, 24x7 Support, Training and Services

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



Re: Custom form field validation and required=False

2010-07-16 Thread Nuno Maltez
Hi,

Looking at Django's forms/fiedls.py may give you some ideas.

The test for an empty value is

if value in validators.EMPTY_VALUES

You can also use self.required to see if the required attribute is set
(e.g., see Field's validate() method).

Of course, a username with a single space will still raise your "User
not found" exception using this method  - but I think it's standard
behaviour for all Fields (try inserting a space in an integer field).

You're also ignoring validators on your custom clean method, but I
guess that's because you know you won't need them :)

"""
The clean() method on a Field subclass. This is responsible for
running to_python, validate and run_validators in the correct order
and propagating their errors. If, at any time, any of the methods
raise ValidationError, the validation stops and that error is raised.
This method returns the clean data, which is then inserted into the
cleaned_data dictionary of the form.
"""
http://docs.djangoproject.com/en/dev/ref/forms/validation/

hth,
Nuno




On Fri, Jul 16, 2010 at 2:01 PM, Paddy Joy  wrote:
> I'm trying to create a custom form field that will validate against
> auth.user. The field should throw a validation error if the user does
> not exist, otherwise the field should validate.
>
> So far I have:
>
> class ExistingUserField(forms.CharField):
>    def clean(self, value):
>        # Check if the user exists
>        try:
>            user = User.objects.get(username=value)
>        except:
>            # User does not exist
>            raise forms.ValidationError('User %s not found' % value)
>       return value
>
> I then use this in a form as:
>
> class MyForm(forms.Form):
>    user = ExistingUserField(required=False)
>
> This code works as expected when the user field is populated but does
> not honour the "required=False" argument, when the user field is left
> blank the error "User not found" is raised.
>
> Do i need to check for all forms of None and blank strings? Is there a
> better way?
>
> Paddy
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Object permissions with user authentication

2010-07-16 Thread Paul Pepper
Is there a recommended way of implementing object permissions with
Django's User authentication systems (i.e. a way of enforcing access/
authorisation restrictions on an object-basis)?

The Django documentation states that there is "a foundation for object
permissions, though there is no implementation" (see
http://docs.djangoproject.com/en/1.2/topics/auth/#handling-object-permissions).
Could anyone elaborate on this and maybe offer some guidance,
pointers, please?

Many thanks,

Paul.

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



Re: Database systems

2010-07-16 Thread Horst Gutmann
Do you plan to do anything really fancy that requires some
server-specific features? If not this becomes more of a deployment
question. If you're just starting with Django, using sqlite3 instead
of PostgreSQL or MySQL is just fine (depending on your project). For
later and for me personally avoiding the MyISAM vs. InnoDB battle is
enough reason to go with PostgreSQL ;-) Having the option of going
with Postgis for GeoDjango is a nice bonus too :-)

-- Horst

On Fri, Jul 16, 2010 at 2:10 PM, Doane  wrote:
> I'm a new Django user. Which database management system should I use
> in developing Django apps, MySQL or PostgreSQL?  Why?
>
> Thanks...Doane
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Database systems

2010-07-16 Thread mad_casual

> this is a religious question especially without any information
> about your case.   so, follow your faith :-)
>
> --
> Javier

Or like comparing a balero to paddle ball. The firmer your grip on
databases, the more useful PostgreSQL becomes. At the same time, the
firmer your grip on databases, the less it matters.

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



Re: Syntax for cache page in urls

2010-07-16 Thread Michel Thadeu Sabchuk
Hi guys!

I've found the sollution. If I use to following code, it works:

"""
from django.views.generic.simple import direct_to_template

urlpatterns = patterns('',
(r'^$', cache_page(direct_to_template, 60*15),
{'template':'home.html'}),
)
"""

Note that I specify the cache timeout in the cache_page decorator
reather than use the default one. The docs are clear about the timeout
argument and there is no example of a cache_page decorator applyed
without the timeout arg.

Anyway, that used to work in django1.1, I think it would be great to
have a "new in django1.2" mark telling about this.

What do you recomend for a default cache timeout value? May I create a
CACHE_TIMEOUT var on settings and use it in urls?

Thanks!

--
Michel Sabchuk
Brazil

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



Re: Advice on creating apps

2010-07-16 Thread mad_casual
Disclaimer: I'm no sage, I just didn't ask the question you asked and
was/am figuring it out on my own.

My advice; http://pinaxproject.com/ , set up the virtual environment
and look through the library. Also, http://www.databaseanswers.org/data_models/
, this seems like less of a 'Django question' to me.

My opinion? First, Theory and References are related and independent
from Self-Eval, Results, and Feedback (which are also interrelated). A
single application is almost a universally bad idea. You reduce
modularity, increase complexity, and make things generally ugly.
You'll end up with one large file for all your code, one large table
for all your apps and ugly shared variables, views, urls, etc.,
largely defeating the purpose of using Django.

On Jul 16, 4:38 am, barun  wrote:
> Hi All,
>
> I need some sage advice on creating Django apps.
>
> Currently I'm developing a web application, which has few distinct
> sections like, Theory, Self-evaluation, Results, References, Feedback
> and so on. Kinda online tutorial site. :)
>
> The question am pondering over is, whether I should create separate
> apps for each of these sections. I'll have different database tables
> for each of those sections. Or should all the sections come under a
> single app, with a single model.py file defining the related models?
>
> Please advise on this.
>
> Thanks in advance!

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



ANN: django-admin-tools 0.3.0 released

2010-07-16 Thread David Jean Louis

Hello,

I'm happy to announce the availability of the version 0.3.0 of 
django-admin-tools.


Django-admin-tools is a collection of extensions/tools for the default 
django administration interface, it includes:

  * a full featured and customizable dashboard,
  * a customizable menu bar,
  * tools to make admin theming easier.

Many bugs have been fixed, and new cool features and tests were added in 
this version:

http://pypi.python.org/pypi/django-admin-tools/

Django-admin-tools is generously documented, you can browse the 
documentation online here:

http://packages.python.org/django-admin-tools/

A good start is to read the quickstart guide:
http://packages.python.org/django-admin-tools/0.3.0/quickstart.html

The project wiki (including screenshots), code and bugtracker are hosted 
on Bitbucket:

http://bitbucket.org/izi/django-admin-tools/

Many thanks to all the people who contributed to this release !

Best regards,

--
David

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



Re: Advice on creating apps

2010-07-16 Thread barun
Thanks! That was quite helpful.

On Jul 16, 6:57 pm, Javier Guerra Giraldez  wrote:
> On Fri, Jul 16, 2010 at 4:38 AM, barun  wrote:
> > The question am pondering over is, whether I should create separate
> > apps for each of these sections. I'll have different database tables
> > for each of those sections. Or should all the sections come under a
> > single app, with a single model.py file defining the related models?
>
> my 2c: separate apps according to functionality, not according to user
> perception.
>
> if all (or several of) these sections can be modeled by the same code,
> do a single generic app that allows for enough configurability to
> manage all the different cases.
>
> for example, there's a well-known tagging app; if you plan to have
> tags on, say, theory chapters, and also on references; you would use
> the same django-tagging app on both.  similarly; if you can describe
> the implementation of your sections with the same code; then use one
> app for all of them.
>
> OTOH, if each section has different coding and modelling requirements,
> by all means, do separate apps.
>
> --
> Javier

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



Re: Database systems

2010-07-16 Thread Venkatraman S
On Fri, Jul 16, 2010 at 7:29 PM, Alex Robbins  wrote:

> PostgreSQL is better supported by South, the leading django database
> migration tool.


Is it so?? I didnt know this. Doesnt work 'properly' with SQLite3/MySQL?
What do you mean by 'support' here?
I thought South was DB agnostic.

-V-
http://twitter.com/venkasub

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



Pyamf + django mapping classes

2010-07-16 Thread Lucas
Hi guys, could you explain how can i map python class into amf
request. I saw documentation, samples, but it's not working yet.

Example:

I need to return by gateway the Django User Object:

from pyamf.remoting.gateway.django import DjangoGateway
from pyamf import register_class

import foo.viewUser as viewUser

register_class(User, 'django.contrib.auth.models.User')

gw = DjangoGateway({
'userService'   : viewUser,
})


the return object into the viewUser is an Django User object, when I
call the Login Method.

Thanks,



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



Re: How can view tweak response object to go to a specific *anchor* on the template?

2010-07-16 Thread Daniel Roseman
On Jul 16, 2:56 pm, Chris Seberino  wrote:
> On Jul 15, 3:57 am, Oleg Lomaka  wrote:> First without 
> javascript. You cat check URL of HttpRequest and if it is without
>
> #anchor element, then send redirect to the same URL with #anchor.
>
> Yes redirection is a great non-Javascript way to do this.
>
> Is there ANY way to preserve the old form data through the
> redirection?
>
> (Imagine an invalid form that gets kicked back to the user.If I do
> a redirection must I lose the prepopulated data?)
>
> cs

Redirection will *not* work. As I said above, there is no way to
determine from the server whether or not a URL has the anchor already,
because that is never sent to the server. So if you always redirect
when you receive a URL without the anchor, you will redirect
continually.
--
DR.

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



Syntax for cache page in urls

2010-07-16 Thread Michel Thadeu Sabchuk
Hi guys,

I'm migrating a project from django1.1 to django1.2.1 and I have
problems with cache.

I used to write on the urls:

"""
from django.views.generic.simple import direct_to_template

urlpatterns = patterns('',
(r'^$', cache_page(direct_to_template), {'template':'home.html'}),
)
"""

This is the same as the documentation tells, except that I pass the
"template" in the kwargs. That works in the django1.1 but do not work
in django1.2.

If this is correct, I need to create a wrapper for the
direct_to_template function. Do I need to create the wrapper or is
this a bug?

Thanks in advance.

--
Michel Sabchuk
Brazil

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



Re: Database systems

2010-07-16 Thread Alex Robbins
PostgreSQL is better supported by South, the leading django database
migration tool. It allows you to make schema altering migrations
within a transaction, so they can be rolled back if the migration
fails. On MySQL you are just left with a half-migrated database.

Also, if you are going to use much GeoDjango functionality, you'll
probably need PostgreSQL.

Alex

On Jul 16, 7:10 am, Doane  wrote:
> I'm a new Django user. Which database management system should I use
> in developing Django apps, MySQL or PostgreSQL?  Why?
>
> Thanks...Doane

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



Re: Database systems

2010-07-16 Thread Javier Guerra Giraldez
On Fri, Jul 16, 2010 at 7:10 AM, Doane  wrote:
> I'm a new Django user. Which database management system should I use
> in developing Django apps, MySQL or PostgreSQL?  Why?

this is a religious question especially without any information
about your case.   so, follow your faith :-)

-- 
Javier

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



Re: Advice on creating apps

2010-07-16 Thread Javier Guerra Giraldez
On Fri, Jul 16, 2010 at 4:38 AM, barun  wrote:
> The question am pondering over is, whether I should create separate
> apps for each of these sections. I'll have different database tables
> for each of those sections. Or should all the sections come under a
> single app, with a single model.py file defining the related models?


my 2c: separate apps according to functionality, not according to user
perception.

if all (or several of) these sections can be modeled by the same code,
do a single generic app that allows for enough configurability to
manage all the different cases.

for example, there's a well-known tagging app; if you plan to have
tags on, say, theory chapters, and also on references; you would use
the same django-tagging app on both.  similarly; if you can describe
the implementation of your sections with the same code; then use one
app for all of them.

OTOH, if each section has different coding and modelling requirements,
by all means, do separate apps.


-- 
Javier

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



Re: How can view tweak response object to go to a specific *anchor* on the template?

2010-07-16 Thread Chris Seberino
On Jul 15, 3:57 am, Oleg Lomaka  wrote:
> First without javascript. You cat check URL of HttpRequest and if it is 
> without
#anchor element, then send redirect to the same URL with #anchor.

Yes redirection is a great non-Javascript way to do this.

Is there ANY way to preserve the old form data through the
redirection?

(Imagine an invalid form that gets kicked back to the user.If I do
a redirection must I lose the prepopulated data?)

cs

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



Re: How can view tweak response object to go to a specific *anchor* on the template?

2010-07-16 Thread Chris Seberino
On Jul 15, 3:44 am, Daniel Roseman  wrote:
>      window.location = window.location + '#whatever'

I added that code to script element in head and it didn't work.

I have a TinyMCE javascript editor that gets run too.  I don't know if
that is conflicting or if there is something else I need to do to make
it work?

cs

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



Re: Logic

2010-07-16 Thread Ravango
Yes, that's it. A web service that would be running a top of a web
server. I have built a bioinformatics application, which I would be
offering as a web service. The question is when I'm using Django, once
I get the user input and process it (writing it into a file), can I
just call the Bioinformatics application from the "views.py". This
bioinformatics application is a Python code as well.

On Jul 16, 3:16 pm, bobhaugen  wrote:
> On Jul 16, 7:56 am, Ravango  wrote:
>
> > I mean by web server, running a web site, which anyone could use to
> > perform a specific task. In my case, I would be running a program that
> > people might be interested to use. Towards building a web server,
> > currently, using Django, I'm creating a local web server.
>
> Do you mean a web server like Apache, or a web service that rides on
> top of a web server. and many web services might run on top of the
> same web server?
>
> And what specific task that people might be interested to use do you
> have in mind?  (I'm not trying to pry into anything that you consider
> secret here, just trying to understand better what you mean.)

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



Re: Problem with simple search func in template

2010-07-16 Thread maciekjbl
Just as I thought, such a simple thing.

Thanks, very much now it's working. :)

On 16 Lip, 15:03, Nuno Maltez  wrote:
> On Fri, Jul 16, 2010 at 1:56 PM, maciekjbl  wrote:
> > urlpatterns = patterns('django.views.generic.list_detail',
> >    url(r'^(?P[-\w]+)/$', 'object_detail', info, name="link-
> > prod"),
> >    url(r'^$','object_list', info, name="link-home"),
>
> > )
>
> > urlpatterns += patterns('web_aplikacje.produkty.views',
> >   url(r'^search/$', 'search', name="link-search"),
> > )
>
> I think your '/search/' url is being caught by your
> "r'^(?P[-\w]+)/$" pattern and object_detail cannot find an
> object with a 'search' slug.
>
> Try to place the search pattern before the generic slug one.
>
> hth,
> Nuno

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



Re: Redefine True and False for Boolean and/or NullBoolean Fields?

2010-07-16 Thread rmschne
To complete the story, in case someone finds this in the future, I
ended up with the following which at the time of this writing seems to
work:

class MyNullBooleanField(models.NullBooleanField):
"""Designed to work with how Microsoft Access stores booleans as
-1 and 0 into MySQL.
The to_python function was taken from the Django modeld with
addition of -1 for true."""
__metaclass__ = models.SubfieldBase
def to_python(self,value):
if value in (True, False):
return bool(value)
if value in ('None',):
return None
if value in ('t', 'True', '1', '-1', 1, -1):
return True
if value in ('f', 'False', '0', 0):
return False
if value is None:
return None

The whole to_python function was taken from the standard definition
from the Django library.  My simple first draft wasn't complete
enough. I found that i needed to test for the integers 0,1, and -1 in
addition to their string equivalents in if value in "('t', 'True',
'1', '-1', 1, -1)" and "if value in ('f', 'False', '0', 0)". With that
change it appears to handle the boolean data stored into MySQL as
written by the Microsoft Access forms on the front end.

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



Re: Logic

2010-07-16 Thread bobhaugen
On Jul 16, 7:56 am, Ravango  wrote:
> I mean by web server, running a web site, which anyone could use to
> perform a specific task. In my case, I would be running a program that
> people might be interested to use. Towards building a web server,
> currently, using Django, I'm creating a local web server.

Do you mean a web server like Apache, or a web service that rides on
top of a web server. and many web services might run on top of the
same web server?

And what specific task that people might be interested to use do you
have in mind?  (I'm not trying to pry into anything that you consider
secret here, just trying to understand better what you mean.)

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



Re: Template Syntax Errors

2010-07-16 Thread Karen Tracey
On Fri, Jul 16, 2010 at 5:43 AM, Jx  wrote:

>  129. self._callback = get_callable(self._callback_str)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> functional.py" in wrapper
>  124. result = func(*args)
> File "/usr/local/lib/python2.6/dist-packages/django/core/
> urlresolvers.py" in get_callable
>  56. lookup_view = getattr(import_module(mod_name),
> func_name)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> importlib.py" in import_module
>  35. __import__(name)
>
> Exception Type: TemplateSyntaxError at /login
> Exception Value: Caught SyntaxError while rendering: invalid syntax
> (views.py, line 13)
>
> The template i was using was just this:
>


The error is not in the template. It is in a views.py file, on line 13.
Python raised a syntax error attempting to import a views.py file (while
Django was attempting to reverse a url, which involves looking at all your
url patterns and importing all referenced views). In general exceptions
raised during template rendering (as this was) get turned into
TemplateSyntaxErrors. You need to look at the detail of the exception value
to figure out what is really going on.

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

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



Re: Problem with simple search func in template

2010-07-16 Thread Nuno Maltez
On Fri, Jul 16, 2010 at 1:56 PM, maciekjbl  wrote:
> urlpatterns = patterns('django.views.generic.list_detail',
>    url(r'^(?P[-\w]+)/$', 'object_detail', info, name="link-
> prod"),
>    url(r'^$','object_list', info, name="link-home"),
>
> )
>
> urlpatterns += patterns('web_aplikacje.produkty.views',
>   url(r'^search/$', 'search', name="link-search"),
> )
>

I think your '/search/' url is being caught by your
"r'^(?P[-\w]+)/$" pattern and object_detail cannot find an
object with a 'search' slug.

Try to place the search pattern before the generic slug one.

hth,
Nuno

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



Custom form field validation and required=False

2010-07-16 Thread Paddy Joy
I'm trying to create a custom form field that will validate against
auth.user. The field should throw a validation error if the user does
not exist, otherwise the field should validate.

So far I have:

class ExistingUserField(forms.CharField):
def clean(self, value):
# Check if the user exists
try:
user = User.objects.get(username=value)
except:
# User does not exist
raise forms.ValidationError('User %s not found' % value)
   return value

I then use this in a form as:

class MyForm(forms.Form):
user = ExistingUserField(required=False)

This code works as expected when the user field is populated but does
not honour the "required=False" argument, when the user field is left
blank the error "User not found" is raised.

Do i need to check for all forms of None and blank strings? Is there a
better way?

Paddy

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



Re: Logic

2010-07-16 Thread Ravango
I mean by web server, running a web site, which anyone could use to
perform a specific task. In my case, I would be running a program that
people might be interested to use. Towards building a web server,
currently, using Django, I'm creating a local web server.

On Jul 16, 1:44 pm, Kenneth Gonsalves  wrote:
> On Friday 16 July 2010 14:51:22 Ravango wrote:
>
> > I've just started using Django for my project to create a web server.
>
> what do you mean by 'web server'?
> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC

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



Problem with simple search func in template

2010-07-16 Thread maciekjbl
Hi,
I done a little search function in my app, it isn't working at all.
Now I don't know if it's problem with query, views or something else.

My code

# views.py

from django.shortcuts import render_to_response
from django.db.models import Q
from web_aplikacje.produkty.models import Produkt, Producent

def search(request):
if 'q' in request.GET:
term = request.GET['q']
prod_list =
Producent.objects.filter(Q(nazwa_producenta__contains=term))
heading = "Wyniki wyszukiwania"
return render_to_response("producent_list.html", locals())

#urls.py

from django.conf.urls.defaults import *
from web_aplikacje.produkty.models import Produkt, Producent

info = { 'queryset' : Producent.objects.all(),
 'template_object_name': 'prod',
}

urlpatterns = patterns('django.views.generic.list_detail',
url(r'^(?P[-\w]+)/$', 'object_detail', info, name="link-
prod"),
url(r'^$','object_list', info, name="link-home"),

)

urlpatterns += patterns('web_aplikacje.produkty.views',
   url(r'^search/$', 'search', name="link-search"),
)

Anything I type in search field I get
'Page no found (404)'
No producent found matching the query

Query write in shell work for many diffrent terms, so this is a
problem with display results or  I don't know.

Any suggestions for this ?

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



Re: Filter data inside template

2010-07-16 Thread Daniel Roseman
On 16 July 2010 13:30, Luca Casagrande 
wrote:
> On Jul 16, 2:22 pm, Daniel Roseman  wrote:
>> On Jul 16, 1:18 pm, Luca Casagrande  wrote:
>>
>> > Hello everybody,
>> > is it possible to filter data inside template? I have 2 models with a
>> > foreignkey relationship:
>>
>> > class Requests(models.Model):
>> >         name = models.CharField(max_length=16)
>> >         surname = models.CharField(max_length=16)
>>
>> > class Information(models.Model):
>> >         request = models.ForeignKey(Requests)
>> >         description = models.CharField(max_length=16)
>>
>> > From the view to the template I pass a dictionary of requests and one
>> > of information.
>> > What I need to do is something like this:
>>
>> > 
>> > {% for r in requests %}
>> >         
>> >                 {% for i in informations WHERE request=r %}
>> >                 {{i.description}}
>> >                 {% endfor %}
>> >         
>> > {% endfor %}
>> > 
>>
>> > Any idea?
>>
>> > Thx
>>
>> Use the backwards relationship:
>>
>>     {% for i in request.information_set.all %}
>> --
>> DR.
>
> Thx Daniel for answer.
> In my example is {% for i in r.informations_set.all %} ?
>
> With informations the dictionary coming from the view.
>
> Thx


No. You don't need to send 'informations' from the view at all. You
get each related set of 'information' objects directly from its
corresponding 'request' object. Read this:
http://docs.djangoproject.com/en/1.2/topics/db/queries/#following-relationships-backward
--
DR.

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



Application hosting

2010-07-16 Thread Waleria
Hi all,


Well,

I will begin setting up a machine to host my
applications python / django. My questions are:

1º - Requeriments to configure this machine. My application is a form
where i enter with parameters, generate a image, .dat file and pdf
file and will have several internal and external accesses;

2º - Another thing that is leaving me with questions is the fact that
makes available for that machine will run several applications in
python /django, or application server is a python.

I need to know how much memory, HD. What setting do I need

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



Re: Filter data inside template

2010-07-16 Thread Daniel Roseman
On Jul 16, 1:18 pm, Luca Casagrande  wrote:
> Hello everybody,
> is it possible to filter data inside template? I have 2 models with a
> foreignkey relationship:
>
> class Requests(models.Model):
>         name = models.CharField(max_length=16)
>         surname = models.CharField(max_length=16)
>
> class Information(models.Model):
>         request = models.ForeignKey(Requests)
>         description = models.CharField(max_length=16)
>
> From the view to the template I pass a dictionary of requests and one
> of information.
> What I need to do is something like this:
>
> 
> {% for r in requests %}
>         
>                 {% for i in informations WHERE request=r %}
>                 {{i.description}}
>                 {% endfor %}
>         
> {% endfor %}
> 
>
> Any idea?
>
> Thx

Use the backwards relationship:

{% for i in request.information_set.all %}
--
DR.

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



Filter data inside template

2010-07-16 Thread Luca Casagrande
Hello everybody,
is it possible to filter data inside template? I have 2 models with a
foreignkey relationship:


class Requests(models.Model):
name = models.CharField(max_length=16)
surname = models.CharField(max_length=16)

class Information(models.Model):
request = models.ForeignKey(Requests)
description = models.CharField(max_length=16)

>From the view to the template I pass a dictionary of requests and one
of information.
What I need to do is something like this:


{% for r in requests %}

{% for i in informations WHERE request=r %}
{{i.description}}
{% endfor %}

{% endfor %}


Any idea?

Thx

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



Database systems

2010-07-16 Thread Doane
I'm a new Django user. Which database management system should I use
in developing Django apps, MySQL or PostgreSQL?  Why?

Thanks...Doane

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



Re: Logic

2010-07-16 Thread Kenneth Gonsalves
On Friday 16 July 2010 14:51:22 Ravango wrote:
> I've just started using Django for my project to create a web server.
> 

what do you mean by 'web server'? 
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

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



Advice on creating apps

2010-07-16 Thread barun
Hi All,

I need some sage advice on creating Django apps.

Currently I'm developing a web application, which has few distinct
sections like, Theory, Self-evaluation, Results, References, Feedback
and so on. Kinda online tutorial site. :)

The question am pondering over is, whether I should create separate
apps for each of these sections. I'll have different database tables
for each of those sections. Or should all the sections come under a
single app, with a single model.py file defining the related models?

Please advise on this.

Thanks in advance!

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



Logic

2010-07-16 Thread Ravango
Hi,

I've just started using Django for my project to create a web server.
I've written a software in Python which does some operations on the
input and produce an output. Yes, the input is user provided on a web
server, and the output is displayed on the web. So, where do I call
the Python software I have written? Should I call it from view, once I
got an input or should I create a separate application. For now I will
not be using any models/database.

Regards,
Balaji.

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



Template Syntax Errors

2010-07-16 Thread Jx
Hi,

i'm encountering some weird error in the template of my application.

The error enountered was:


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  100. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
csrf.py" in wrapped_view
  23. resp = view_func(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
csrf.py" in wrapped_view
  36. return view_func(*args, **kwargs)
File "/home/un0wn/mafia2/profile/views.py" in login
  854.  'form' : form,
File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/
__init__.py" in render_to_response
  20. return HttpResponse(loader.render_to_string(*args,
**kwargs), **httpresponse_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/template/
loader.py" in render_to_string
  186. return t.render(context_instance)
File "/usr/local/lib/python2.6/dist-packages/django/template/
__init__.py" in render
  173. return self._render(context)
File "/usr/local/lib/python2.6/dist-packages/django/template/
__init__.py" in _render
  167. return self.nodelist.render(context)
File "/usr/local/lib/python2.6/dist-packages/django/template/
__init__.py" in render
  796. bits.append(self.render_node(node, context))
File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py"
in render_node
  72. result = node.render(context)
File "/usr/local/lib/python2.6/dist-packages/django/template/
defaulttags.py" in render
  167. nodelist.append(node.render(context))
File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py"
in render
  89. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python2.6/dist-packages/django/template/
__init__.py" in resolve
  579. new_obj = func(obj, *arg_vals)
File "/usr/local/lib/python2.6/dist-packages/django/template/
defaultfilters.py" in _dec
  33. args[0] = force_unicode(args[0])
File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py"
in force_unicode
  66. s = unicode(s)
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in
__unicode__
  408. return self.as_widget()
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in
as_widget
  446. return widget.render(name, data, attrs=attrs)
File "/usr/local/lib/python2.6/dist-packages/
django_simple_captcha-0.1.7-py2.6.egg/captcha/fields.py" in render
  44. self.image_and_audio = '' %reverse('captcha-image',kwargs=dict(key=key))
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in reverse
  350. *args, **kwargs)))
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in reverse
  271. possibilities = self.reverse_dict.getlist(lookup_view)
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in _get_reverse_dict
  193. self._populate()
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in _populate
  173. for name in pattern.reverse_dict:
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in _get_reverse_dict
  193. self._populate()
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in _populate
  185. lookups.appendlist(pattern.callback, (bits,
p_pattern))
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in _get_callback
  129. self._callback = get_callable(self._callback_str)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
functional.py" in wrapper
  124. result = func(*args)
File "/usr/local/lib/python2.6/dist-packages/django/core/
urlresolvers.py" in get_callable
  56. lookup_view = getattr(import_module(mod_name),
func_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
importlib.py" in import_module
  35. __import__(name)

Exception Type: TemplateSyntaxError at /login
Exception Value: Caught SyntaxError while rendering: invalid syntax
(views.py, line 13)

The template i was using was just this:

{% for fields in form %}

 {{ fields.errors }}
{{ fields|escape }}{{ 
fields.label }}:


{% endfor %}

And the weird thing is that i have implemented the same code on
another server, but it works out fine. I got no idea what kind of
problem this is. Hope someone can enlighten me.

- Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 

Re: Redefine True and False for Boolean and/or NullBoolean Fields?

2010-07-16 Thread rmschne
(While slapping my forehead) ... figured it out.  Have to remove
"models" as a prefix to MyNullBooleanField, as of course, the field
definition is not in models.

forinvoice.MyNullBooleanField(null=True,
db_column='forinvoice', blank=True)

Now to get on debugging the functionality of the new field.

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



Re: Redefine True and False for Boolean and/or NullBoolean Fields?

2010-07-16 Thread rmschne
Tom,

Thanks ... Can I get a bit more of your brain power. I'm struggling
with understanding the custom-model-fields document sufficient to
allow me to do it.

At the top of the models.py files, I put in:

class MyNullBooleanField(models.NullBooleanField):
"""Designed to work with how Microsoft Access stores booleans as
-1 and 0 into MySQL"""
__metaclass__ = models.SubfieldBase
def to_python(self,value):
if value is None: return
if value == 0:
return False
else:
return True

down further in that file, as a first test of this new field, for the
table/class where I want to use it:

class MemberAddress(models.Model):
member=models.ForeignKey(Member,related_name='addresses',
db_column='memberid')
city = models.CharField(max_length=50, db_column='city',
blank=True)
forinvoice=models.MyNullBooleanField(null=True,
db_column='forinvoice', blank=True)

When I run the code I get the error on the above "forinvoice" line:

AttributeError: 'module' object has no attribute 'MyNullBooleanField'

I was assuming that by defining the new custom field at the top of the
models.py file, it would work.  I can't find anything in the custom-
model-fields doc which says "where" to put this custom definition.  I
just assumed they intended it to go into models.py

What am i doing wrong?  Thanks!!

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