Redoing a C/CGI web app in Python/Django?

2011-04-12 Thread Graeck
Hi all,

Just looking for input ... tips, suggestions, etc.

We have an old web app written in C using CGIs.  All the html is
generating in the C code using print statements. It's become almost
impossible to do anything other than make very minor UI changes due to
the complexity of the code and the tediousness of trying to make UI
updates via 1000s of print statements. So, we're thinking of moving to
something like Django.

Since Python can call C code (libraries, functions, etc, if I'm
understanding correctly - I'm pretty new at Python myself - and
Django), would it be feasible to build the UI templates in Python/
Django and still be able to reuse some of our C code - the stuff that
crunches the huge amounts of data that we have to process?

I've started reading: http://docs.python.org/extending/extending.html

But any input (esp from people that might have trie such a migration
before) would be appreciated.

Thanks!

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



Re: [JOB] Python/Django Developer, NYC

2011-04-12 Thread Kenneth Gonsalves
On Wed, 2011-04-13 at 07:01 +0530, Kenneth Gonsalves wrote:
> On Tue, 2011-04-12 at 21:48 +0100, Cal Leeming [Simplicity Media Ltd]
> wrote:
> > If you aren't able to find anyone local to you within the time frame
> > specified, and would consider doing this remotely (as I reside in
> the
> > UK), 
> 
> I think you sent this to the list by mistake 

please ignore this - I note that you have already corrected the error
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: [JOB] Python/Django Developer, NYC

2011-04-12 Thread Kenneth Gonsalves
On Tue, 2011-04-12 at 21:48 +0100, Cal Leeming [Simplicity Media Ltd]
wrote:
> If you aren't able to find anyone local to you within the time frame
> specified, and would consider doing this remotely (as I reside in the
> UK), 

I think you sent this to the list by mistake
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: [JOB] Python/Django Developer, NYC

2011-04-12 Thread Cal Leeming [Simplicity Media Ltd]
My apologies to the list, the below reply was meant to have been directly to
the OP.

Cal.

On Tue, Apr 12, 2011 at 9:48 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi,
>
> If you aren't able to find anyone local to you within the time frame
> specified, and would consider doing this remotely (as I reside in the UK),
> then feel free to give me a shout. We don't yet have a company website up,
> simply because the majority of our clients come from word of mouth referral,
> but here is a bit of background:
>
> *Overview:*
>
>- 2 years solid Django experience (all professional)
>
>- 6 years Python 2.x and Stackless Python 2.x experience (4
>professional, 2 personal)
>
>- 12 years Linux (Debian only) experience (8 personal, 4 professional)
>
>- Former security specialist (Search "Cal Leeming" on youtube or
>google).
>- Moved into prototyping and development 3 years ago, as security gets
>   real old, real fast lol.
>
>   - Contributed to several Open Source projects (I haven't got a list,
>but a google search for foxwhisper or sleepycal will bring back quite a 
> few)
>
>- Owner of Simplicity Media Ltd (a small UK development company,
>started in February 2010, ran by myself and my partner - annual turn over 
> of
>around £60-80k).
>
>
> *Previous projects include:*
>
>- Re-writing various well known adult site in Django (facialabuse.com,
>spermsuckers.com) - these sites receive a lot of traffic, and stability
>/ performance was a key issue.
>
>- Wrote 2 established adult sites in Django (cdn05.foxwhisper.co.uk,
>www.lazylittlegirl.com).
>
>- Bespoke GSM equipment monitoring and billing statistics module
>(backend in Stackless, front end in Django).
>
>- Bespoke platform which utilized BulkSMS to send out promotional
>offers via SMS.
>
>- Data indexing for CDN06 (still in development) of which one table
>contains around 30 million rows, with no performance problems what so ever.
>
>- Written sphinx query wrapper for Django.
>
>- Contributed tons of snippets on djangosnippets, including a
>pagination modification which increased query speed from 10s to 0.2s on a 
> 30
>million row table.
>   - http://djangosnippets.org/search/?q=sleepycal
>
>   - Twitter which contains a mixture of personal and company related
>tweets
>   - http://twitter.com/sleepycal
>
>   - Have personally benchmarked and tried every deployment option
>possible (uWSGI, FastCGI, mod_fcgi, nginx, mod_wsgi etc etc)
>
>- Used memcached to prevent race conditions across multi node webapps.
>- this is a *big* problem when you get into enterprise level projects.
>
>- Written job queue handling with django-celery, with rabbitmq as the
>messaging server, which handles downloads of up to 5gb and 500 thousand
>database rows per day.
>
>
> On Mon, Apr 11, 2011 at 11:11 PM, OSS wrote:
>
>> POSITION: Python/Django Developer/Consultant
>> LOCATION: New York City, but mostly telecommute
>> DURATION: 6-12 months
>> COMPENSATION: 40-60/hour (dep on exp)
>> HOURS: 20 +/- hours per week
>>
>> My New York City client is looking for a well-seasoned Python/Django
>> Developer for a 6-12 month contract job.  The majority of the work
>> will take place in your home/office, but occasional on-site meetings
>> will be required so applicants should reside within commuting distance
>> of NYC.
>>
>> If you are interested in this job, please submit your RESUME and
>> HOURLY requirements to opensourcestaff...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

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



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Tom Christie
  The obvious big difference with REST framework is that the API is entirely 
web browse-able. To me that's quite a big deal - your API can be genuinely self 
documenting, and it's massively easier to browse, work with, and debug, than it 
would be if your working from the command line all the time.

  There's a bunch of other things I think it does well, from really nice error 
handling, using Django's class based views with mixin classes, and treating 
form and json etc input equally as regards validation, but I really need to sit 
down and write that stuff up properly sometime. (not got the time to go into it 
right now)

  And, yeah I would def use hidden form fields to set the method if you need 
web browser support for DELETE/PUT etc. It's a pretty common pattern, and it's 
much better than polluting your URL space specifically to cope with browser 
limitations.

  Cheers,
  Tom

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



Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-12 Thread AJ
Isn't there any app with just the commenting part? I mean the answer and 
comments on those answers part only.

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



python manage.py reset contenttypes doesnt work with mysql 5.5.1 Works with 5.1

2011-04-12 Thread David Markey
Simple django setup, when I try to reset contenttypes app, just after doing
a syncdb..

python manage.py reset contenttypes

You have requested a database reset.
This will IRREVERSIBLY DESTROY any data for
the "contenttypes" application in the database "my_test".
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Error: Error: contenttypes couldn't be reset. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlreset contenttypes'. That's
the SQL this command wasn't able to run.
The full error: (1217, 'Cannot delete or update a parent row: a foreign key
constraint fails')

Using django 1.2.5.


Any ideas?

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



Re: __unicode__ in tutorial part 1

2011-04-12 Thread darekodz
It works!!

THANK YOU EVERYBODY

On 12 Kwi, 22:21, Rafael Durán Castañeda
 wrote:
> I think last line from traceback is enough:
>
> IndentationError: unexpected indent
>
> 2011/4/12 darekodz 
>
>
>
>
>
>
>
> > I'm using instant django which have: Python 2.7.1 and Django 1.2.4.
> > When I add
>
> >    def __unicode__(self):
> >        return self.question
>
> > and
>
> >    def __unicode__(self):
> >        return self.choice
>
> > to my class I have errors when I want to restart shell, like:
>
> > C:\django\mysite>python manage.py syncdb
> > Traceback (most recent call last):
> >  File "manage.py", line 11, in 
> >    execute_manager(settings)
> >  File "C:\django\Python27\lib\site-packages\django\core\management
> > \__init__.py"
> > , line 438, in execute_manager
> >    utility.execute()
> >  File "C:\django\Python27\lib\site-packages\django\core\management
> > \__init__.py"
> > , line 379, in execute
> >    self.fetch_command(subcommand).run_from_argv(self.argv)
> >  File "C:\django\Python27\lib\site-packages\django\core\management
> > \base.py", li
> > ne 191, in run_from_argv
> >    self.execute(*args, **options.__dict__)
> >  File "C:\django\Python27\lib\site-packages\django\core\management
> > \base.py", li
> > ne 219, in execute
> >    self.validate()
> >  File "C:\django\Python27\lib\site-packages\django\core\management
> > \base.py", li
> > ne 249, in validate
> >    num_errors = get_validation_errors(s, app)
> >  File "C:\django\Python27\lib\site-packages\django\core\management
> > \validation.p
> > y", line 35, in get_validation_errors
> >    for (app_name, error) in get_app_errors().items():
> >  File "C:\django\Python27\lib\site-packages\django\db\models
> > \loading.py", line
> > 146, in get_app_errors
> >    self._populate()
> >  File "C:\django\Python27\lib\site-packages\django\db\models
> > \loading.py", line
> > 61, in _populate
> >    self.load_app(app_name, True)
> >  File "C:\django\Python27\lib\site-packages\django\db\models
> > \loading.py", line
> > 78, in load_app
> >    models = import_module('.models', app_name)
> >  File "C:\django\Python27\lib\site-packages\django\utils
> > \importlib.py", line 35
> > , in import_module
> >    __import__(name)
> >  File "C:\django\mysite\..\mysite\polls\models.py", line 6
> >    def __unicode__(self):
> >    ^
> > IndentationError: unexpected indent
>
> > I don't know what's wrong - Can You help me?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: New to Django-Installation problem

2011-04-12 Thread Shawn Milochik
Try replacing this:

C:\Django\Django-1.3>setup.py install

with this:

C:\Django\Django-1.3>python setup.py install

Shawn

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



Re: [JOB] Python/Django Developer, NYC

2011-04-12 Thread Cal Leeming [Simplicity Media Ltd]
Hi,

If you aren't able to find anyone local to you within the time frame
specified, and would consider doing this remotely (as I reside in the UK),
then feel free to give me a shout. We don't yet have a company website up,
simply because the majority of our clients come from word of mouth referral,
but here is a bit of background:

*Overview:*

   - 2 years solid Django experience (all professional)

   - 6 years Python 2.x and Stackless Python 2.x experience (4 professional,
   2 personal)

   - 12 years Linux (Debian only) experience (8 personal, 4 professional)

   - Former security specialist (Search "Cal Leeming" on youtube or google).
   - Moved into prototyping and development 3 years ago, as security gets
  real old, real fast lol.

  - Contributed to several Open Source projects (I haven't got a list,
   but a google search for foxwhisper or sleepycal will bring back quite a few)

   - Owner of Simplicity Media Ltd (a small UK development company, started
   in February 2010, ran by myself and my partner - annual turn over of around
   £60-80k).


*Previous projects include:*

   - Re-writing various well known adult site in Django (facialabuse.com,
   spermsuckers.com) - these sites receive a lot of traffic, and stability /
   performance was a key issue.

   - Wrote 2 established adult sites in Django (cdn05.foxwhisper.co.uk,
   www.lazylittlegirl.com).

   - Bespoke GSM equipment monitoring and billing statistics module (backend
   in Stackless, front end in Django).

   - Bespoke platform which utilized BulkSMS to send out promotional offers
   via SMS.

   - Data indexing for CDN06 (still in development) of which one table
   contains around 30 million rows, with no performance problems what so ever.

   - Written sphinx query wrapper for Django.

   - Contributed tons of snippets on djangosnippets, including a pagination
   modification which increased query speed from 10s to 0.2s on a 30 million
   row table.
  - http://djangosnippets.org/search/?q=sleepycal

  - Twitter which contains a mixture of personal and company related
   tweets
  - http://twitter.com/sleepycal

  - Have personally benchmarked and tried every deployment option
   possible (uWSGI, FastCGI, mod_fcgi, nginx, mod_wsgi etc etc)

   - Used memcached to prevent race conditions across multi node webapps. -
   this is a *big* problem when you get into enterprise level projects.

   - Written job queue handling with django-celery, with rabbitmq as the
   messaging server, which handles downloads of up to 5gb and 500 thousand
   database rows per day.


On Mon, Apr 11, 2011 at 11:11 PM, OSS  wrote:

> POSITION: Python/Django Developer/Consultant
> LOCATION: New York City, but mostly telecommute
> DURATION: 6-12 months
> COMPENSATION: 40-60/hour (dep on exp)
> HOURS: 20 +/- hours per week
>
> My New York City client is looking for a well-seasoned Python/Django
> Developer for a 6-12 month contract job.  The majority of the work
> will take place in your home/office, but occasional on-site meetings
> will be required so applicants should reside within commuting distance
> of NYC.
>
> If you are interested in this job, please submit your RESUME and
> HOURLY requirements to opensourcestaff...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



New to Django-Installation problem

2011-04-12 Thread prem
Hi,

Im trying to install Django but get an error while installing..Its a
window installation..

I have downloaded the Django files and when I tried to install I get
the following error.


C:\>cd django

C:\Django>cd django-1.3

C:\Django\Django-1.3>setup.py install
  File "C:\Django\Django-1.3\setup.py", line 70
if u'SVN' in version:
^
SyntaxError: invalid syntax


Let me know how to fix this issue..

Prem

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



Re: __unicode__ in tutorial part 1

2011-04-12 Thread Abhijeet Rastogi
May be you have copy-pasted the code from somewhere. May be you are using a
TAB instead of 4-spaces or the other way round. Its a python question. You
should brush-up your python skills before getting to django. Start with a
book like "dive into python".

On Wed, Apr 13, 2011 at 1:15 AM, darekodz  wrote:

> I'm using instant django which have: Python 2.7.1 and Django 1.2.4.
> When I add
>
>def __unicode__(self):
>return self.question
>
> and
>
>def __unicode__(self):
>return self.choice
>
> to my class I have errors when I want to restart shell, like:
>
> C:\django\mysite>python manage.py syncdb
> Traceback (most recent call last):
>  File "manage.py", line 11, in 
>execute_manager(settings)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \__init__.py"
> , line 438, in execute_manager
>utility.execute()
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \__init__.py"
> , line 379, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \base.py", li
> ne 191, in run_from_argv
>self.execute(*args, **options.__dict__)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \base.py", li
> ne 219, in execute
>self.validate()
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \base.py", li
> ne 249, in validate
>num_errors = get_validation_errors(s, app)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \validation.p
> y", line 35, in get_validation_errors
>for (app_name, error) in get_app_errors().items():
>  File "C:\django\Python27\lib\site-packages\django\db\models
> \loading.py", line
> 146, in get_app_errors
>self._populate()
>  File "C:\django\Python27\lib\site-packages\django\db\models
> \loading.py", line
> 61, in _populate
>self.load_app(app_name, True)
>  File "C:\django\Python27\lib\site-packages\django\db\models
> \loading.py", line
> 78, in load_app
>models = import_module('.models', app_name)
>  File "C:\django\Python27\lib\site-packages\django\utils
> \importlib.py", line 35
> , in import_module
>__import__(name)
>  File "C:\django\mysite\..\mysite\polls\models.py", line 6
>def __unicode__(self):
>^
> IndentationError: unexpected indent
>
> I don't know what's wrong - Can You help me?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989

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



Re: __unicode__ in tutorial part 1

2011-04-12 Thread Rafael Durán Castañeda
I think last line from traceback is enough:

IndentationError: unexpected indent

2011/4/12 darekodz 

> I'm using instant django which have: Python 2.7.1 and Django 1.2.4.
> When I add
>
>def __unicode__(self):
>return self.question
>
> and
>
>def __unicode__(self):
>return self.choice
>
> to my class I have errors when I want to restart shell, like:
>
> C:\django\mysite>python manage.py syncdb
> Traceback (most recent call last):
>  File "manage.py", line 11, in 
>execute_manager(settings)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \__init__.py"
> , line 438, in execute_manager
>utility.execute()
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \__init__.py"
> , line 379, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \base.py", li
> ne 191, in run_from_argv
>self.execute(*args, **options.__dict__)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \base.py", li
> ne 219, in execute
>self.validate()
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \base.py", li
> ne 249, in validate
>num_errors = get_validation_errors(s, app)
>  File "C:\django\Python27\lib\site-packages\django\core\management
> \validation.p
> y", line 35, in get_validation_errors
>for (app_name, error) in get_app_errors().items():
>  File "C:\django\Python27\lib\site-packages\django\db\models
> \loading.py", line
> 146, in get_app_errors
>self._populate()
>  File "C:\django\Python27\lib\site-packages\django\db\models
> \loading.py", line
> 61, in _populate
>self.load_app(app_name, True)
>  File "C:\django\Python27\lib\site-packages\django\db\models
> \loading.py", line
> 78, in load_app
>models = import_module('.models', app_name)
>  File "C:\django\Python27\lib\site-packages\django\utils
> \importlib.py", line 35
> , in import_module
>__import__(name)
>  File "C:\django\mysite\..\mysite\polls\models.py", line 6
>def __unicode__(self):
>^
> IndentationError: unexpected indent
>
> I don't know what's wrong - Can You help me?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: __unicode__ in tutorial part 1

2011-04-12 Thread Jirka Vejrazka
> IndentationError: unexpected indent
>
> I don't know what's wrong - Can You help me?


It's exactly what it says - indentation is important in Python and
number for spaces (or tabs) on that line does not match the rest of
your file. Or you mixed tabs and spaces.

  HTH

   Jirka

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



__unicode__ in tutorial part 1

2011-04-12 Thread darekodz
I'm using instant django which have: Python 2.7.1 and Django 1.2.4.
When I add

def __unicode__(self):
return self.question

and

def __unicode__(self):
return self.choice

to my class I have errors when I want to restart shell, like:

C:\django\mysite>python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "C:\django\Python27\lib\site-packages\django\core\management
\__init__.py"
, line 438, in execute_manager
utility.execute()
  File "C:\django\Python27\lib\site-packages\django\core\management
\__init__.py"
, line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\django\Python27\lib\site-packages\django\core\management
\base.py", li
ne 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "C:\django\Python27\lib\site-packages\django\core\management
\base.py", li
ne 219, in execute
self.validate()
  File "C:\django\Python27\lib\site-packages\django\core\management
\base.py", li
ne 249, in validate
num_errors = get_validation_errors(s, app)
  File "C:\django\Python27\lib\site-packages\django\core\management
\validation.p
y", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "C:\django\Python27\lib\site-packages\django\db\models
\loading.py", line
146, in get_app_errors
self._populate()
  File "C:\django\Python27\lib\site-packages\django\db\models
\loading.py", line
61, in _populate
self.load_app(app_name, True)
  File "C:\django\Python27\lib\site-packages\django\db\models
\loading.py", line
78, in load_app
models = import_module('.models', app_name)
  File "C:\django\Python27\lib\site-packages\django\utils
\importlib.py", line 35
, in import_module
__import__(name)
  File "C:\django\mysite\..\mysite\polls\models.py", line 6
def __unicode__(self):
^
IndentationError: unexpected indent

I don't know what's wrong - Can You help me?


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



Re: Error: No module named mysql.base when trying to sync.db

2011-04-12 Thread dsx
same here.

On Apr 1, 12:48 am, nai  wrote:
> I posted the same question on stackoverflow 
> here:http://stackoverflow.com/questions/5509755/problem-with-django-syncdb...
>
> Reproduced
>
> Hi all, I'm trying to deploy my project on my EC2 instance. When I run
> python manage.py validate I get this error Error: No module named
> mysql.base .
>
> I have already installed MySQL-python using yum install MySQL-python.
> I can import MySQLdb successfully from the Python interpreter.
>
> I can't seem to figure out what's wrong?
>
> I am using Django 1.3 and Python 2.6 and MySQLdb 1.2.3c1

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



Re: Navigation menu

2011-04-12 Thread Jason Culverhouse
There is a snippet http://djangosnippets.org/snippets/1729/
"Template tag to handle navigation item selection"
which is quite useful for creating navigation/menu structure
Jason

On Apr 12, 2011, at 11:43 AM, javatina wrote:

> You can put your current menu option in context and then, while
> rendering pages, check for it and use a different style for the active
> menu option.
> 
> On Apr 12, 5:33 am, Daniel Gerzo  wrote:
>> Hello all,
>> 
>> I was wondering how do you generate the navigation menu in your web
>> sites, with a possibility to mark up the "active" page?
>> 
>> My searching revealed some solutions, most of them based on implementing
>> a custom template tag and then parsing the request.path. I was wondering
>> whether someone came up with something more nicer?
>> 
>> Thanks!
>> 
>> --
>> Kind regards
>>Daniel Gerzo
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Activating HTML error emails while keeping logger defaults

2011-04-12 Thread Carsten Fuchs

Hi all,

from the documentation at 
 I get that I 
need something like



LOGGING = {
'version': 1,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'include_html': True,
}
}
}


in settings.py in order to include HTML in error emails.

However, that seems to override the default configuration that is 
normally used for logging, that, afaics, makes sense to keep.


How do I activate HTML in error emails while keeping the default config 
intact?


Many thanks and best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Is it possible to output a graph from Matplotlib into Django like this?

2011-04-12 Thread Aryeh Leib Taurog
On Apr 11, 1:21 pm, nai  wrote:
> Is there anyway I can return the image like this `return
> render_to_response('template.html', {'graph':  matplotlib or some other graphing package>}`

As noted, images are almost always loaded independently.  See, for
example, "Definition and Usage" of img tag here: 
http://www.w3schools.com/tags/tag_IMG.asp

If you would like to learn more about how to actually embed image in
the page, do a google search for Base64 data url.  The relevant rfc is
here: http://www.faqs.org/rfcs/rfc2397.html
Note that this is of extremely limited application:
1. It doesn't work in all browsers.
2. Due to url length limits it won't work for large images

If you generate an svg image, you can embed that directly into the
page in the fashion you have suggested.  Alas this also is not a cross
browser solution, but there are javascript/flash workarounds which may
suffice for you.  Take a look at SVGWeb http://code.google.com/p/svgweb/

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



Re: Navigation menu

2011-04-12 Thread javatina
You can put your current menu option in context and then, while
rendering pages, check for it and use a different style for the active
menu option.

On Apr 12, 5:33 am, Daniel Gerzo  wrote:
> Hello all,
>
> I was wondering how do you generate the navigation menu in your web
> sites, with a possibility to mark up the "active" page?
>
> My searching revealed some solutions, most of them based on implementing
> a custom template tag and then parsing the request.path. I was wondering
> whether someone came up with something more nicer?
>
> Thanks!
>
> --
> Kind regards
>    Daniel Gerzo

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



admin inline formset using incorrect form

2011-04-12 Thread shanyu
Hi, please take a look at the following code.

def create_foo_form(baz):
class FooForm(forms.ModelForm):
   def __init__(self, *args, **kwargs):
   print "Initializing a FooForm object"
   # Init stuff here
return FooForm

class FooInline(admin.TabularInline):
model = Foo

def get_formset(self, request, obj=None, **kwargs):
if obj:
kwargs['form'] = create_foo_form(obj)
return super(FooInline, self).get_formset(request, obj,
**kwargs)

class BazAdmin(admin.ModelAdmin):
inlines = [FooInline,]


Suppose we are changing a Baz object. First, get_formset method will
be passed the Baz object as obj and following that a FooForm class
will be created and passed to the superclass method.

Here's the part that's beyond my understanding: After that,
get_formset gets executed for an extra time with obj=None. Because obj
is None, the method doesn't pass FooForm to the superclass method, and
therefore the superclass is expected to construct the formset using
default form (self.form - which is not FooForm). But to my surprise I
am getting FooForm objects initialized.

So I have 2 questions:
1. Why does get_formset get called an extra time with obj=None?
2. Why are FooForm objects used when a formset is constructed in this
second time?

Regards.

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



Admin Interface Super User Not Logging In

2011-04-12 Thread Johan
I have just installed the newest version of django from the source
repo. I added the admin app, did the synchdb (as part of this I
created the admin user), then  i started the test server. Then I
browsed to the admin login page and enter the admin user and the
correct password. I get told that the username/password is
incorrect ... I have already recreated the database from scratch a
couple of times. I have also checked the actual database and the entry
in the auth user table looks fine. I have also tried the manage.py
create superuser path and still no luck. Does anybody have any ideas
that I can try other than the ones above. I am sure it is a very
simple thing I am overlooking  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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Brian Bouterse
This is an interesting approach I had not thought of before.  Thanks!

Agreed, CRUD is not the same as REST.

Brian

On Tue, Apr 12, 2011 at 10:51 AM, sebastien piquemal wrote:

> Well ... http://django-rest-framework.org  allows you to override the
> method by adding a post parameter. So in your form, you just add a
> hidden input
>
> 
>
> or
>
> 
>
> and django-rest-framework will pipe your POST request into the "put"
> handler or "delete" handler. Of course name="_method" can be
> configured (I mean that you can use another parameter name). That's a
> quite elegant way to overcome the limitation you are talking about
> (even though CRUD and REST are not exactly the same things).
>
> I am not sure that piston is still actively maintained ...
>
> On Apr 12, 3:57 pm, Brian Bouterse  wrote:
> > I've been reading through the documentation for piston and
> > django-rest-framework.org and they both look like great projects.  Could
> > anyone with experience working with either of these applications (or
> their
> > authors themselves) provide some compare and contrasting of the
> > features/usability/etc.
> >
> > Also, as a general REST-ism, the HTML
> > formtag doesn't
> > allow for HTTP methods besides GET and POST.  As such we
> > typically write a full REST API (GET, PUT, POST, DELETE), and then end up
> > doing the following to "make it work" for HTML/browser settings.
> >
> > CREATE - POST to /resource/
> > READ - GET to /resource/
> > UPDATE - POST to /resource/
> > DELETE - POST to /resource/delete
> >
> > The really non-restful part of the "make it work for browsers" hack is
> > adding the verb delete into the URL.  I couldn't think of a better way.
> >  This is a common pattern I end up implementing a lot, and it would be
> cool
> > if a rest framework let me accomplish this in an easier way.
> >
> > Brian
> >
> > On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie  >wrote:
> >
> >
> >
> > > I've been working on this with some folks:
> >
> > >http://django-rest-framework.org
> >
> > > Released 0.1 a few weeks ago, and it's coming along *really* nicely.
> It's
> > > under v active development ATM. The auto-generated API browser is
> > > particularly cool. Really would advise anyone taking a look at building
> web
> > > APIs in python to take a look at it.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > Brian Bouterse
> > ITng 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-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating REST APIs in Django...advice

2011-04-12 Thread sebastien piquemal
Well ... http://django-rest-framework.org  allows you to override the
method by adding a post parameter. So in your form, you just add a
hidden input



or



and django-rest-framework will pipe your POST request into the "put"
handler or "delete" handler. Of course name="_method" can be
configured (I mean that you can use another parameter name). That's a
quite elegant way to overcome the limitation you are talking about
(even though CRUD and REST are not exactly the same things).

I am not sure that piston is still actively maintained ...

On Apr 12, 3:57 pm, Brian Bouterse  wrote:
> I've been reading through the documentation for piston and
> django-rest-framework.org and they both look like great projects.  Could
> anyone with experience working with either of these applications (or their
> authors themselves) provide some compare and contrasting of the
> features/usability/etc.
>
> Also, as a general REST-ism, the HTML
> formtag doesn't
> allow for HTTP methods besides GET and POST.  As such we
> typically write a full REST API (GET, PUT, POST, DELETE), and then end up
> doing the following to "make it work" for HTML/browser settings.
>
> CREATE - POST to /resource/
> READ - GET to /resource/
> UPDATE - POST to /resource/
> DELETE - POST to /resource/delete
>
> The really non-restful part of the "make it work for browsers" hack is
> adding the verb delete into the URL.  I couldn't think of a better way.
>  This is a common pattern I end up implementing a lot, and it would be cool
> if a rest framework let me accomplish this in an easier way.
>
> Brian
>
> On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie wrote:
>
>
>
> > I've been working on this with some folks:
>
> >http://django-rest-framework.org
>
> > Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's
> > under v active development ATM. The auto-generated API browser is
> > particularly cool. Really would advise anyone taking a look at building web
> > APIs in python to take a look at it.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Brian Bouterse
> ITng 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Advice: project hosting apps

2011-04-12 Thread dave b
There is also http://gitorious.org/ - it is ROR, but it is agpl.

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



Re: Advice: project hosting apps

2011-04-12 Thread Cal Leeming [Simplicity Media Ltd]
Why don't you try GitHub:FI? It's basically a github install on your own
appliance in your office..

On Tue, Apr 12, 2011 at 3:21 PM, Derek  wrote:

> On Apr 11, 3:50 pm, Peter Herndon  wrote:
> > Thanks very much for the advice, all!  I greatly appreciate it.
> >
> > ---Peter
> > On Apr 4, 2011, at 9:25 AM, Peter Herndon wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi all,
> >
> > > I'm tasked to build an internal project hosting site similar to Github
> > > or Bitbucket for my employer, and I'm wondering what the current
> > > state-of-the-art is for this. I want to provide per-project issue
> > > tracking, wiki or other documentation building, and a nice view of
> > > each project's git repository.
> >
> > > Please let me know of any recommendations you may have for apps that
> > > supply this sort of functionality. I greatly appreciate any
> > > suggestions you may have.
>
> Also : http://www.springloops.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Navigation menu

2011-04-12 Thread Andy Mikhailenko
Hello Daniel,

I think you really need to provide your definition of "nicer" to get
useful feedback.

For instance, my implementation of breadcrumbs[1] indeed introduces a
custom template tag and I haven't the slightest idea what are the use
cases where this approach would not be natural.

[1] http://packages.python.org/django-navigation/

Regards,
Andy

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



Re: Advice: project hosting apps

2011-04-12 Thread Derek
On Apr 11, 3:50 pm, Peter Herndon  wrote:
> Thanks very much for the advice, all!  I greatly appreciate it.
>
> ---Peter
> On Apr 4, 2011, at 9:25 AM, Peter Herndon wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > I'm tasked to build an internal project hosting site similar to Github
> > or Bitbucket for my employer, and I'm wondering what the current
> > state-of-the-art is for this. I want to provide per-project issue
> > tracking, wiki or other documentation building, and a nice view of
> > each project's git repository.
>
> > Please let me know of any recommendations you may have for apps that
> > supply this sort of functionality. I greatly appreciate any
> > suggestions you may have.

Also : http://www.springloops.com/

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



Re: Can give each user a specific folder to upload to using an ImageField?

2011-04-12 Thread urukay
yes, this how you can upload image or whatever file to folder outside
MEDIA..it uploads to PRIVATE_ROOT/...

This is simple version of Image model in my project:

from django.core.files.storage import FileSystemStorage
from contrib.models.fields import  CustomFileField
fs = FileSystemStorage(location='%s/profile'%(settings.PRIVATE_ROOT),
base_url='/%s/profile/'%(settings.PRIVATE_URL))

class Image(ImageModel):

profile = models.ForeignKey(UserProfile)
image = CustomFileField(prime_upload=True ,storage=fs)

def get_upload_to(self, field_attname):
try:
return self.profile.user.username
except:
pass

Don't worry abou the CustomFileField, it's just FileField with few my
enhancements. And ImageModel is model from imagekit, but it should
work also with models.Model (don't know for sure, but this works with
Django 1.2.1).
Remember that you should also write functions to display images or
configure your server to display them.

Radovan



On 12. Apr, 14:35 h., Thomas Weholt  wrote:
> I see from the docs that ImageField takes an param called upload_to. I
> want to put uploaded files into a specific folder for that specific
> user uploading the image. And the target folder is NOT in the media
> root. Any tips on how to achieve that?
>
> --
> Mvh/Best regards,
> Thomas Weholthttp://www.weholt.org

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



Re: Navigation menu

2011-04-12 Thread Derek
On Apr 12, 11:33 am, Daniel Gerzo  wrote:
> Hello all,
>
> I was wondering how do you generate the navigation menu in your web
> sites, with a possibility to mark up the "active" page?
>
> My searching revealed some solutions, most of them based on implementing
> a custom template tag and then parsing the request.path. I was wondering
> whether someone came up with something more nicer?

How would define "more nicer"?

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



Re: Navigation menu

2011-04-12 Thread emonk
jquery?

2011/4/12 Daniel Gerzo 

> Hello all,
>
> I was wondering how do you generate the navigation menu in your web sites,
> with a possibility to mark up the "active" page?
>
> My searching revealed some solutions, most of them based on implementing a
> custom template tag and then parsing the request.path. I was wondering
> whether someone came up with something more nicer?
>
> Thanks!
>
> --
> Kind regards
>  Daniel Gerzo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: makemessages failing to extract all strings from Javascript

2011-04-12 Thread Ned Batchelder
Django's Javascript message parsing is fragile.  The full details are here: 
http://nedbatchelder.com/blog/201104/a_javascript_lexer_in_python_and_the_saga_behind_it.html

I've written a patch and attached it to ticket 7704, 
http://code.djangoproject.com/ticket/7704.  I was hoping to get it into 
Django 1.3.1, but I'm encountering resistance to that idea.  If you have any 
sway over Django core committers, use your power for good now! :)

--Ned.

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



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Brian Bouterse
I've been reading through the documentation for piston and
django-rest-framework.org and they both look like great projects.  Could
anyone with experience working with either of these applications (or their
authors themselves) provide some compare and contrasting of the
features/usability/etc.

Also, as a general REST-ism, the HTML
formtag doesn't
allow for HTTP methods besides GET and POST.  As such we
typically write a full REST API (GET, PUT, POST, DELETE), and then end up
doing the following to "make it work" for HTML/browser settings.

CREATE - POST to /resource/
READ - GET to /resource/
UPDATE - POST to /resource/
DELETE - POST to /resource/delete

The really non-restful part of the "make it work for browsers" hack is
adding the verb delete into the URL.  I couldn't think of a better way.
 This is a common pattern I end up implementing a lot, and it would be cool
if a rest framework let me accomplish this in an easier way.

Brian

On Tue, Apr 12, 2011 at 6:23 AM, Tom Christie wrote:

> I've been working on this with some folks:
>
> http://django-rest-framework.org
>
> Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's
> under v active development ATM. The auto-generated API browser is
> particularly cool. Really would advise anyone taking a look at building web
> APIs in python to take a look at it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Can give each user a specific folder to upload to using an ImageField?

2011-04-12 Thread Thomas Weholt
I see from the docs that ImageField takes an param called upload_to. I
want to put uploaded files into a specific folder for that specific
user uploading the image. And the target folder is NOT in the media
root. Any tips on how to achieve that?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



How to insert a csrf_token when entering datas through a bot ?

2011-04-12 Thread JustinMarsan
Hello,

What would be the best way to allow some bots to POST some content to
a website. Without crsf_token, the bot will get a 403, and I would
prefer not to remove this behavior but rather find a way to make the
bot send a token. How could I do that ?

I was thinking of making sure the bot is authorizied to post with some
identifiers but I guess there might be a better way to do this using
the built-in token system.

Any ideas ?

Thank you.

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



Navigation menu

2011-04-12 Thread Daniel Gerzo

Hello all,

I was wondering how do you generate the navigation menu in your web 
sites, with a possibility to mark up the "active" page?


My searching revealed some solutions, most of them based on implementing 
a custom template tag and then parsing the request.path. I was wondering 
whether someone came up with something more nicer?


Thanks!

--
Kind regards
  Daniel Gerzo

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



install admin-files

2011-04-12 Thread Massimo
Hi all,
I'm trying to install django-adminfiles, but I have some
difficulty understanding a passage:

To use django-adminfiles in your Django project:

1) Add 'adminfiles' to your INSTALLED_APPS setting.

2) Make the contents of the adminfiles/media/adminfiles directory available
at MEDIA_URL/adminfiles (or
ADMINFILES_MEDIA_URL/adminfiles/, see ADMINFILES_MEDIA_URL). This can be
done by through your webserver configuration, via an
app such as django-staticfiles, or by copying the files or making a
symlink.

3) Add url(r'^adminfiles/', include('adminfiles.urls')) in your root
URLconf.
Inherit content model admin options from FilePickerAdmin.

While the first step and third steps are fairly clear, I have a bit of
confusion on the second pass. Just do not know if I have to create a link,
or if I take the folder and copy adminfiles ... where?

Sorry for the bad English 

Thanks.

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



Re: syncdb just hangs/tutorial

2011-04-12 Thread nishant kashyap
Check out once properly yor connection(Host, username,password,port)
in setting.py



On Apr 11, 6:08 pm, L Corbani  wrote:
> I am new to django, and am running the tutorial.  I have edited
> 'settings.py' and am running "python manage.py runserver".
>
> When I run the server and then call "python manage.py syncdb" against
> my Postgres database, everything just hangs.
>
> If I kill 'runserver', then I get this message from syncdb:
>
> site-packages/Django-1.3-py2.4.egg/django/db/backends/
> postgresql_psycopg2/base.py
> line 140
>
> self.connection = Database.connect(**conn_params)
> psycopg2.OperationalError: could not connect to server:  Connection
> refused
>
> When I turn the server back on and run syncdb, it just hangs.  I try
> turning on verbose and other options...but I see nothing.
>
> It seems like something is talking to the server, but that is as far
> as it goes.
>
> Any thoughts of what might be wrong?
>
> Thanks.
> Lori

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



Re: Reusing a code snippet

2011-04-12 Thread Sithembewena Lloyd Dube
Thanks Daniel :)

On Tue, Apr 12, 2011 at 12:20 PM, Daniel Roseman wrote:

> On Tuesday, April 12, 2011 11:17:15 AM UTC+1, Lloyd Dube wrote:
>>
>> Hi Daniel,
>>
>> Thanks. I would think that plugging about in the default django
>> installation would not be good practice - can that file simply reside in the
>> project directory and the name
>> in settings.py MIDDLEWARE_CLASSES becomes 'myproj.filename', ?
>>
>> My colleague has so far added the middleware to the django-pagination
>> middleware and it works just fine.
>>
>> Thank you!
>>
>
> Yes, no reason to put it in the Django installation. Put it in your
> project, or in one of your apps. But the entry in MIDDLEWARE_CLASSES needs
> to be 'filename.classname'.
> --
> 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-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Sithembewena Lloyd Dube

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



Creating REST APIs in Django...advice

2011-04-12 Thread Tom Christie
I've been working on this with some folks:

http://django-rest-framework.org

Released 0.1 a few weeks ago, and it's coming along *really* nicely. It's under 
v active development ATM. The auto-generated API browser is particularly cool. 
Really would advise anyone taking a look at building web APIs in python to take 
a look at it.

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



Re: Reusing a code snippet

2011-04-12 Thread Daniel Roseman
On Tuesday, April 12, 2011 11:17:15 AM UTC+1, Lloyd Dube wrote:
>
> Hi Daniel,
>
> Thanks. I would think that plugging about in the default django 
> installation would not be good practice - can that file simply reside in the 
> project directory and the name
> in settings.py MIDDLEWARE_CLASSES becomes 'myproj.filename', ?
>
> My colleague has so far added the middleware to the django-pagination 
> middleware and it works just fine.
>
> Thank you!
>
 
Yes, no reason to put it in the Django installation. Put it in your project, 
or in one of your apps. But the entry in MIDDLEWARE_CLASSES needs to be 
'filename.classname'.
--
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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Reusing a code snippet

2011-04-12 Thread Sithembewena Lloyd Dube
Hi Daniel,

Thanks. I would think that plugging about in the default django installation
would not be good practice - can that file simply reside in the project
directory and the name
in settings.py MIDDLEWARE_CLASSES becomes 'myproj.filename', ?

My colleague has so far added the middleware to the django-pagination
middleware and it works just fine.

Thank you!


On Tue, Apr 12, 2011 at 12:01 PM, Daniel Roseman wrote:

>
> On Tuesday, April 12, 2011 10:44:27 AM UTC+1, Lloyd Dube wrote:
>>
>> Hi all,
>>
>> I found a code snippet to fix a dumplicvated first page of paginated
>> results and was wondering if anybody knows where in the code it should be
>> implemented?
>>
>> It looks like something that should be in views.py to me, but I'd like
>> others' input
>>
>> The code snippet is here:
>>
>> http://djangosnippets.org/snippets/1708/
>>
>> Thanks.
>>
>> --
>> Regards,
>> Sithembewena Lloyd Dube
>>
>
>
> That's a middleware. It definitely doesn't go in views.py. Put it in its
> own file, and add the name to the MIDDLEWARE_CLASSES tuple in settings.py.
> --
> 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-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Sithembewena Lloyd Dube

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



Re: Reusing a code snippet

2011-04-12 Thread Daniel Roseman

On Tuesday, April 12, 2011 10:44:27 AM UTC+1, Lloyd Dube wrote:
>
> Hi all,
>
> I found a code snippet to fix a dumplicvated first page of paginated 
> results and was wondering if anybody knows where in the code it should be 
> implemented?
>
> It looks like something that should be in views.py to me, but I'd like 
> others' input
>
> The code snippet is here:
>
> http://djangosnippets.org/snippets/1708/
>
> Thanks.
>
> -- 
> Regards,
> Sithembewena Lloyd Dube
>


That's a middleware. It definitely doesn't go in views.py. Put it in its own 
file, and add the name to the MIDDLEWARE_CLASSES tuple in settings.py.
--
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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Reusing a code snippet

2011-04-12 Thread Sithembewena Lloyd Dube
Hi all,

I found a code snippet to fix a dumplicvated first page of paginated results
and was wondering if anybody knows where in the code it should be
implemented?

It looks like something that should be in views.py to me, but I'd like
others' input

The code snippet is here:

http://djangosnippets.org/snippets/1708/

Thanks.

-- 
Regards,
Sithembewena Lloyd Dube

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



Re: Creating REST APIs in Django...advice

2011-04-12 Thread Massimiliano della Rovere
https://bitbucket.org/jespern/django-piston/wiki/Home

skype: masdero, icq: 473891447, yim: mas_dero, msn: mas_d...@hotmail.com

Mi scriva in italiano; Write me in English; Skribu al mi Esperante!


On Tue, Apr 12, 2011 at 10:07, Mazery Smith  wrote:
> Hello,
> So can anyone here recommend some REST packages/tools you use with
> Django and have a good experience with?
>
> I'm interested to know b/c it seems like most of the popular RESTful
> Django projects really stopped being very active around mid-2008.
>
> I'm wondering if that's because most people just build their own.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Creating REST APIs in Django...advice

2011-04-12 Thread Mazery Smith
Hello,
So can anyone here recommend some REST packages/tools you use with
Django and have a good experience with?

I'm interested to know b/c it seems like most of the popular RESTful
Django projects really stopped being very active around mid-2008.

I'm wondering if that's because most people just build their own.

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



Re: Please find it in your hearts to expose filter_or_exclude at a global level.

2011-04-12 Thread bruno desthuilliers
On 12 avr, 02:26, "sh...@bogomip.com"  wrote:
> Strange, I must have replied to the author only.
>
> It seems as though I was a goof and after looking through the source I
> discovered how the model manager handles functions for the queryset.
>
> xyz.objects.get_query_set()._filter_or_exclude(...) does the trick.

FWIW, I'd personnaly wrap this call in a function of a custom manager
- or monkeypatch the base Manager with it if you need it on other apps
managers. Having one single point of transformation is a good thing
when relying on some implementation detail that may change in the
future.

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