Re: Working for a startup.

2010-04-22 Thread Jesaja Everling
On the Django homepage, there are a few big sites mentioned that use Django.

lawrence.com
washingtonpost.com
EveryBlock
LJWorld.com
Tabblo
Toronto Life

A lot more can probably be found on djangosites.org.
I also would tell him that Google endorses Django, for example by
shipping it with App Engine and using it for Rietveld themselves.
bitbucket.org is also done with Django, and is a very good example of
what's possible with it in my opinion.

You can find some more sites and arguments pro Django here:
http://www.slideshare.net/pydanny/why-django

And some more arguments pro Django here:
http://www.slideshare.net/idangazit/why-django-3000105

One big .net based site is stackoverflow, IIRC.

Best Regards,

Jesaja Everling


On Thu, Apr 22, 2010 at 8:06 AM, Eric Chamberlain  wrote:
>
> On Apr 22, 2010, at 12:40 AM, Joe Goldthwaite wrote:
>
> I’d like examples of large systems written in Django or other open source
> frameworks.  I’d also like stories about companies who tried .net switched
> over to open source.  It seems like there was a big Microsoft project on
> some stock exchange program that failed but I can’t find any references to
> it.  I tried searching Google but it seems like it doesn’t differentiate
> “.net” with the internet so trying to find .net failures only turned up
> stories about internet downtime.
>
> Do you have any examples of large systems written in .Net?
> Amazon, Google, Facebook, twitter, et al. are not using .Net.
> --
> Eric Chamberlain
>
>
> --
> 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: How to set the sucess message after inserting values to db in django admin site

2010-04-22 Thread Daniel Roseman
On Apr 22, 7:09 am, Radhikavk  wrote:

> And i tried to enable the messaging module in django but in django.contrib
> messages folder is missing
> my django version is 1.1
>
> Thaks
> Radhika

If you're using 1.1, you really should use the 1.1 documentation.
http://docs.djangoproject.com/en/1.1/topics/auth/#messages

--
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.



Re: Working for a startup.

2010-04-22 Thread Sam Lai
On 22 April 2010 15:40, Joe Goldthwaite  wrote:
> I’d like examples of large systems written in Django or other open source
> frameworks.  I’d also like stories about companies who tried .net switched
> over to open source.  It seems like there was a big Microsoft project on
> some stock exchange program that failed but I can’t find any references to
> it.  I tried searching Google but it seems like it doesn’t differentiate
> “.net” with the internet so trying to find .net failures only turned up
> stories about internet downtime.

I don't think bad-mouthing .NET is the way to go here. If done right,
it is just as scalable as the best out there. Technically, there's no
reason why .NET is inferior (besides language/framework/tooling
preferences). And there's always Mono as well.

I'd work out why he finds .NET to be a 'safer' platform, and show how
Linux/Apache/Django/PostgreSQL can be just as 'safe' (or better, with
less cost possibly).

Then, emphasise the advantages of the Django environment. Show the
Django sites that have scaled out massively; back it up with stats (as
iffy as they may be). Are there any tools associated with the project
that only run on Linux/*nix (and so, if they choose the .NET platform,
it will have to be re-implemented or ported)?

You also have the cost angle which you can elaborate on.

Unfortunately for you, if he intends to go with a primarily .NET shop,
I wouldn't have much faith in them knowing how to do
Django/PostgreSQL/Linux/Apache properly. Depends on the size of the
firm of course - if they're large and have dedicated divisions for
each stack, it might be different. So as much as you like Django, if
the .NET shop is preferred, I'd stick with ASP.NET (MVC) because
that's what they know best.

-- 
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 bitwise operator

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 6:10 AM, CCC  wrote:
> In django's modelManager
> I use oracle do bitwise operator,like:
>
> select * from MultiRoom m where bitand(m.groupidx,tem ) <> 0
>
> and Now I want to change it to  use django's orm ?
> anyone know how to write?
> Thanks
>

http://docs.djangoproject.com/en/1.1/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none

Use qs.extra() with an additional where clause.

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-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 bitwise operator

2010-04-22 Thread Daniel Roseman
On Apr 22, 6:10 am, CCC  wrote:
> In django's modelManager
> I use oracle do bitwise operator,like:
>
> select * from MultiRoom m where bitand(m.groupidx,tem ) <> 0
>
> and Now I want to change it to  use django's orm ?
> anyone know how to write?
> Thanks

Use 'extra' :

MultiRoom.objects.extra(where=['bitand(m.groupidx, tem) <> 0'])
--
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.



SCORM(Sharable Content Object Reference Model) Compliant for Django?

2010-04-22 Thread Zeal
Hi, All,

Does anyone has the experience on SCORM(Sharable Content Object
Reference Model) support with Django? I want to let my django
application having SCORM support for learning management app.
However, after researching on internet, there is no any post for such
topic. I know that 'moodle' is a greate LMS project with SCORM
support, however it is developed by PHP, not python. Your professional
advice would be highly appreciated!

Zeal

-- 
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.



Dynamic Model and ModelAdmin based on tables in db

2010-04-22 Thread Massimiliano della Rovere
An external process creates tables whose names follow the pattern
"collector_XYZ"; all the tables will have the very same structure.

For each table I need to create a matching django.db.models.Model and
django.admin.models.ModelAdmin, dynamically, because over time new
tables will be created and I do not want to restart apache after the
program is deployed.

How can I hook this generation process to the login function of the
admin interface so that each time a user logs in django checks if all
the tables have a corresponding model? Is there a better mount point?
Is there a more django-nic way to accomplish this?


from django.db import connection, transaction, connections

cursor = connections['collector'].cursor()
cursor.execute('SHOW TABLES LIKE "collector_%%"')
# table name: collector_identifier_nn
# identitifer is unique among all the tables
# nn is a two digit number

models = {}
for t in cursore.fetchall():
..values = str(t).split('_')[1:]
..models[values[0]] = generaCollector(values[0], values[1])
..admin.site.register(models[-1])


def generaCollector(cliente, num):
..if type(num) != type(''):
raise TypeError('parameter client must be of type %s insted of %s'
% (type(''), type(cliente)))
..if type(cliente) != type(''):
raise TypeError('parameter num must be of type %s insted of %s' %
(type(''), type(num)))
..cliente = str(cliente).lower()
..nome = 'Collector%s%s' % (cliente.capitalize(), num)
..ret = type(nome, (Collector,), {'__module__':
Collector.__dict__['__module__']})
..ret._meta.db_table = 'collector_%s_%s' % (cliente, num)
..return ret


class Collector(models.Model):
..id = models.IntegerField(primary_key=True)
..unique_check = models.CharField(unique=True, max_length=240, blank=True)
..collector = models.CharField(max_length=96, blank=True)
..agent_host = models.CharField(max_length=384, blank=True)
..insert_time = models.DateTimeField(null=True, blank=True)
..# etc etc

..def __unicode__(self):
return self.insert_time.isoformat()

class Meta:
..db_table = u'collector'
..abstract = True

-- 
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 signal and instace..... HELP!!

2010-04-22 Thread Allen Machary
The MeasuredValue gets saved after the sample is saved,  Is there another way 
to still use the sample instance (or force it to save ), Cause the function ( 
to send msg )  to should be sent only when the sample is created..

Any help will be appriciated.

thnx greatlemer

-- 
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.



danjgo authentification

2010-04-22 Thread djangotom
Hello,

Being brand new to Django I'm trying to write an authentification
page.
I used the example from the Django book and tried it myself.
Unfortunatly Iit does not work.

--
My urls.py

from django.conf.urls.defaults import *
from fac import views

urlpatterns = patterns('',

(r'^welcome/$', views.welcome),
(r'^login/$', views.login),
(r'^test/$', views.test),
)
---

views.py

from django.shortcuts import render_to_response
from django.contrib import auth

def welcome(request):
return render_to_response('fac_login.html')

def login(request):
username = request.POST.get('username')
password = request.POST.get('password')
user = auth.authenticate(username=username, password=password)

if user is not None and user.is_active:
# Correct password, and the user is marked "active"
auth.login(request, user)
return HttpResponse("Password correct")

else:
return HttpResponse("Password incorrect or nothing
entered")



def test(request):
 return HttpResponse("Hello, world. This is the FAC test page.")


This is also the structure of the example.
In the fac_login.html is have my Form that takes a password and user
name.

---
fac_login.hml

{% extends "base.html" %}

{% block content %}

   {% if form.errors %}
  Sorry, that's not a valid username or password
   {% endif %}

  
  User name:
  
  Password:
  
  
  
{% endblock %}

-

When I now start the test server and type the the url login into my
browser
I always get an "Password incorrect"
but my login page with the usernam and password field is never shown.
but wghen i type welcome url to my browser I see the page and can
enter a
username and password but nothing happens when I click the login
button.

How do I tell django to call the fac_login page first. and then when I
click the login button it
executes the login view?

lg
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-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.



Good examples or references

2010-04-22 Thread andy saksena
Hi all,
I'm a newbie in Django and was wondering if there are any good
examples/referneces of Django driven websites. Also if there is a link
to make a website using django tutorial apart from the django-
documentation It will be really good to know.

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: Working for a startup.

2010-04-22 Thread Wander Nauta
I believe the article you were looking for is this one:

http://linux.slashdot.org/story/09/10/06/1742203/London-Stock-Exchange-Rejects-NET-For-Open-Source

It's about the London Stock Exchange, who ditched .NET for something
Linux-based.

Wander

On Apr 22, 7:40 am, "Joe Goldthwaite"  wrote:
> I've been working for a startup for a month or so.  The main guy is
> enthusiastic about technology.  He probably runs more applications on his
> computer than anyone I know.  He also switched from a Windows background to
> a Mac notebook a year ago.  He doesn't know a lot about web development or
> how it all works.  That's what I've been helping with.
>
> He's interviewed a number of companies trying to find a good one to develop
> version1 of the application.  I've been pushing him towards
> Linux/Python/Django and thought I had him convinced.  The company he's
> thinking about going with is a .net shop.  They say they can do anything but
> the bulk of their developers are .net.  Still, he was thinking about going
> with this company but still having them develop in Django.
>
> This morning we had a conference call with one of the references the
> development company provided.  It turns out they're a startup that's working
> on a different application in the same industry as us so there was an
> affinity there.  The guy mentioned that they originally started with a
> different company using Ruby on Rails.  He said that after the other company
> got bogged down and wasn't making progress, he switched to the new company
> that we're considering.  He said that they got the project back on track and
> organized but ended up running into lots of problems with Rails.  They
> talked it over and decided to rewrite everything in .net.  Now he's happy
> with the progress and feels like .net is a superior platform and is allowing
> him to develop his program at a lower total cost.
>
> This has my boss worried.  Most of the people he's been talking to are from
> large companies.  One of them was even a high end Microsoft person.  I think
> he's starting to think that the Microsoft technology stack might be the
> safer choice. He wants to get to the point of having millions of users and
> is worried that Django wont cut it. I'm also worried that if he does stick
> with Django, the development company might blame any setbacks on Django and
> push for a rewrite in .net.
>
> I'd like examples of large systems written in Django or other open source
> frameworks.  I'd also like stories about companies who tried .net switched
> over to open source.  It seems like there was a big Microsoft project on
> some stock exchange program that failed but I can't find any references to
> it.  I tried searching Google but it seems like it doesn't differentiate
> ".net" with the internet so trying to find .net failures only turned up
> stories about internet downtime.
>
> Any help would be greatly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.



Increase django page timeout

2010-04-22 Thread Florin
Hi!

I use pisa to generate large pdf files, but it gives opage timeout
when generating.
It waits a long time at the following line:
pdf = pisa.pisaDocument(StringIO(html.encode("UTF-8")), dest=buffer,
link_callback=fetch_resources)

As a workaround - is it possible to increase the page timeout to see
if it generates the pdf and how long it takes?

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: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
I think that would be a wrong approach.

I your case i would put this task in queue or kind of a back process.

For sure not on demand.

On Apr 22, 1:19 pm, Florin  wrote:
> Hi!
>
> I use pisa to generate large pdf files, but it gives opage timeout
> when generating.
> It waits a long time at the following line:
> pdf = pisa.pisaDocument(StringIO(html.encode("UTF-8")), dest=buffer,
> link_callback=fetch_resources)
>
> As a workaround - is it possible to increase the page timeout to see
> if it generates the pdf and how long it takes?
>
> 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 
> 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: Increase django page timeout

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 12:19 PM, Florin  wrote:
> Hi!
>
> I use pisa to generate large pdf files, but it gives opage timeout
> when generating.
> It waits a long time at the following line:
> pdf = pisa.pisaDocument(StringIO(html.encode("UTF-8")), dest=buffer,
> link_callback=fetch_resources)
>
> As a workaround - is it possible to increase the page timeout to see
> if it generates the pdf and how long it takes?
>
> Thanks!
>

Yes; it depends on how you are hosting your django app.

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-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: Good examples or references

2010-04-22 Thread Alexey Kostyuk
On Wed, 2010-04-21 at 23:31 -0700, andy saksena wrote:
> Hi all,
> I'm a newbie in Django and was wondering if there are any good
> examples/referneces of Django driven websites. Also if there is a link
> to make a website using django tutorial apart from the django-
> documentation It will be really good to know.
> 
> thanks
> 
Hi!
You can find useful links at Django Documentation project
http://docs.djangoproject.com/en/1.1/
Also you can read Django Book here - http://www.djangobook.com/


-- 
Alexey Kostyuk 

-- 
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: Increase django page timeout

2010-04-22 Thread Florin
My app is hosted on apache using mod_python.



On Apr 22, 2:30 pm, Tom Evans  wrote:
> On Thu, Apr 22, 2010 at 12:19 PM, Florin  wrote:
> > Hi!
>
> > I use pisa to generate large pdf files, but it gives opage timeout
> > when generating.
> > It waits a long time at the following line:
> > pdf = pisa.pisaDocument(StringIO(html.encode("UTF-8")), dest=buffer,
> > link_callback=fetch_resources)
>
> > As a workaround - is it possible to increase the page timeout to see
> > if it generates the pdf and how long it takes?
>
> > Thanks!
>
> Yes; it depends on how you are hosting your django app.
>
> 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-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: Working for a startup.

2010-04-22 Thread Dotan Cohen
On 22 April 2010 09:48, Wander Nauta  wrote:
> I believe the article you were looking for is this one:
>
> http://linux.slashdot.org/story/09/10/06/1742203/London-Stock-Exchange-Rejects-NET-For-Open-Source
>
> It's about the London Stock Exchange, who ditched .NET for something
> Linux-based.
>

The OP may want to pass on information from the Munich Linux project,
which shows just what a bear migration from a closed-source
environment can be.


-- 
Dotan Cohen

http://bido.com
http://what-is-what.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.



Re: Increase django page timeout

2010-04-22 Thread Florin
The desired functionality is for the user to choose a filter and based
on the results (Progress.objects.filter(...) to generate a pdf which
will be downloaded.
With a few hundreds results it works just fine, but when there are
thousands of results it gives timeout.

Thanks!


On Apr 22, 2:25 pm, "ge...@aquarianhouse.com"
 wrote:
> I think that would be a wrong approach.
>
> I your case i would put this task in queue or kind of a back process.
>
> For sure not on demand.
>
> On Apr 22, 1:19 pm, Florin  wrote:
>
>
>
> > Hi!
>
> > I use pisa to generate large pdf files, but it gives opage timeout
> > when generating.
> > It waits a long time at the following line:
> > pdf = pisa.pisaDocument(StringIO(html.encode("UTF-8")), dest=buffer,
> > link_callback=fetch_resources)
>
> > As a workaround - is it possible to increase the page timeout to see
> > if it generates the pdf and how long it takes?
>
> > 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 
> > 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: Increase django page timeout

2010-04-22 Thread Javier Guerra Giraldez
On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
 wrote:
> I your case i would put this task in queue or kind of a back process.

+1

Queues are the way to go.  in this case, i guess a "Ghetho Queue"
would be enough (just a DB table of 'pending tasks', a cron script
that processes them and a view that checks when it's done).  if it
eventually becomes necessary, migrating to a 'real' queue manager
(RabbitMQ, memcacheq, whatever) gets much easier.

-- 
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.



Display first name and last name for user in dropdown lists in the Admin

2010-04-22 Thread derek
This thread:
http://groups.google.com/group/django-users/browse_thread/thread/b303c1ce3e724407/d99ee36e031d7393
ends with the comment that "whatever string (actually unicode)
representation you want as constructed from the object attributes when
you bring an object via foreign key."

This is certainly true, and the example pointed to shows this:

class Choice(models.Model):
# ...
def __unicode__(self):
return self.choice

However, what does the equivalent code look like for the customizing
the built-in admin user (actually stored as "auth_user" in the
database), including the neccesary class statement line?

(Detailed issue:  I have been using UserProfile to customize the User
for my application.  However, all the links to the user in the other
models go direct to User and not UserProfile.  Ideally, I'd like the
dropdown list for users to show the information returned by this:

def __unicode__(self):
return u'%s,%s (%s)' % (self.last_name, self.first_name,
self.fieldX)

where "fieldX' is a field added in the UserProfile.  If someone can
show me the code to achieve this, it would be incredibly helpful...
and maybe I could learn something about users and profiles!)

Thanks
Derek

-- 
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: Increase django page timeout

2010-04-22 Thread Florin
Thanks for the tips.

Is there any alternative to pisa that can process large amount of data
to generate PDF files?


On Apr 22, 3:14 pm, Javier Guerra Giraldez  wrote:
> On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
>  wrote:
> > I your case i would put this task in queue or kind of a back process.
>
> +1
>
> Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> would be enough (just a DB table of 'pending tasks', a cron script
> that processes them and a view that checks when it's done).  if it
> eventually becomes necessary, migrating to a 'real' queue manager
> (RabbitMQ, memcacheq, whatever) gets much easier.
>
> --
> 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 
> 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: Display first name and last name for user in dropdown lists in the Admin

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 1:52 PM, derek  wrote:
> This thread:
> http://groups.google.com/group/django-users/browse_thread/thread/b303c1ce3e724407/d99ee36e031d7393
> ends with the comment that "whatever string (actually unicode)
> representation you want as constructed from the object attributes when
> you bring an object via foreign key."
>
> This is certainly true, and the example pointed to shows this:
>
> class Choice(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.choice
>
> However, what does the equivalent code look like for the customizing
> the built-in admin user (actually stored as "auth_user" in the
> database), including the neccesary class statement line?
>
> (Detailed issue:  I have been using UserProfile to customize the User
> for my application.  However, all the links to the user in the other
> models go direct to User and not UserProfile.  Ideally, I'd like the
> dropdown list for users to show the information returned by this:
>
>    def __unicode__(self):
>        return u'%s,%s (%s)' % (self.last_name, self.first_name,
> self.fieldX)
>
> where "fieldX' is a field added in the UserProfile.  If someone can
> show me the code to achieve this, it would be incredibly helpful...
> and maybe I could learn something about users and profiles!)
>
> Thanks
> Derek
>

http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Register a different ModelAdmin for the auth.User class, and define
the fields you wish to display. Note that you can pass a callable as a
field, and the callable will be called with the user instance, from
which you can generate whatever content you like, even from the
UserProfile.

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-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 raise integrity error in save method of model

2010-04-22 Thread Radhikavk

Model

class mdlcountry(models.Model):
class Meta:
verbose_name_plural = "Countries"
country_id = models.AutoField(primary_key=True,null=False,blank=False)
country_name =
models.CharField(max_length=100,unique=True,null=False,blank=False,verbose_name='Country
Name')
   
def save(self, *args, **kw): 
   super(mdlroomtypes, self).save(*args, **kw)

  
def __str__(self):
return self.country_name 


How to raise error if india country name alredy exists in database and again
the user is trying to insert india.

Regards
radhika
-- 
View this message in context: 
http://old.nabble.com/How-to-raise-integrity-error-in-save-method-of-model-tp28328713p28328713.html
Sent from the django-users mailing list archive at Nabble.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.



Re: coltrane sample at "practical django projects" book has a templates error

2010-04-22 Thread Rodrigo
could you post your urls.py ?

On Apr 21, 6:51 pm, xota  wrote:
> Or I do something bad, I was searching in google and some pepople have
> same/similar error without replies, can you help me, this is my error:
>
> Caught an exception while rendering: Reverse for
> 'coltrane_category_list' with arguments '()' and keyword arguments
> '{}' not found.
>
> If you need more info, please, ask me.
>
> Thanks,
> Álex González
>
> --
> 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 raise integrity error in save method of model

2010-04-22 Thread ge...@aquarianhouse.com
def save(self, *args, **kw):
if not
mdlcountry.objects.filter(country_name=self.country_name).exists():
super(mdlroomtypes, self).save(*args, **kw)
else:
#do something or do nothing
pass

On Apr 22, 3:14 pm, Radhikavk  wrote:
> Model
>
> class mdlcountry(models.Model):
>     class Meta:
>         verbose_name_plural = "Countries"        
>     country_id = models.AutoField(primary_key=True,null=False,blank=False)
>     country_name =
> models.CharField(max_length=100,unique=True,null=False,blank=False,verbose_name='Country
> Name')
>
>     def save(self, *args, **kw):
>        super(mdlroomtypes, self).save(*args, **kw)
>
>     def __str__(self):
>         return self.country_name
>
> How to raise error if india country name alredy exists in database and again
> the user is trying to insert india.
>
> Regards
> radhika
> --
> View this message in 
> context:http://old.nabble.com/How-to-raise-integrity-error-in-save-method-of-...
> Sent from the django-users mailing list archive at Nabble.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 
> 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: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
The question is: where is the bottleneck, to collect the data or to
generate the pdf???

On Apr 22, 2:54 pm, Florin  wrote:
> Thanks for the tips.
>
> Is there any alternative to pisa that can process large amount of data
> to generate PDF files?
>
> On Apr 22, 3:14 pm, Javier Guerra Giraldez  wrote:
>
>
>
> > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
> >  wrote:
> > > I your case i would put this task in queue or kind of a back process.
>
> > +1
>
> > Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> > would be enough (just a DB table of 'pending tasks', a cron script
> > that processes them and a view that checks when it's done).  if it
> > eventually becomes necessary, migrating to a 'real' queue manager
> > (RabbitMQ, memcacheq, whatever) gets much easier.
>
> > --
> > 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 
> > 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: How to raise integrity error in save method of model

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 2:22 PM, ge...@aquarianhouse.com
 wrote:
> def save(self, *args, **kw):
>    if not
> mdlcountry.objects.filter(country_name=self.country_name).exists():
>        super(mdlroomtypes, self).save(*args, **kw)
>    else:
>        #do something or do nothing
>        pass
>

Er, yeah, as long as you wish to do a lookup before you save any
record - seems a bit redundant to me when you can just mark the field
as unique in the database.

Your country field does already have unique in it - did you add that
*after* you had created the table (after you ran manage.py syncdb)?
Otherwise you would already have the behaviour you requested.

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-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: coltrane sample at "practical django projects" book has a templates error

2010-04-22 Thread Alexandre González
I was searching for the error in google and I solve it, I don't know if I
solve it at good way, but... It works :p

from django.conf.urls.defaults import *
from coltrane.models import Category

urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list', { 'queryset':
Category.objects.all() }, 'coltrane_category_list'), # I've added the last
thing: 'coltrane_category_list'
(r'^(?P[-\w]+)/$', 'coltrane.views.category_detail'),
)

Anyway thanks for your help! If I'm making any mistake please tell me.
Álex González

On Thu, Apr 22, 2010 at 15:22, Rodrigo  wrote:

> could you post your urls.py ?
>
> On Apr 21, 6:51 pm, xota  wrote:
> > Or I do something bad, I was searching in google and some pepople have
> > same/similar error without replies, can you help me, this is my error:
> >
> > Caught an exception while rendering: Reverse for
> > 'coltrane_category_list' with arguments '()' and keyword arguments
> > '{}' not found.
> >
> > If you need more info, please, ask me.
> >
> > Thanks,
> > Álex González
> >
> > --
> > 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.
>
>


-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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.



Re: How to raise integrity error in save method of model

2010-04-22 Thread Radhikavk

def save(self, *args, **kw):
if not
mdlcountry.objects.filter(country_name=self.country_name).exists():
super(mdlroomtypes, self).save(*args, **kw)
else:
#do something or do nothing
pass 


Here in else part how will i set error message that should display to the
user
-- 
View this message in context: 
http://old.nabble.com/How-to-raise-integrity-error-in-save-method-of-model-tp28328713p28328972.html
Sent from the django-users mailing list archive at Nabble.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.



Re: Good examples or references

2010-04-22 Thread Shawn Milochik
Is there any reason you specifically want references external to the official 
Django documentation? I think you will find that the official documentation is 
by far the best. Also, there are a bunch of re-usable apps shipped with Django 
that have working examples of the functionality you'll need. 

I think the best course of action is to read "The Definitive Guide to Django, 
Second Edition" cover to cover, even if you don't understand all of it. Then 
start work on your project. You'll find that the vast majority of the sticking 
points will not catch you up, because you'll know enough from the book to solve 
them with a simple search of the documentation. For the remaining questions, 
come to this helpful list. 

Nobody wants to be told to read -- much less an entire book. But that 
investment will be so valuable to you that I guarantee it's worth the time 
you'll spend. You will probably be able to answer a bunch of questions that 
come in on this list, asked by people who have used Django for much longer than 
you, if you have this foundation.

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-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: fastcgi path problems

2010-04-22 Thread Francis Gulotta
Just to update this problem a little more, I've opened a question on
serverfault with some additional information which I'll include here.

http://serverfault.com/questions/134863/nginx-fastcgi-problems-with-django

My manage.py fastcgi command.

> python manage.py runfcgi method=threaded host=127.0.0.1 port=8001 
> pidfile=mysite.pid minspare=4 maxspare=30 daemonize=false
>
>
And the versions
nginx version: nginx/0.7.62
Django svn trunk rev 13013

I realize that not everyone will have experience with my setup, but since
I've never had it actually work I'm not married to it. (I'm just working off
of the django advent article) I'd like to keep nginx, but I'd love to hear
about other people's setups that do work.

-Francis

---
Francis Gulotta
wiz...@roborooter.com


On Wed, Apr 21, 2010 at 5:45 PM, Francis Gulotta wrote:

> I'm deploying my first django app. I'm familiar with nginx and fastcgi's.
> Currently I get a 404 page regardless of the url and for some reason a
> double slash
> For http://www.site.com/admin/
>
> Page not found (404)
>
> Request Method: GET
>
> Request URL: http://www.site.com/admin//
>
>
>
> My urls.py from the debug output - which work in the dev server.
>
> Using the URLconf defined in ahrlty.urls, Django tried these URL patterns,
>> in this order:
>
> ^listings/
>
> ^admin/
>
> ^accounts/login/$
>
> ^accounts/logout/$
>
>
> my nginx config
>
> server {
>
>listen   80;
>
>server_name  beta.ahrlty.com;
>
>access_log  /home/ahrlty/ahrlty/logs/access.log;
>
>error_log  /home/ahrlty/ahrlty/logs/error.log;
>
>
>>location /static/ {
>
>alias  /home/ahrlty/ahrlty/ahrlty/static/;
>
>break;
>
>}
>
>
>>location /media/ {
>
>alias
>> /usr/lib/python2.6/dist-packages/django/contrib/admin/media/;
>
>break;
>
>}
>
>
>>location / {
>
>include /etc/nginx/fastcgi_params;
>
>fastcgi_pass 127.0.0.1:8001;
>
>break;
>
>}
>
> }
>
>
> and my fastcgi_params
>
> fastcgi_param  QUERY_STRING   $query_string;
>
> fastcgi_param  REQUEST_METHOD $request_method;
>
> fastcgi_param  CONTENT_TYPE   $content_type;
>
> fastcgi_param  CONTENT_LENGTH $content_length;
>
>
>> fastcgi_param  SCRIPT_NAME$fastcgi_script_name;
>
> fastcgi_param  REQUEST_URI$request_uri;
>
> fastcgi_param  DOCUMENT_URI   $document_uri;
>
> fastcgi_param  DOCUMENT_ROOT  $document_root;
>
> fastcgi_param  SERVER_PROTOCOL$server_protocol;
>
>
>> fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
>
> fastcgi_param  SERVER_SOFTWAREnginx/$nginx_version;
>
>
>> fastcgi_param  REMOTE_ADDR$remote_addr;
>
> fastcgi_param  REMOTE_PORT$remote_port;
>
> fastcgi_param  SERVER_ADDR$server_addr;
>
> fastcgi_param  SERVER_PORT$server_port;
>
> fastcgi_param  SERVER_NAME$server_name;
>
>
>> fastcgi_param  PATH_INFO  $fastcgi_script_name;
>
>
>> # PHP only, required if PHP was built with --enable-force-cgi-redirect
>
> fastcgi_param  REDIRECT_STATUS200;
>
>
> I'm having a hard time debugging this one. Does anything jump out at
> anybody?
>
> Thanks!
>
> -Francis
>
> ---
> Francis Gulotta
> wiz...@roborooter.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.



Re: How to raise integrity error in save method of model

2010-04-22 Thread Radhikavk

i have defined the country field unique in database but when i try to insert
duplicate entry it throws an error , to handle that error i m asking
-- 
View this message in context: 
http://old.nabble.com/How-to-raise-integrity-error-in-save-method-of-model-tp28328713p28329111.html
Sent from the django-users mailing list archive at Nabble.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.



Re: Working for a startup.

2010-04-22 Thread thanos
Until 1998 NYSE only allowed applications developed in C++ on their
trading floor. Both the client and server side technology was HP Unix.
They switched in around 2004 to Linux. They use a custom built
database and messaging system. In 1998 we launched a new trading
system based on Python. It did not fail but was a great success and is
still in use to day. The speed in which Python apps could be developed
and deployed impressed management and it became the second De Facto
development language of NYSE.
 In 2001 there was a very large scale Java project that failed and had
to be pulled off the floor, but this is was not due to the language
but due to the poor design (The project had been outsourced to a big
company). A year later the re-factored (in house) system was launched
with success.

NYSE floor is linux based, so C# doesn't come into the picture. Why
unix and windows: Four really good reasons:

1. It scales.
2. It's a lot cheaper.
3. Its much cleaner and easier to program for. Also its easier to
deploy on. (Remember all the DLL issues C# developer  have).
5. Power and Energy- ??? - Yes the NYSE floor has a limit to its
energy supply. With Linux you just  get a lot more bang per Wat.

The standard of software developer for the NYSE floor are very high.
In the years I worked their I remember only a handful of program
failure in production and they were all fixed in minutes. Downtime of
a system was just to accepted, and NYSE's operation was more stringent
than NASA or the USAF. In fact i remember generals coming on tours to
see how we did it.
Of course all this control and extensive design documentation  was
stiffing, but using languages like Python helped.

Finally just recently SEC announced that they might require regulatory
files to be submitted in Python and not in legal English.
Their rational is that Python is less ambigious and the English and
more clean, readable  and structured than XML. (http://www.sec.gov/
rules/proposed/2010/33-9117.pdf).

Thanos










On Apr 22, 1:40 am, "Joe Goldthwaite"  wrote:
> I've been working for a startup for a month or so.  The main guy is
> enthusiastic about technology.  He probably runs more applications on his
> computer than anyone I know.  He also switched from a Windows background to
> a Mac notebook a year ago.  He doesn't know a lot about web development or
> how it all works.  That's what I've been helping with.
>
> He's interviewed a number of companies trying to find a good one to develop
> version1 of the application.  I've been pushing him towards
> Linux/Python/Django and thought I had him convinced.  The company he's
> thinking about going with is a .net shop.  They say they can do anything but
> the bulk of their developers are .net.  Still, he was thinking about going
> with this company but still having them develop in Django.
>
> This morning we had a conference call with one of the references the
> development company provided.  It turns out they're a startup that's working
> on a different application in the same industry as us so there was an
> affinity there.  The guy mentioned that they originally started with a
> different company using Ruby on Rails.  He said that after the other company
> got bogged down and wasn't making progress, he switched to the new company
> that we're considering.  He said that they got the project back on track and
> organized but ended up running into lots of problems with Rails.  They
> talked it over and decided to rewrite everything in .net.  Now he's happy
> with the progress and feels like .net is a superior platform and is allowing
> him to develop his program at a lower total cost.
>
> This has my boss worried.  Most of the people he's been talking to are from
> large companies.  One of them was even a high end Microsoft person.  I think
> he's starting to think that the Microsoft technology stack might be the
> safer choice. He wants to get to the point of having millions of users and
> is worried that Django wont cut it. I'm also worried that if he does stick
> with Django, the development company might blame any setbacks on Django and
> push for a rewrite in .net.
>
> I'd like examples of large systems written in Django or other open source
> frameworks.  I'd also like stories about companies who tried .net switched
> over to open source.  It seems like there was a big Microsoft project on
> some stock exchange program that failed but I can't find any references to
> it.  I tried searching Google but it seems like it doesn't differentiate
> ".net" with the internet so trying to find .net failures only turned up
> stories about internet downtime.
>
> Any help would be greatly appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> ath

Re: danjgo authentification

2010-04-22 Thread Shawn Milochik
Everything you need is here:

http://docs.djangoproject.com/en/1.1/topics/auth/#authentication-in-web-requests

This will tell you exactly, in detail, how to create your own login page to tie 
into the built-in authentication.

Also, (sorry, couldn't resist), it's spelled "authentication."

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-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 raise integrity error in save method of model

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 2:45 PM, Radhikavk  wrote:
>
> i have defined the country field unique in database but when i try to insert
> duplicate entry it throws an error , to handle that error i m asking

In your view:

try:
  instance.save()
except IntegrityError, e:
  return HttpResponse("I'm sorry, Dave. I'm afraid I can't do that")

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-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: Increase django page timeout

2010-04-22 Thread Florin
The data is collected quickly. I generate a html with pagination to
preview the results.
If I trace the steps, I can see that the process hangs after the data
is collected, at the line that calls the pisa.pisaDocument method to
generate the pdf and write the generated bits in a buffer, which
should then be sent to response.
So the bottleneck is at pdf generation step.



On Apr 22, 4:25 pm, "ge...@aquarianhouse.com"
 wrote:
> The question is: where is the bottleneck, to collect the data or to
> generate the pdf???
>
> On Apr 22, 2:54 pm, Florin  wrote:
>
>
>
> > Thanks for the tips.
>
> > Is there any alternative to pisa that can process large amount of data
> > to generate PDF files?
>
> > On Apr 22, 3:14 pm, Javier Guerra Giraldez  wrote:
>
> > > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
> > >  wrote:
> > > > I your case i would put this task in queue or kind of a back process.
>
> > > +1
>
> > > Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> > > would be enough (just a DB table of 'pending tasks', a cron script
> > > that processes them and a view that checks when it's done).  if it
> > > eventually becomes necessary, migrating to a 'real' queue manager
> > > (RabbitMQ, memcacheq, whatever) gets much easier.
>
> > > --
> > > 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 
> > > 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 
> 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: Working for a startup.

2010-04-22 Thread Brendan Smith
whoa...  that's some really interesting stuff right there...  thanks for
that insight Thanos

On Thu, Apr 22, 2010 at 9:45 AM, thanos  wrote:

> Until 1998 NYSE only allowed applications developed in C++ on their
> trading floor. Both the client and server side technology was HP Unix.
> They switched in around 2004 to Linux. They use a custom built
> database and messaging system. In 1998 we launched a new trading
> system based on Python. It did not fail but was a great success and is
> still in use to day. The speed in which Python apps could be developed
> and deployed impressed management and it became the second De Facto
> development language of NYSE.
>  In 2001 there was a very large scale Java project that failed and had
> to be pulled off the floor, but this is was not due to the language
> but due to the poor design (The project had been outsourced to a big
> company). A year later the re-factored (in house) system was launched
> with success.
>
> NYSE floor is linux based, so C# doesn't come into the picture. Why
> unix and windows: Four really good reasons:
>
> 1. It scales.
> 2. It's a lot cheaper.
> 3. Its much cleaner and easier to program for. Also its easier to
> deploy on. (Remember all the DLL issues C# developer  have).
> 5. Power and Energy- ??? - Yes the NYSE floor has a limit to its
> energy supply. With Linux you just  get a lot more bang per Wat.
>
> The standard of software developer for the NYSE floor are very high.
> In the years I worked their I remember only a handful of program
> failure in production and they were all fixed in minutes. Downtime of
> a system was just to accepted, and NYSE's operation was more stringent
> than NASA or the USAF. In fact i remember generals coming on tours to
> see how we did it.
> Of course all this control and extensive design documentation  was
> stiffing, but using languages like Python helped.
>
> Finally just recently SEC announced that they might require regulatory
> files to be submitted in Python and not in legal English.
> Their rational is that Python is less ambigious and the English and
> more clean, readable  and structured than XML. (http://www.sec.gov/
> rules/proposed/2010/33-9117.pdf
> ).
>
> Thanos
>
>
>
>
>
>
>
>
>
>
> On Apr 22, 1:40 am, "Joe Goldthwaite"  wrote:
> > I've been working for a startup for a month or so.  The main guy is
> > enthusiastic about technology.  He probably runs more applications on his
> > computer than anyone I know.  He also switched from a Windows background
> to
> > a Mac notebook a year ago.  He doesn't know a lot about web development
> or
> > how it all works.  That's what I've been helping with.
> >
> > He's interviewed a number of companies trying to find a good one to
> develop
> > version1 of the application.  I've been pushing him towards
> > Linux/Python/Django and thought I had him convinced.  The company he's
> > thinking about going with is a .net shop.  They say they can do anything
> but
> > the bulk of their developers are .net.  Still, he was thinking about
> going
> > with this company but still having them develop in Django.
> >
> > This morning we had a conference call with one of the references the
> > development company provided.  It turns out they're a startup that's
> working
> > on a different application in the same industry as us so there was an
> > affinity there.  The guy mentioned that they originally started with a
> > different company using Ruby on Rails.  He said that after the other
> company
> > got bogged down and wasn't making progress, he switched to the new
> company
> > that we're considering.  He said that they got the project back on track
> and
> > organized but ended up running into lots of problems with Rails.  They
> > talked it over and decided to rewrite everything in .net.  Now he's happy
> > with the progress and feels like .net is a superior platform and is
> allowing
> > him to develop his program at a lower total cost.
> >
> > This has my boss worried.  Most of the people he's been talking to are
> from
> > large companies.  One of them was even a high end Microsoft person.  I
> think
> > he's starting to think that the Microsoft technology stack might be the
> > safer choice. He wants to get to the point of having millions of users
> and
> > is worried that Django wont cut it. I'm also worried that if he does
> stick
> > with Django, the development company might blame any setbacks on Django
> and
> > push for a rewrite in .net.
> >
> > I'd like examples of large systems written in Django or other open source
> > frameworks.  I'd also like stories about companies who tried .net
> switched
> > over to open source.  It seems like there was a big Microsoft project on
> > some stock exchange program that failed but I can't find any references
> to
> > it.  I tried searching Google but it seems like it doesn't differentiate
> > ".net" with the internet so trying to find .net failures only tur

Re: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
we say the whole thing takes 60 sec., how many sec. does it take to
collect and how many to render?

On Apr 22, 3:54 pm, Florin  wrote:
> The data is collected quickly. I generate a html with pagination to
> preview the results.
> If I trace the steps, I can see that the process hangs after the data
> is collected, at the line that calls the pisa.pisaDocument method to
> generate the pdf and write the generated bits in a buffer, which
> should then be sent to response.
> So the bottleneck is at pdf generation step.
>
> On Apr 22, 4:25 pm, "ge...@aquarianhouse.com"
>
>
>
>  wrote:
> > The question is: where is the bottleneck, to collect the data or to
> > generate the pdf???
>
> > On Apr 22, 2:54 pm, Florin  wrote:
>
> > > Thanks for the tips.
>
> > > Is there any alternative to pisa that can process large amount of data
> > > to generate PDF files?
>
> > > On Apr 22, 3:14 pm, Javier Guerra Giraldez  wrote:
>
> > > > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
> > > >  wrote:
> > > > > I your case i would put this task in queue or kind of a back process.
>
> > > > +1
>
> > > > Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> > > > would be enough (just a DB table of 'pending tasks', a cron script
> > > > that processes them and a view that checks when it's done).  if it
> > > > eventually becomes necessary, migrating to a 'real' queue manager
> > > > (RabbitMQ, memcacheq, whatever) gets much easier.
>
> > > > --
> > > > 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 
> > > > 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 
> > 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: Working for a startup.

2010-04-22 Thread Nick Arnett
On Thu, Apr 22, 2010 at 6:45 AM, thanos  wrote:
>
>
>
> Finally just recently SEC announced that they might require regulatory
> files to be submitted in Python and not in legal English.
> Their rational is that Python is less ambigious and the English and
> more clean, readable  and structured than XML. (http://www.sec.gov/
> rules/proposed/2010/33-9117.pdf
> ).
>
>
I couldn't quite believe that when I read it, but there it is, right on the
SEC web site.  And not dated April 1st, either.

And for those who don't want to download the link, Python would just be used
to define formulas; the idea is that investors could run the code rather
than having to implement algorithms from a text description.

Any idea why they chose Python?  I imagine it is because it is compact and
easy to read, but I'd be curious what attracted them.

There's a snake oil joke in there somewhere.

Nick

-- 
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: Increase django page timeout

2010-04-22 Thread Florin
It takes about 10 sec to generate the data, but when calling
pisaDocument with the generated data it hangs and after a while it
gives timeout.



On Apr 22, 4:59 pm, "ge...@aquarianhouse.com"
 wrote:
> we say the whole thing takes 60 sec., how many sec. does it take to
> collect and how many to render?
>
> On Apr 22, 3:54 pm, Florin  wrote:
>
>
>
> > The data is collected quickly. I generate a html with pagination to
> > preview the results.
> > If I trace the steps, I can see that the process hangs after the data
> > is collected, at the line that calls the pisa.pisaDocument method to
> > generate the pdf and write the generated bits in a buffer, which
> > should then be sent to response.
> > So the bottleneck is at pdf generation step.
>
> > On Apr 22, 4:25 pm, "ge...@aquarianhouse.com"
>
> >  wrote:
> > > The question is: where is the bottleneck, to collect the data or to
> > > generate the pdf???
>
> > > On Apr 22, 2:54 pm, Florin  wrote:
>
> > > > Thanks for the tips.
>
> > > > Is there any alternative to pisa that can process large amount of data
> > > > to generate PDF files?
>
> > > > On Apr 22, 3:14 pm, Javier Guerra Giraldez  wrote:
>
> > > > > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
> > > > >  wrote:
> > > > > > I your case i would put this task in queue or kind of a back 
> > > > > > process.
>
> > > > > +1
>
> > > > > Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> > > > > would be enough (just a DB table of 'pending tasks', a cron script
> > > > > that processes them and a view that checks when it's done).  if it
> > > > > eventually becomes necessary, migrating to a 'real' queue manager
> > > > > (RabbitMQ, memcacheq, whatever) gets much easier.
>
> > > > > --
> > > > > 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 
> > > > > 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 
> > > 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 
> 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: Display first name and last name for user in dropdown lists in the Admin

2010-04-22 Thread derek
On Apr 22, 3:03 pm, Tom Evans  wrote:
> On Thu, Apr 22, 2010 at 1:52 PM, derek  wrote:
> > This thread:
> >http://groups.google.com/group/django-users/browse_thread/thread/b303...
> > ends with the comment that "whatever string (actually unicode)
> > representation you want as constructed from the object attributes when
> > you bring an object via foreign key."
>
> > This is certainly true, and the example pointed to shows this:
>
> > class Choice(models.Model):
> >    # ...
> >    def __unicode__(self):
> >        return self.choice
>
> > However, what does the equivalent code look like for the customizing
> > the built-in admin user (actually stored as "auth_user" in the
> > database), including the neccesary class statement line?
>
> > (Detailed issue:  I have been using UserProfile to customize the User
> > for my application.  However, all the links to the user in the other
> > models go direct to User and not UserProfile.  Ideally, I'd like the
> > dropdown list for users to show the information returned by this:
>
> >    def __unicode__(self):
> >        return u'%s,%s (%s)' % (self.last_name, self.first_name,
> > self.fieldX)
>
> > where "fieldX' is a field added in the UserProfile.  If someone can
> > show me the code to achieve this, it would be incredibly helpful...
> > and maybe I could learn something about users and profiles!)
>
> > Thanks
> > Derek
>
> http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#django.contri...
>
> Register a different ModelAdmin for the auth.User class, and define
> the fields you wish to display. Note that you can pass a callable as a
> field, and the callable will be called with the user instance, from
> which you can generate whatever content you like, even from the
> UserProfile.
>
> Cheers
>
> Tom

Thanks Tom

I had thought I understood these concepts, but cannot see how to apply
them to the User specifically.  That is why specific examples of code
always help (apart from the ones in the manual).

What would the code for "Register a different ModelAdmin for the
auth.User class" look like?

And can you expand further on this : "you can pass a callable as a
field, and the callable will be called with the user instance, from
which you can generate whatever content you like, even from the
UserProfile."  How would this be represented in code form?

(I appreciate I may seem obtuse here, but for some reason I can't
grasp these aspects of Django although everything else about it has
made perfect sense up to now.)

Thanks
Derek

-- 
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 raise integrity error in save method of model

2010-04-22 Thread ge...@aquarianhouse.com
In this case it's the wrong place, you have to put the logic into the
form

class MyForm(models.ModelForm):
model = mdlcountry

   def country_name(self):
  #verify here and give an error

On Apr 22, 3:51 pm, Tom Evans  wrote:
> On Thu, Apr 22, 2010 at 2:45 PM, Radhikavk  wrote:
>
> > i have defined the country field unique in database but when i try to insert
> > duplicate entry it throws an error , to handle that error i m asking
>
> In your view:
>
> try:
>   instance.save()
> except IntegrityError, e:
>   return HttpResponse("I'm sorry, Dave. I'm afraid I can't do that")
>
> 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-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: Increase django page timeout

2010-04-22 Thread ge...@aquarianhouse.com
are you collect the data from the telephone book? :)

kidding, the only right way is to render it in the background.

i dont't think you can render it faster, only with better hardware.

On Apr 22, 4:10 pm, Florin  wrote:
> It takes about 10 sec to generate the data, but when calling
> pisaDocument with the generated data it hangs and after a while it
> gives timeout.
>
> On Apr 22, 4:59 pm, "ge...@aquarianhouse.com"
>
>
>
>  wrote:
> > we say the whole thing takes 60 sec., how many sec. does it take to
> > collect and how many to render?
>
> > On Apr 22, 3:54 pm, Florin  wrote:
>
> > > The data is collected quickly. I generate a html with pagination to
> > > preview the results.
> > > If I trace the steps, I can see that the process hangs after the data
> > > is collected, at the line that calls the pisa.pisaDocument method to
> > > generate the pdf and write the generated bits in a buffer, which
> > > should then be sent to response.
> > > So the bottleneck is at pdf generation step.
>
> > > On Apr 22, 4:25 pm, "ge...@aquarianhouse.com"
>
> > >  wrote:
> > > > The question is: where is the bottleneck, to collect the data or to
> > > > generate the pdf???
>
> > > > On Apr 22, 2:54 pm, Florin  wrote:
>
> > > > > Thanks for the tips.
>
> > > > > Is there any alternative to pisa that can process large amount of data
> > > > > to generate PDF files?
>
> > > > > On Apr 22, 3:14 pm, Javier Guerra Giraldez  wrote:
>
> > > > > > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
> > > > > >  wrote:
> > > > > > > I your case i would put this task in queue or kind of a back 
> > > > > > > process.
>
> > > > > > +1
>
> > > > > > Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> > > > > > would be enough (just a DB table of 'pending tasks', a cron script
> > > > > > that processes them and a view that checks when it's done).  if it
> > > > > > eventually becomes necessary, migrating to a 'real' queue manager
> > > > > > (RabbitMQ, memcacheq, whatever) gets much easier.
>
> > > > > > --
> > > > > > 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 
> > > > > > 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 
> > > > 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 
> > 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.



Looking to hire Django developers in Pleasantville NY

2010-04-22 Thread Steve Bywater
Hopefully it's ok to post job openings here...

The team that brought you HudsonValleyHelpWanted.com and 300+ other
job boards around the US and Canada and Cupid.com (and then sold it
all... yes those were options you wished you were in on) has started a
new project: 10LocalCoupons.com!

We're looking for an experienced Django developer (or two) to join our
growing tech team. This is your chance to be in on the ground floor;
yes, there will be a stock option plan here too. This is a full time
job, not contract work.

Please send a resume and a list of Django web sites that you've
developed to django-j...@strausdigital.com. Sorry, we'll only reply to
qualified applicants.

-- 
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: Increase django page timeout

2010-04-22 Thread Florin
It's some statistical data collected about the users of my
application. (Anyway good joke :)
Even with better hardware it's the same. I installed the app on one of
company's ubuntu servers but it also gives "Read Timeout" error...
Maybe a solution would be to put more filters so the data won't be
that large and so it would eventually generate the pdf.

Thanks a lot for your time!


On Apr 22, 5:18 pm, "ge...@aquarianhouse.com"
 wrote:
> are you collect the data from the telephone book? :)
>
> kidding, the only right way is to render it in the background.
>
> i dont't think you can render it faster, only with better hardware.
>
> On Apr 22, 4:10 pm, Florin  wrote:
>
>
>
> > It takes about 10 sec to generate the data, but when calling
> > pisaDocument with the generated data it hangs and after a while it
> > gives timeout.
>
> > On Apr 22, 4:59 pm, "ge...@aquarianhouse.com"
>
> >  wrote:
> > > we say the whole thing takes 60 sec., how many sec. does it take to
> > > collect and how many to render?
>
> > > On Apr 22, 3:54 pm, Florin  wrote:
>
> > > > The data is collected quickly. I generate a html with pagination to
> > > > preview the results.
> > > > If I trace the steps, I can see that the process hangs after the data
> > > > is collected, at the line that calls the pisa.pisaDocument method to
> > > > generate the pdf and write the generated bits in a buffer, which
> > > > should then be sent to response.
> > > > So the bottleneck is at pdf generation step.
>
> > > > On Apr 22, 4:25 pm, "ge...@aquarianhouse.com"
>
> > > >  wrote:
> > > > > The question is: where is the bottleneck, to collect the data or to
> > > > > generate the pdf???
>
> > > > > On Apr 22, 2:54 pm, Florin  wrote:
>
> > > > > > Thanks for the tips.
>
> > > > > > Is there any alternative to pisa that can process large amount of 
> > > > > > data
> > > > > > to generate PDF files?
>
> > > > > > On Apr 22, 3:14 pm, Javier Guerra Giraldez  
> > > > > > wrote:
>
> > > > > > > On Thu, Apr 22, 2010 at 6:25 AM, ge...@aquarianhouse.com
>
> > > > > > >  wrote:
> > > > > > > > I your case i would put this task in queue or kind of a back 
> > > > > > > > process.
>
> > > > > > > +1
>
> > > > > > > Queues are the way to go.  in this case, i guess a "Ghetho Queue"
> > > > > > > would be enough (just a DB table of 'pending tasks', a cron script
> > > > > > > that processes them and a view that checks when it's done).  if it
> > > > > > > eventually becomes necessary, migrating to a 'real' queue manager
> > > > > > > (RabbitMQ, memcacheq, whatever) gets much easier.
>
> > > > > > > --
> > > > > > > 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 
> > > > > > > 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 
> > > > > 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 
> > > 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 t

Re: Working for a startup.

2010-04-22 Thread Kenneth Loafman
Joe Goldthwaite wrote:
> I’ve been working for a startup for a month or so.  The main guy is
> enthusiastic about technology.  He probably runs more applications on
> his computer than anyone I know.  He also switched from a Windows
> background to a Mac notebook a year ago.  He doesn’t know a lot about
> web development or how it all works.  That’s what I’ve been helping with.
> 
>  
> 
> He’s interviewed a number of companies trying to find a good one to
> develop version1 of the application.  I’ve been pushing him towards
> Linux/Python/Django and thought I had him convinced.  The company he’s
> thinking about going with is a .net shop.  They say they can do anything
> but the bulk of their developers are .net.  Still, he was thinking about
> going with this company but still having them develop in Django.
> 
>  
> 
> This morning we had a conference call with one of the references the
> development company provided.  It turns out they’re a startup that’s
> working on a different application in the same industry as us so there
> was an affinity there.  The guy mentioned that they originally started
> with a different company using Ruby on Rails.  He said that after the
> other company got bogged down and wasn’t making progress, he switched to
> the new company that we’re considering.  He said that they got the
> project back on track and organized but ended up running into lots of
> problems with Rails.  They talked it over and decided to rewrite
> everything in .net.  Now he’s happy with the progress and feels like
> .net is a superior platform and is allowing him to develop his program
> at a lower total cost.
> 
>  
> 
> This has my boss worried.  Most of the people he’s been talking to are
> from large companies.  One of them was even a high end Microsoft
> person.  I think he’s starting to think that the Microsoft technology
> stack might be the safer choice. He wants to get to the point of having
> millions of users and is worried that Django wont cut it. I’m also
> worried that if he does stick with Django, the development company might
> blame any setbacks on Django and push for a rewrite in .net.

I also work for a startup company and we are firmly entrenched in Linux,
Django, Postgress, and other FOSS products.  We could not afford to go
any other route.

When someone asks about FOSS vs proprietary, my first question is:
"Would Google be here at all if it had to pay MS license fees?".

And the answer is NO.

If you are doing web based software-as-a-service, you can serve data to
any OS out there from Linux, Mac, pocket calculators, anything.  The
data does not care, and the customer does not care how you got the data
as long as it suits his needs.  There's nothing magic about Windows, and
.NET is a lock-in trap that guarantees you'll stay with Windows,
regardless of what the Mono guys say.

...Ken

-- 
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: Display first name and last name for user in dropdown lists in the Admin

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 3:13 PM, derek  wrote:
> Thanks Tom
>
> I had thought I understood these concepts, but cannot see how to apply
> them to the User specifically.  That is why specific examples of code
> always help (apart from the ones in the manual).
>
> What would the code for "Register a different ModelAdmin for the
> auth.User class" look like?

Something like this:

from django.contrib.auth.models import User
admin.site.unregister(User)
admin.site.register(User, ReplacementUserAdmin)


>
> And can you expand further on this : "you can pass a callable as a
> field, and the callable will be called with the user instance, from
> which you can generate whatever content you like, even from the
> UserProfile."  How would this be represented in code form?
>

Like so:

def some_func(obj):
  return u"%s %s" % (obj.email, obj.get_profile().telephone)

class ReplacementUserAdmin(admin.ModelAdmin):
  list_display = (some_func, 'email')

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-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.



Retrieving an ID from a posted form

2010-04-22 Thread Nick
I am working on a form process with multiple levels of submission. The
first is a front facing form with a general set of questions that are
to be followed up by someone after the form is submitted (the form
submits and entry to the DB).  To cut down on the amount of hunting
that those who will be reviewing the forms have to do I'd like to be
able to retrieve the ID for the newly created DB entry and attach it
to a url that points directly to that entry in the django admin.

I have the email logic set up so that the form submits all of the
information via email to an individual. In the email is the link to
the admin. So far it just goes to a full list of entries:

ex. http://mydjango.site.com/admin/projects/app/model_name/ID

I can easily send everything up to the ID. How do i retrieve the ID
from the submitted form. Since this is adding an entry to the DB it
has to be creating an ID somewhere.  Here is my view:

def short_form(request):
if request.method == 'POST':
form = ArtistFormFinal(request.POST, request.FILES)
if form.is_valid():
name = form.cleaned_data['name']
year_created = form.cleaned_data['year_created']
home_city = form.cleaned_data['home_city']
home_state = form.cleaned_data['home_state']
genre = form.cleaned_data['genre']
email_address = form.cleaned_data['email_address']
phone_number = form.cleaned_data['phone_number']
website = form.cleaned_data['website']
audio = form.cleaned_data['audio_file']
subject = 'Static artists submission from %s' % (name)
message = render_to_string('static/short_email.txt', {
'name': name,
'year_created': year_created,
'home_city': home_city,
'genre': genre,
'home_state': home_state,
'email_address': email_address,
'phone_number': phone_number,
'website': website,
'audio': audio
})
recipients = ['ntankers...@opubco.com',
'crobi...@opubco.com']
send_mail(subject, message, email_address, recipients,
fail_silently=False)
form.save()
return HttpResponseRedirect('thanks')
else:
form = ArtistFormFinal()
return render_to_response('static/artist_short.html',
{'form':form})

-- 
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: Increase django page timeout

2010-04-22 Thread Javier Guerra Giraldez
On Thu, Apr 22, 2010 at 9:26 AM, Florin  wrote:
> Maybe a solution would be to put more filters so the data won't be
> that large and so it would eventually generate the pdf.

no, the solution is to put all the heavy work _out_ of the
request/response cycle.  just add the parameters (not the data) to an
entry in a work queue and return with a redirect to another page that
shows the task state and refreshes every few seconds (or poll with
AJAX).  meanwhile, a background daemon picks the task from the queue,
and starts processing.  if possible, make it write some progress info
to the task entry, so the user can see it progressing.  when it's
finished, the status page sees the task as  'done' and redirects to
the PDF download url.

-- 
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: danjgo authentification

2010-04-22 Thread Benedict Verheyen

On 22/04/2010 15:46, Shawn Milochik wrote:

Everything you need is here:

http://docs.djangoproject.com/en/1.1/topics/auth/#authentication-in-web-requests

This will tell you exactly, in detail, how to create your own login page to tie 
into the built-in authentication.

Also, 
(sorry, couldn't resist), it's spelled "authentication."

Shawn


If you really want to nitpick, spelling django as danjgo is worse in my opinion
than spelling authentication as authentification :)

Anyway, Shawn is right, the docs he referred to are quite helpful in dealing 
with authentication.

Regards,
Benedict

--
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: Retrieving an ID from a posted form

2010-04-22 Thread Ian Lewis
Nick,

Because you won't get an id for your newly created object before you
save it you'll need to send the email after you save the form. I'm
assuming that ArtistFormFinal is a ModelForm but you can get the id
using something like the following:

myobj = form.save()
send_mail(subject, "Your id is %d!" % myobj.id, email_address, recipients)

I hope that's what you were looking for.

Ian

On Thu, Apr 22, 2010 at 11:39 PM, Nick  wrote:
> I am working on a form process with multiple levels of submission. The
> first is a front facing form with a general set of questions that are
> to be followed up by someone after the form is submitted (the form
> submits and entry to the DB).  To cut down on the amount of hunting
> that those who will be reviewing the forms have to do I'd like to be
> able to retrieve the ID for the newly created DB entry and attach it
> to a url that points directly to that entry in the django admin.
>
> I have the email logic set up so that the form submits all of the
> information via email to an individual. In the email is the link to
> the admin. So far it just goes to a full list of entries:
>
> ex. http://mydjango.site.com/admin/projects/app/model_name/ID
>
> I can easily send everything up to the ID. How do i retrieve the ID
> from the submitted form. Since this is adding an entry to the DB it
> has to be creating an ID somewhere.  Here is my view:
>
> def short_form(request):
>if request.method == 'POST':
>form = ArtistFormFinal(request.POST, request.FILES)
>if form.is_valid():
>name = form.cleaned_data['name']
>year_created = form.cleaned_data['year_created']
>home_city = form.cleaned_data['home_city']
>home_state = form.cleaned_data['home_state']
>genre = form.cleaned_data['genre']
>email_address = form.cleaned_data['email_address']
>phone_number = form.cleaned_data['phone_number']
>website = form.cleaned_data['website']
>audio = form.cleaned_data['audio_file']
>subject = 'Static artists submission from %s' % (name)
>message = render_to_string('static/short_email.txt', {
>'name': name,
>'year_created': year_created,
>'home_city': home_city,
>'genre': genre,
>'home_state': home_state,
>'email_address': email_address,
>'phone_number': phone_number,
>'website': website,
>'audio': audio
>})
>recipients = ['ntankers...@opubco.com',
> 'crobi...@opubco.com']
>send_mail(subject, message, email_address, recipients,
> fail_silently=False)
>form.save()
>return HttpResponseRedirect('thanks')
>else:
>form = ArtistFormFinal()
>return render_to_response('static/artist_short.html',
> {'form':form})
>
> --
> 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.
>
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
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: Display first name and last name for user in dropdown lists in the Admin

2010-04-22 Thread brad
This thread has prompted me to blog about my solution to this
problem.  Here's how I've done this:

1) I created a UserModelChoiceField(ModelChoiceField) class whose
label_from_instance method returns a string containing the User's full
name (and username in parenthesis)
2) Create a ModelForm for the Model containing the FK to User. In this
form, use the UserModelChoiceField to override the FK attribute.
3) In the ModelAdmin class, set a form attribute that points to the
above ModelForm.

More detail (and some samples) are available here:
http://bradmontgomery.blogspot.com/2010/04/pretty-options-for-djangos-authuser.html

There's probably a simpler way, but I've been using this method for
about a year in some production code.

-- 
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 dispatch with name argument throws syntax error

2010-04-22 Thread vjimw
Adding the name argument seems pretty straight forward, but I must be
doing something wrong. I am writing tests and have the URLs named
seems like the easiest way to look them up.

My URL dispatch file was working before I added any of the name='this-
name' arguments.

Here is my file:

from django.conf.urls.defaults import *

urlpatterns = patterns('ukca_admin.coupon.mailer_views',
  (r'^notify/(?P\w+)?/?(?P[\w\-]+)?/?(?
P\w+)?/?(?P\w+)?/?$', 'notify_account_manager',
name='notify-account-manager'),
  (r'^build/(?P\d+)?/(?P\w+)?/?(?
P[\w\-]+)?/?(?P\w+)?/?(?P\w+)?/?(?P\w+)?/?
$', 'mailer_index', name='mailer-index'),
  (r'^rebuild/offers/(?P\w+)?/?(?P[\w
\-]+)?/?(?P\w+)?/?(?P\w+)?/?(?P\w+)?/?$',
'rebuild_offers', name='rebuild-offers'),
  (r'^rebuild/recipients/(?P\w+)?/?(?
P[\w\-]+)?/?(?P\w+)?/?(?P\w+)?/?(?P\w+)?/?
$', 'rebuild_recipients', name='rebuild-recipients'),

)


And here is the error I get:

SyntaxError at /mailer/

('invalid syntax', ('/var/www/ccadmin/ukca_admin/../ukca_admin/coupon/
mailer_urls.py', 4, 139, "  (r'^notify/(?P\\w
+)?/?(?P[\\w\\-]+)?/?(?P\\w+)?/?(?P\\w+)?/?$',
'notify_account_manager', name='notify-account-manager'),\n"))

Request Method: GET
Request URL:http://ccadmin.jt.ccbn.net/mailer/
Exception Type: SyntaxError
Exception Value:

('invalid syntax', ('/var/www/ccadmin/ukca_admin/../ukca_admin/coupon/
mailer_urls.py', 4, 139, "  (r'^notify/(?P\\w
+)?/?(?P[\\w\\-]+)?/?(?P\\w+)?/?(?P\\w+)?/?$',
'notify_account_manager', name='notify-account-manager'),\n"))

Exception Location: /usr/lib/python2.6/site-packages/django/utils/
importlib.py in import_module, line 35
Python Executable:  /usr/bin/python
Python Version: 2.6.4
Python Path:['/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/
usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/
lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/
lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages', '/
var/www/ccadmin/ukca_admin/../Django-1.1.1', '/var/www/ccadmin/
ukca_admin', '/var/www/ccadmin/ukca_admin/lib', '/var/www/ccadmin/
ukca_admin/../']
Server time:Thu, 22 Apr 2010 16:27:21 +0100


Thanks!
--Jim

-- 
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: Retrieving an ID from a posted form

2010-04-22 Thread Nick
works like a charm, thanks Ian.

On Apr 22, 10:02 am, Ian Lewis  wrote:
> Nick,
>
> Because you won't get an id for your newly created object before you
> save it you'll need to send the email after you save the form. I'm
> assuming that ArtistFormFinal is a ModelForm but you can get the id
> using something like the following:
>
> myobj = form.save()
> send_mail(subject, "Your id is %d!" % myobj.id, email_address, recipients)
>
> I hope that's what you were looking for.
>
> Ian
>
>
>
> On Thu, Apr 22, 2010 at 11:39 PM, Nick  wrote:
> > I am working on a form process with multiple levels of submission. The
> > first is a front facing form with a general set of questions that are
> > to be followed up by someone after the form is submitted (the form
> > submits and entry to the DB).  To cut down on the amount of hunting
> > that those who will be reviewing the forms have to do I'd like to be
> > able to retrieve the ID for the newly created DB entry and attach it
> > to a url that points directly to that entry in the django admin.
>
> > I have the email logic set up so that the form submits all of the
> > information via email to an individual. In the email is the link to
> > the admin. So far it just goes to a full list of entries:
>
> > ex.http://mydjango.site.com/admin/projects/app/model_name/ID
>
> > I can easily send everything up to the ID. How do i retrieve the ID
> > from the submitted form. Since this is adding an entry to the DB it
> > has to be creating an ID somewhere.  Here is my view:
>
> > def short_form(request):
> >if request.method == 'POST':
> >form = ArtistFormFinal(request.POST, request.FILES)
> >if form.is_valid():
> >name = form.cleaned_data['name']
> >year_created = form.cleaned_data['year_created']
> >home_city = form.cleaned_data['home_city']
> >home_state = form.cleaned_data['home_state']
> >genre = form.cleaned_data['genre']
> >email_address = form.cleaned_data['email_address']
> >phone_number = form.cleaned_data['phone_number']
> >website = form.cleaned_data['website']
> >audio = form.cleaned_data['audio_file']
> >subject = 'Static artists submission from %s' % (name)
> >message = render_to_string('static/short_email.txt', {
> >'name': name,
> >'year_created': year_created,
> >'home_city': home_city,
> >'genre': genre,
> >'home_state': home_state,
> >'email_address': email_address,
> >'phone_number': phone_number,
> >'website': website,
> >'audio': audio
> >})
> >recipients = ['ntankers...@opubco.com',
> > 'crobi...@opubco.com']
> >send_mail(subject, message, email_address, recipients,
> > fail_silently=False)
> >form.save()
> >return HttpResponseRedirect('thanks')
> >else:
> >form = ArtistFormFinal()
> >return render_to_response('static/artist_short.html',
> > {'form':form})
>
> > --
> > 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.
>
> --
> ===
> 株式会社ビープラウド  イアン・ルイス
> 〒150-0021
> 東京都渋谷区恵比寿西2-3-2 NSビル6階
> email: ianmle...@beproud.jp
> TEL:03-6416-9836
> FAX:03-6416-9837http://www.beproud.jp/
> ===
>
> --
> 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 dispatch with name argument throws syntax error

2010-04-22 Thread kmtracey
On Thu, Apr 22, 2010 at 11:34 AM, vjimw  wrote:

> Adding the name argument seems pretty straight forward, but I must be
> doing something wrong. I am writing tests and have the URLs named
> seems like the easiest way to look them up.
>
> My URL dispatch file was working before I added any of the name='this-
> name' arguments.
>
>
You can't specify name= when you have tuples in your patterns, you must use
the url() function (
http://docs.djangoproject.com/en/dev/topics/http/urls/#url) if you want to
use that syntax.

Karen

-- 
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: Working for a startup.

2010-04-22 Thread Andy McKay

On 2010-04-21, at 10:40 PM, Joe Goldthwaite wrote:
>  The guy mentioned that they originally started with a
> different company using Ruby on Rails.  He said that after the other company
> got bogged down and wasn't making progress, he switched to the new company
> that we're considering.  He said that they got the project back on track and
> organized but ended up running into lots of problems with Rails.  They
> talked it over and decided to rewrite everything in .net.  Now he's happy
> with the progress and feels like .net is a superior platform and is allowing
> him to develop his program at a lower total cost.

So company X got into problems using rails, so they switched to .NET using 
company Y. And this is from a company referred to by company Y? 
That's not the most impartial conversation.

There's a lot of worrying about technology there - which can be relevant. But 
i've seen projects get bogged down in many different languages too, the skills 
of a company to produce are varied and include project management. 

There could be many, many reasons the Rails project didn't do too well and the 
.NET project is going better. And I bet few of them are to do with Rails.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
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 dispatch with name argument throws syntax error

2010-04-22 Thread vjimw
Thanks! That was it! I had completely overlooked that and the url()
function was even in another URLs file in our project.

On Apr 22, 10:45 am, kmtracey  wrote:
> On Thu, Apr 22, 2010 at 11:34 AM, vjimw  wrote:
> > Adding the name argument seems pretty straight forward, but I must be
> > doing something wrong. I am writing tests and have the URLs named
> > seems like the easiest way to look them up.
>
> > My URL dispatch file was working before I added any of the name='this-
> > name' arguments.
>
> You can't specify name= when you have tuples in your patterns, you must use
> the url() function 
> (http://docs.djangoproject.com/en/dev/topics/http/urls/#url) if you want to
> use that syntax.
>
> Karen
>
> --
> 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: Working for a startup.

2010-04-22 Thread Javier Guerra Giraldez
I want to state some points that should be obvious:

- All three techonogies mentioned so far (Django, .NET and Rails) can
work on flawlessly on big, important projects when used correctly, or
can fail on medium/small deployments when used incorrectly.

- .NET is a lower-level layer than Django or Rails, it's more
comparable to Python, Ruby, or (more so) to Java.  But, being a
single-sourced technology, the framework on top is more 'obvious'.
also, since most of the infrastructure associated with .NET comes from
Redmond, the evolution paths are clearly defined, just like it used to
be with Java, where 'a web using Java' was almost always J2EE.

- Any framework scales just up to a point, and then you have to start
replacing some generic parts with custom implementations that work
best for your specific problem.  just how long can you stretch each
before you see the voids and start filling them depends somewhat on
the framework itself, but much more on the skill and experience of the
developers.

- taking a group that's experienced and productive developing with a
framework and telling them that you want them to use another one that
they're not familiar with is a sure path to failure.  not only because
of lack of experience, but also because they might not want it to
succeed, and they even have a clear excuse.  in fact, failing at it
makes them look better because they were suggesting the other way from
the start!  just don't do it.


-- 
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: add permission to new model instances

2010-04-22 Thread Adonis
Thank you for your answer Shawn.

I have been reading through Signal documentation and related
examples...It is quite useful and it helps keep your code tidy. My
problem continues because i cannot find a way to use a signal to add a
permission to the meta class of the Layer model every time a user
creates a layer in my web application. What i want is to have
different permission for every layer not just for the layer model.
Django auth offers add,edit,delete layer but what i want is
add,edit,delete for different layers and allowing/not allowing
different users to view them. Here is an example - > user creates
layer 1, permission "view layer 1" is added to the system. user
creates layer 2, permission "view layer 2" is added to the system etc.
Perhaps i have not comprehended signals properly yet, what i have in
mind with signals is this,

I must create a signal that will update the meta class of my layer
model or by other means add this permission to my app perm system. The
update can be done by adding a permission to the meta class and then
calling syncdb to register the update? Am i thinking it right?

Regards,


On Apr 21, 4:07 pm, Shawn Milochik  wrote:
> This can easily be done with signals.
>
> http://docs.djangoproject.com/en/1.1/topics/signals/
>
> And, it (rightly) won't be done in the view, because that leaves open the 
> very likely chance of a problem if someone writes a new view and forgets to 
> call your extra code.
>
> The only sticky problem at the moment is passing the user. The signal won't 
> know the request.user. However, if your Layer model automatically saves the 
> ID of the user who created it, then you can easily get it from there.
>
> 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-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: Working for a startup.

2010-04-22 Thread Jonathan Chen
Just to add my two cents. I think the fight between FOSS vs
Proprietary is kind of a faulty argument because there is pros and
cons for both sides. Anybody who says FOSS is the best or this
Proprietary software is the best really doesn't understand the
difference between FOSS and Proprietary software. I have worked with
FOSS products and proprietary software before and they both have
interesting issues between both of them. ASP.NET in my opinion is
easier to scale.

For proprietary stuff you'll probably have better support vs FOSS
stuff generally. The cost to support FOSS products vs the cost of
buying proprietary stuff usually ends up being equal in the long run.
But I think its more important to understand as a business what are
the key use cases and see if django or asp.net will fit the features
needed. Basically, the decision between the two needs to be a business
decision rather than a technological decision. I'm all for whatever is
the best solution for the company. I think it is silly to say that
FOSS is always better. If FOSS is always better then why don't more
companies use it over Oracle or SAP or RHEL or SLES? It really needs
to be a business decision. There are some cases where windows would do
better.

Other than that I would really just mention why django is better over
asp.net. In my opinion, django has better organization and pushes for
better organization than asp.net does in general. ASP.NET MVC is kind
of behind the times versus other web frameworks, but it is catching
up. Finding django developers are a lot fewer than asp.net developers,
but I think (generally) you'll find better quality python developers
than asp.net developers. There are probably other reasons, but can't
think of them off the top of my head. Also, Python has more
applications than C# does, and django has a mascot. Where is C#
mascot? Retired!!


Jonathan C.


On Apr 22, 8:28 am, Kenneth Loafman  wrote:
> Joe Goldthwaite wrote:
> > I’ve been working for a startup for a month or so.  The main guy is
> > enthusiastic about technology.  He probably runs more applications on
> > his computer than anyone I know.  He also switched from a Windows
> > background to a Mac notebook a year ago.  He doesn’t know a lot about
> > web development or how it all works.  That’s what I’ve been helping with.
>
> > He’s interviewed a number of companies trying to find a good one to
> > develop version1 of the application.  I’ve been pushing him towards
> > Linux/Python/Django and thought I had him convinced.  The company he’s
> > thinking about going with is a .net shop.  They say they can do anything
> > but the bulk of their developers are .net.  Still, he was thinking about
> > going with this company but still having them develop in Django.
>
> > This morning we had a conference call with one of the references the
> > development company provided.  It turns out they’re a startup that’s
> > working on a different application in the same industry as us so there
> > was an affinity there.  The guy mentioned that they originally started
> > with a different company using Ruby on Rails.  He said that after the
> > other company got bogged down and wasn’t making progress, he switched to
> > the new company that we’re considering.  He said that they got the
> > project back on track and organized but ended up running into lots of
> > problems with Rails.  They talked it over and decided to rewrite
> > everything in .net.  Now he’s happy with the progress and feels like
> > .net is a superior platform and is allowing him to develop his program
> > at a lower total cost.
>
> > This has my boss worried.  Most of the people he’s been talking to are
> > from large companies.  One of them was even a high end Microsoft
> > person.  I think he’s starting to think that the Microsoft technology
> > stack might be the safer choice. He wants to get to the point of having
> > millions of users and is worried that Django wont cut it. I’m also
> > worried that if he does stick with Django, the development company might
> > blame any setbacks on Django and push for a rewrite in .net.
>
> I also work for a startup company and we are firmly entrenched in Linux,
> Django, Postgress, and other FOSS products.  We could not afford to go
> any other route.
>
> When someone asks about FOSS vs proprietary, my first question is:
> "Would Google be here at all if it had to pay MS license fees?".
>
> And the answer is NO.
>
> If you are doing web based software-as-a-service, you can serve data to
> any OS out there from Linux, Mac, pocket calculators, anything.  The
> data does not care, and the customer does not care how you got the data
> as long as it suits his needs.  There's nothing magic about Windows, and
> .NET is a lock-in trap that guarantees you'll stay with Windows,
> regardless of what the Mono guys say.
>
> ...Ken
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email

multiple django instances, one database?

2010-04-22 Thread Tim Arnold
hi,
Until now I've been working on a single Freebsd server, hosting a
couple of Django apps. Now we've bought another machine to provide
load balancing and I'm wondering how to accomplish that.
I guess the django code can be shared on the same drive, but the
django instances running separately of course (apache/mod_python).

Is it possible to have two instances accessing the same database? How
do you handle load-balancing?

thanks,
--Tim

-- 
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: add permission to new model instances

2010-04-22 Thread Shawn Milochik
What you're describing is more of a row-level permissions system. The 
permissions system that ships with contrib.auth is table-level, not row-level. 
There has been some talk on this list about ways to go about it, but I don't 
think there's an out-of-the-box solution for it yet. 

Off of the top of my head (and I'm hoping others will chime in with 
improvements), you can use a custom manager[1] for the Layer model which 
requires the request.user to be passed in. That way, you will be able to 
control access in the manager itself and hide that logic from your views. This 
is assuming that you have a foreign key to the user who created each Layer and, 
given request.user, will be able to determine what permissions they should have.

Shawn

[1] http://docs.djangoproject.com/en/1.1/topics/db/managers/#id2

-- 
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: multiple django instances, one database?

2010-04-22 Thread Andy McKay

On 2010-04-22, at 9:52 AM, Tim Arnold wrote:

> hi,
> Until now I've been working on a single Freebsd server, hosting a
> couple of Django apps. Now we've bought another machine to provide
> load balancing and I'm wondering how to accomplish that.
> I guess the django code can be shared on the same drive, but the
> django instances running separately of course (apache/mod_python).
> 
> Is it possible to have two instances accessing the same database? How
> do you handle load-balancing?

Yes you can. There's lots of options, http://www.apsis.ch/pound/ is but one.
--
  Andy McKay, @andymckay
  Django Consulting, Training and Support

-- 
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: I have a problem with the pagination with haystack and apache solr

2010-04-22 Thread Ariel
I don't know how to know that because I don't know the name of the fields in
the index.
How could I know it ???
Regards
Ariel

On Wed, Apr 21, 2010 at 4:40 AM, Ray McBride  wrote:

> How many results are returned when you search using the solr admin
> interface?
>
> Are you using the code that I posted for you previously?
>
> Ray
>
> On Apr 19, 6:29 pm, Ariel  wrote:
> > Hi everybody:
> > I have a big problem with pagination using apache solr and haystack, this
> is
> > what it is happening: I have a site where the news are being indexing
> with
> > haystack and solr, but the problem is that when a I make the search the
> > pagination is showing me more match results that what really exists even
> > more results that total news in my database, for example I have only 20
> news
> > in the database but when I make a search the pagination said 40 matching
> > results are found then when I navigate with the "next" link to see the
> other
> > results any result is showed.
> >
> > I hope I have made a good explanation of my problem.
> > Could you help me please ???
> > I don't know why it is happening that 
> > Regards.
> > Ariel
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-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: How to set the sucess message after inserting values to db in django admin site

2010-04-22 Thread Paulo Roberto Macedo Chaves
If you are using a generic view for create/update object without a logged
user, the messages will not be displayed.

On Thu, Apr 22, 2010 at 3:09 AM, Radhikavk  wrote:

>
> How to set the sucess message after inserting values to db in django admin
> site
> like message department added sucessfully
>
> model:
>
> class mdldepartments(models.Model):
>class Meta:
>verbose_name_plural = "Departments"
>verbose_name = "Department"
>property = models.ForeignKey(mdlhotelproperty, to_field = 'property_id')
>dept_id = models.AutoField(primary_key=True,null=False,blank=False)
>dept_name = models.CharField(max_length=100,null=False,blank=False)
>dept_desc = models.TextField()
>status = models.ForeignKey('hmsCommon.mdlstatus')
>
>def __str__(self):
>return self.dept_name
>
> Modelform:
>
> class departmentForm(forms.ModelForm):
>model=mdldepartments
>
>def clean(self):
>dept_msg = u"Department name allows only characters."
>cleaned_data = self.cleaned_data
>dept = cleaned_data.get("dept_name")
>pattern = re.compile("([A-Z,a-z])")
>if not pattern.match(dept):
>self._errors["dept_name"] = ErrorList([dept_msg])
>#else:
>#self.
>return cleaned_data
>
> Admin register:
> class mdldepartmentsAdmin(admin.ModelAdmin):
>   form=departmentForm
>   list_display = ('dept_name','status')
>   search_fields = ['dept_name']
>   list_filter = ['status']
> admin.site.register(mdldepartments,mdldepartmentsAdmin)
>
>
>
> And i tried to enable the messaging module in django but in django.contrib
> messages folder is missing
> my django version is 1.1
>
>
> Thaks
> Radhika
> --
> View this message in context:
> http://old.nabble.com/How-to-set-the-sucess-message-after-inserting-values-to-db-in-django-admin-site-tp28324504p28324504.html
> Sent from the django-users mailing list archive at Nabble.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.
>
>

-- 
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: multiple django instances, one database?

2010-04-22 Thread Tim Arnold
On Apr 22, 1:22 pm, Andy McKay  wrote:
> On 2010-04-22, at 9:52 AM, Tim Arnold wrote:
>
> > hi,
> > Until now I've been working on a single Freebsd server, hosting a
> > couple of Django apps. Now we've bought another machine to provide
> > load balancing and I'm wondering how to accomplish that.
> > I guess the django code can be shared on the same drive, but the
> > django instances running separately of course (apache/mod_python).
>
> > Is it possible to have two instances accessing the same database? How
> > do you handle load-balancing?
>
> Yes you can. There's lots of options,http://www.apsis.ch/pound/is but one.
> --
>   Andy McKay, @andymckay
>   Django Consulting, Training and Support
>

I just googled that which led to some interesting pages and notes,
thanks.
So, just to make sure I understand:

browser -> pound --> apache1(mysqldb) +django
  --> apache2(mysqldb) +django

and it will just work? One database, two django instances and they
won't clobber each other on db write?
I guess the writes will block, correct?

thanks,
--Tim

-- 
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: Working for a startup.

2010-04-22 Thread JHeasly
There's also this:

http://kurtgrandis.com/blog/2010/02/24/python-django-vs-c-asp-
net-productivity-showdown/">Python + Django vs. C# + ASP.NET:
Productivity Showdown

>From the above:

"People are often asking me how and why my department shifted from an
ASP.NET environment to Django. I’ve finally gotten around to writing
about the process leading up to our decision. I hope people out there
find it useful in their own development groups and discussions. ... "

On Apr 22, 9:26 am, Jonathan Chen  wrote:
> Just to add my two cents. I think the fight between FOSS vs
> Proprietary is kind of a faulty argument because there is pros and
> cons for both sides. Anybody who says FOSS is the best or this
> Proprietary software is the best really doesn't understand the
> difference between FOSS and Proprietary software. I have worked with
> FOSS products and proprietary software before and they both have
> interesting issues between both of them. ASP.NET in my opinion is
> easier to scale.
>
> For proprietary stuff you'll probably have better support vs FOSS
> stuff generally. The cost to support FOSS products vs the cost of
> buying proprietary stuff usually ends up being equal in the long run.
> But I think its more important to understand as a business what are
> the key use cases and see if django or asp.net will fit the features
> needed. Basically, the decision between the two needs to be a business
> decision rather than a technological decision. I'm all for whatever is
> the best solution for the company. I think it is silly to say that
> FOSS is always better. If FOSS is always better then why don't more
> companies use it over Oracle or SAP or RHEL or SLES? It really needs
> to be a business decision. There are some cases where windows would do
> better.
>
> Other than that I would really just mention why django is better over
> asp.net. In my opinion, django has better organization and pushes for
> better organization than asp.net does in general. ASP.NET MVC is kind
> of behind the times versus other web frameworks, but it is catching
> up. Finding django developers are a lot fewer than asp.net developers,
> but I think (generally) you'll find better quality python developers
> than asp.net developers. There are probably other reasons, but can't
> think of them off the top of my head. Also, Python has more
> applications than C# does, and django has a mascot. Where is C#
> mascot? Retired!!
>
> Jonathan C.
>
> On Apr 22, 8:28 am, Kenneth Loafman  wrote:
>
>
>
>
>
> > Joe Goldthwaite wrote:
> > > I’ve been working for a startup for a month or so.  The main guy is
> > > enthusiastic about technology.  He probably runs more applications on
> > > his computer than anyone I know.  He also switched from a Windows
> > > background to a Mac notebook a year ago.  He doesn’t know a lot about
> > > web development or how it all works.  That’s what I’ve been helping with.
>
> > > He’s interviewed a number of companies trying to find a good one to
> > > develop version1 of the application.  I’ve been pushing him towards
> > > Linux/Python/Django and thought I had him convinced.  The company he’s
> > > thinking about going with is a .net shop.  They say they can do anything
> > > but the bulk of their developers are .net.  Still, he was thinking about
> > > going with this company but still having them develop in Django.
>
> > > This morning we had a conference call with one of the references the
> > > development company provided.  It turns out they’re a startup that’s
> > > working on a different application in the same industry as us so there
> > > was an affinity there.  The guy mentioned that they originally started
> > > with a different company using Ruby on Rails.  He said that after the
> > > other company got bogged down and wasn’t making progress, he switched to
> > > the new company that we’re considering.  He said that they got the
> > > project back on track and organized but ended up running into lots of
> > > problems with Rails.  They talked it over and decided to rewrite
> > > everything in .net.  Now he’s happy with the progress and feels like
> > > .net is a superior platform and is allowing him to develop his program
> > > at a lower total cost.
>
> > > This has my boss worried.  Most of the people he’s been talking to are
> > > from large companies.  One of them was even a high end Microsoft
> > > person.  I think he’s starting to think that the Microsoft technology
> > > stack might be the safer choice. He wants to get to the point of having
> > > millions of users and is worried that Django wont cut it. I’m also
> > > worried that if he does stick with Django, the development company might
> > > blame any setbacks on Django and push for a rewrite in .net.
>
> > I also work for a startup company and we are firmly entrenched in Linux,
> > Django, Postgress, and other FOSS products.  We could not afford to go
> > any other route.
>
> > When someone asks about FOSS vs proprietary, my first question 

Re: multiple django instances, one database?

2010-04-22 Thread Tom Evans
On Thu, Apr 22, 2010 at 7:00 PM, Tim Arnold  wrote:
> On Apr 22, 1:22 pm, Andy McKay  wrote:
>> On 2010-04-22, at 9:52 AM, Tim Arnold wrote:
>>
>> > hi,
>> > Until now I've been working on a single Freebsd server, hosting a
>> > couple of Django apps. Now we've bought another machine to provide
>> > load balancing and I'm wondering how to accomplish that.
>> > I guess the django code can be shared on the same drive, but the
>> > django instances running separately of course (apache/mod_python).
>>
>> > Is it possible to have two instances accessing the same database? How
>> > do you handle load-balancing?
>>
>> Yes you can. There's lots of options,http://www.apsis.ch/pound/is but one.
>> --
>>   Andy McKay, @andymckay
>>   Django Consulting, Training and Support
>>
>
> I just googled that which led to some interesting pages and notes,
> thanks.
> So, just to make sure I understand:
>
> browser -> pound --> apache1(mysqldb) +django
>                          --> apache2(mysqldb) +django
>
> and it will just work? One database, two django instances and they
> won't clobber each other on db write?
> I guess the writes will block, correct?
>

If you just want to run two instances of django against the same
database, then just do so. How you hook it into your hosting mechanism
depends on what mechanism you are using. Typically there would be no
need for multiple apache instances or a load balancer in front.

I'm not sure I understand your last statement '..they wont clobber
each other on db write'. If you edit the same object at the same time
on multiple django instances, it is the same as if you edited the same
object at the same time on a single django instance. Django does no
locking - apart from atomicity of objects - to ensure that the earlier
saved object does not get updated.

I just re-read that, and even I don't understand it so heres an example:

User A loads a page with a form to edit object instance O
User B loads a page with a form to edit object instance O
User A changes O.active from True to False and saves the form
User B changes O.name from '' to 'Bob' and saves the form

Note that I haven't mentioned what instance of django they are running
on - it is irrelevant

In this scenario, after B has saved the form, O.active is True, and
O.name is 'Bob'. B does not get any warning that the object instance
he is editing has changed out from underneath him.

If you require that sort of behaviour, you need to track the revision
of the object, and implement it when anything on the model changes -
that's behind the scope of this discussion ;)

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-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.



unable to create en-gb for localisation

2010-04-22 Thread Aaron Lee
Hi,

I am trying to create a UK version of my site and ran into some problems.
I am manually setting my LANGUAGE_CODE to 'en-gb' and use
django-admin.py makemessages -l en-gb and then run compilemessages

For some reason it's not picking up the localised string, I am pretty sure
my setup is correct because I did the same experiment for uk (Ukraine).

Looking at Django's conf/locale I couldn't find an example of Great Britain
English translation setup. Any idea what may go wrong? Thanks

-Aaron

-- 
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.



list_editable ForeignKeyRawIdWidget problem

2010-04-22 Thread frans
I have a list_editable foreignkey field.  In the admin site change
list it is displayed with a nice search icon. but the link is bad!


it might be something on my end I dont know I updated to trunk and
removed all the pyc files, syncdb'd but it didnt help. I did some
digging and found I could get the correct url changing /site_packags/
django/contrib/admin/widgets.py's



class ForeignKeyRawIdWidget(forms.TextInput):
"""
A Widget for displaying ForeignKeys in the "raw_id" interface
rather than
in a  box.
"""
def __init__(self, rel, attrs=None, using=None):
self.rel = rel
self.db = using
super(ForeignKeyRawIdWidget, self).__init__(attrs)

def render(self, name, value, attrs=None):
if attrs is None:
attrs = {}
related_url = '../../../%s/%s/' %
(self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower())
INTO
related_url = '../../%s/%s/' % (self.rel.to._meta.app_label,
self.rel.to._meta.object_name.lower())

Now, I don't know if this is a bug or that I am doing something wrong.


I have these settings in the admin.py

class DotAttributeAdmin(admin.ModelAdmin):
#readonly_fields = ('guid',)
raw_id_fields = ('guid', )
list_display = ('id','guid', 'key','name','value',)
list_editable = ('guid', 'key', 'name','value',)
list_filter = ('key',)


Any hints ?

-- 
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: Working for a startup.

2010-04-22 Thread didier rano
I am working these days on both environment. Half with C# .NET environment
(Professional time), and half with Python/Django (Not yet professional time
!)

I love Python. Really, it is not a pleasure for me to work with C#.

Now, I would like to hire some developers to continue my Django projects.
Then, I see two problems:

* Django or Python developers are often freelances. But I want to secure my
project with good and permanents developers. Difficult to find, and probably
difficult to keep them.

* Dynamic languages are very powerful. Very powerful for strong developers.
And not easy for average developers. C#, Visual Studio build average
developers, but probably project maintenance costs less.

Dilemma...

Didier Rano




2010/4/22 JHeasly 

> There's also this:
>
> http://kurtgrandis.com/blog/2010/02/24/python-django-vs-c-asp-
> net-productivity-showdown/">Python + Django vs. C# + ASP.NET:
> Productivity Showdown
>
> From the above:
>
> "People are often asking me how and why my department shifted from an
> ASP.NET environment to Django. I’ve finally gotten around to writing
> about the process leading up to our decision. I hope people out there
> find it useful in their own development groups and discussions. ... "
>
> On Apr 22, 9:26 am, Jonathan Chen  wrote:
> > Just to add my two cents. I think the fight between FOSS vs
> > Proprietary is kind of a faulty argument because there is pros and
> > cons for both sides. Anybody who says FOSS is the best or this
> > Proprietary software is the best really doesn't understand the
> > difference between FOSS and Proprietary software. I have worked with
> > FOSS products and proprietary software before and they both have
> > interesting issues between both of them. ASP.NET in my opinion is
> > easier to scale.
> >
> > For proprietary stuff you'll probably have better support vs FOSS
> > stuff generally. The cost to support FOSS products vs the cost of
> > buying proprietary stuff usually ends up being equal in the long run.
> > But I think its more important to understand as a business what are
> > the key use cases and see if django or asp.net will fit the features
> > needed. Basically, the decision between the two needs to be a business
> > decision rather than a technological decision. I'm all for whatever is
> > the best solution for the company. I think it is silly to say that
> > FOSS is always better. If FOSS is always better then why don't more
> > companies use it over Oracle or SAP or RHEL or SLES? It really needs
> > to be a business decision. There are some cases where windows would do
> > better.
> >
> > Other than that I would really just mention why django is better over
> > asp.net. In my opinion, django has better organization and pushes for
> > better organization than asp.net does in general. ASP.NET MVC is kind
> > of behind the times versus other web frameworks, but it is catching
> > up. Finding django developers are a lot fewer than asp.net developers,
> > but I think (generally) you'll find better quality python developers
> > than asp.net developers. There are probably other reasons, but can't
> > think of them off the top of my head. Also, Python has more
> > applications than C# does, and django has a mascot. Where is C#
> > mascot? Retired!!
> >
> > Jonathan C.
> >
> > On Apr 22, 8:28 am, Kenneth Loafman  wrote:
> >
> >
> >
> >
> >
> > > Joe Goldthwaite wrote:
> > > > I’ve been working for a startup for a month or so.  The main guy is
> > > > enthusiastic about technology.  He probably runs more applications on
> > > > his computer than anyone I know.  He also switched from a Windows
> > > > background to a Mac notebook a year ago.  He doesn’t know a lot about
> > > > web development or how it all works.  That’s what I’ve been helping
> with.
> >
> > > > He’s interviewed a number of companies trying to find a good one to
> > > > develop version1 of the application.  I’ve been pushing him towards
> > > > Linux/Python/Django and thought I had him convinced.  The company
> he’s
> > > > thinking about going with is a .net shop.  They say they can do
> anything
> > > > but the bulk of their developers are .net.  Still, he was thinking
> about
> > > > going with this company but still having them develop in Django.
> >
> > > > This morning we had a conference call with one of the references the
> > > > development company provided.  It turns out they’re a startup that’s
> > > > working on a different application in the same industry as us so
> there
> > > > was an affinity there.  The guy mentioned that they originally
> started
> > > > with a different company using Ruby on Rails.  He said that after the
> > > > other company got bogged down and wasn’t making progress, he switched
> to
> > > > the new company that we’re considering.  He said that they got the
> > > > project back on track and organized but ended up running into lots of
> > > > problems with Rails.  They talked it over and decided to rewrite
> > > > everything in .net.  

Re: unable to create en-gb for localisation

2010-04-22 Thread Ramiro Morales
On Thu, Apr 22, 2010 at 3:48 PM, Aaron Lee  wrote:
> Hi,
>
> I am trying to create a UK version of my site and ran into some problems.
> I am manually setting my LANGUAGE_CODE to 'en-gb' and use
> django-admin.py makemessages -l en-gb and then run compilemessages
>
> For some reason it's not picking up the localised string, I am pretty sure
> my setup is correct because I did the same experiment for uk (Ukraine).
>
> Looking at Django's conf/locale I couldn't find an example of Great Britain
> English translation setup. Any idea what may go wrong? Thanks

Make sure you are creating a stub en-gb translation for Django. See the
second note box ("Locale restrictions") here:

http://docs.djangoproject.com/en/1.1/topics/i18n/localization/#topics-i18n-localization

-- 
Ramiro Morales  |  http://rmorales.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.



Re: unable to create en-gb for localisation

2010-04-22 Thread Daniel Roseman
On Apr 22, 7:48 pm, Aaron Lee  wrote:
> Hi,
>
> I am trying to create a UK version of my site and ran into some problems.
> I am manually setting my LANGUAGE_CODE to 'en-gb' and use
> django-admin.py makemessages -l en-gb and then run compilemessages
>
> For some reason it's not picking up the localised string, I am pretty sure
> my setup is correct because I did the same experiment for uk (Ukraine).
>
> Looking at Django's conf/locale I couldn't find an example of Great Britain
> English translation setup. Any idea what may go wrong? Thanks
>
> -Aaron

I suspect the issue is this (from 
http://docs.djangoproject.com/en/1.1/topics/i18n/localization/):
"Django does not support localizing your application into a locale for
which Django itself has not been translated. In this case, it will
ignore your translation files."

--
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.



Re: unable to create en-gb for localisation

2010-04-22 Thread Aaron Lee
Thanks, for some reason en_GB works (but not en-gb) and I don't see a en_GB
stub under django/conf/locale. So it seems it works in a mysterious way

-Aaron

On Thu, Apr 22, 2010 at 12:24 PM, Ramiro Morales  wrote:

> On Thu, Apr 22, 2010 at 3:48 PM, Aaron Lee  wrote:
> > Hi,
> >
> > I am trying to create a UK version of my site and ran into some problems.
> > I am manually setting my LANGUAGE_CODE to 'en-gb' and use
> > django-admin.py makemessages -l en-gb and then run compilemessages
> >
> > For some reason it's not picking up the localised string, I am pretty
> sure
> > my setup is correct because I did the same experiment for uk (Ukraine).
> >
> > Looking at Django's conf/locale I couldn't find an example of Great
> Britain
> > English translation setup. Any idea what may go wrong? Thanks
>
> Make sure you are creating a stub en-gb translation for Django. See the
> second note box ("Locale restrictions") here:
>
>
> http://docs.djangoproject.com/en/1.1/topics/i18n/localization/#topics-i18n-localization
>
> --
> Ramiro Morales  |  http://rmorales.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.
>
>

-- 
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: multiple django instances, one database?

2010-04-22 Thread Tim Arnold


On Apr 22, 2:25 pm, Tom Evans  wrote:
> On Thu, Apr 22, 2010 at 7:00 PM, Tim Arnold  wrote:
> > On Apr 22, 1:22 pm, Andy McKay  wrote:
> >> On 2010-04-22, at 9:52 AM, Tim Arnold wrote:
>
> >> > hi,
> >> > Until now I've been working on a single Freebsd server, hosting a
> >> > couple of Django apps. Now we've bought another machine to provide
> >> > load balancing and I'm wondering how to accomplish that.
> >> > I guess the django code can be shared on the same drive, but the
> >> > django instances running separately of course (apache/mod_python).
>
> >> > Is it possible to have two instances accessing the same database? How
> >> > do you handle load-balancing?
>
> >> Yes you can. There's lots of options,http://www.apsis.ch/pound/isbut one.
> >> --
> >>   Andy McKay, @andymckay
> >>   Django Consulting, Training and Support
>
> > I just googled that which led to some interesting pages and notes,
> > thanks.
> > So, just to make sure I understand:
>
> > browser -> pound --> apache1(mysqldb) +django
> >                          --> apache2(mysqldb) +django
>
> > and it will just work? One database, two django instances and they
> > won't clobber each other on db write?
> > I guess the writes will block, correct?
>
> If you just want to run two instances of django against the same
> database, then just do so. How you hook it into your hosting mechanism
> depends on what mechanism you are using. Typically there would be no
> need for multiple apache instances or a load balancer in front.
>
> I'm not sure I understand your last statement '..they wont clobber
> each other on db write'. If you edit the same object at the same time
> on multiple django instances, it is the same as if you edited the same
> object at the same time on a single django instance. Django does no
> locking - apart from atomicity of objects - to ensure that the earlier
> saved object does not get updated.
>
> I just re-read that, and even I don't understand it so heres an example:
>
> User A loads a page with a form to edit object instance O
> User B loads a page with a form to edit object instance O
> User A changes O.active from True to False and saves the form
> User B changes O.name from '' to 'Bob' and saves the form
>
> Note that I haven't mentioned what instance of django they are running
> on - it is irrelevant
>
> In this scenario, after B has saved the form, O.active is True, and
> O.name is 'Bob'. B does not get any warning that the object instance
> he is editing has changed out from underneath him.
>
> If you require that sort of behaviour, you need to track the revision
> of the object, and implement it when anything on the model changes -
> that's behind the scope of this discussion ;)
>
> Cheers
>
> Tom

Hi,
Thanks for that explanation. I think I understand it now.

--Tim

-- 
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: Email Field

2010-04-22 Thread CrabbyPete
Thanks. That helps.  At least I know someone else is facing the same
thing.

On Apr 21, 2:20 pm, Tom Evans  wrote:
> On Wed, Apr 21, 2010 at 6:22 PM, CrabbyPete  wrote:
> > Yes, but my problem is its defined in contrib.auth.User with no
> > length, which I assume defaults to 60. Facebook proxy email address
> > can be 90 characters long.
>
> http://lmgtfy.com/?q=django+auth.User+email+truncating&l=1
>
> Funnily, the OP there was dealing with the same issue. 75 characters
> is ridiculously short, commercial email addresses are often way longer
> than that - combine long company name with a typical spanish* name and
> a first.middle.l...@company email policy and you can get some real
> massive email addresses. I've even seen companies prepend
> 'temporary-contractor--ibm-' to the front of some email addresses :)
>
> Cheers
>
> Tom
>
> * Not that I have anything against spanish names, but sometimes they
> can be gloriously magnificent - take Juan Antonio Samaranch as an
> example. Don't think he was ever an IBM contractor tho :/
>
> --
> 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.



import request ? - django debugsqlshell

2010-04-22 Thread Daxal
Hi,

I am trying to run a little debug code before I put it on my
testserver. I am passing in "request" variable in the django code for
the debugsqlshell but it doesn't seem to work.

>>> sresults=run_search_component(request, 'contacts')
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'request' is not defined


Anyone know what the command is to import request? I checked many
websites on google and search forums but did not find anything.

Thanks for you help.

Daxal

-- 
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.



Any way to do select_related() moving backward?

2010-04-22 Thread Continuation
Is there any way to do something similar to select_related() when
following a foreign key relationship backward?

For example,
b = Blog.objects.get(id=1)
e = b.entry_set.all()

Any way to retrieve both b and e in one single DB query?

-- 
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.



M2M Manager -- how to get primary key of join table?

2010-04-22 Thread Info Cascade
Hi --

I have two models with a m2m relationship, and I need to get the value
of the primary key of the join table.

To use the example from the book:

> from django.db import models
>
> class Publication(models.Model):
> title = models.CharField(max_length=30)
>
> def __unicode__(self):
> return self.title
>
> class Meta:
> ordering = ('title',)
>
> class Article(models.Model):
> headline = models.CharField(max_length=100)
> publications = models.ManyToManyField(Publication)
>
> def __unicode__(self):
> return self.headline
>
> class Meta:
> ordering = ('headline',) 
Django creates the article_publications join table automatically.

What I need is, for a particular combination of article and publication,
what is the primary key in the join table?

Any thoughts?

Please Cc: me at liamk -- AT -- numenet --DOT--com if you can help!

Thanks,
Liam



-- 
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: list_editable ForeignKeyRawIdWidget problem

2010-04-22 Thread Karen Tracey
On Thu, Apr 22, 2010 at 2:50 PM, frans  wrote:

> I have a list_editable foreignkey field.  In the admin site change
> list it is displayed with a nice search icon. but the link is bad!
>
>
Since your fix involves changing the ForeignKeyRawIdWidget, I guess you have
a ForeignKey that is in both list_editable and raw_id_fields, which sounds a
lot like this open ticket:

http://code.djangoproject.com/ticket/11163

So it seems like it's a known problem waiting for a fix.  There's a patch on
the ticket but it is also marked as needing improvement -- I don't have time
at the moment to look more closely into why exactly that was done. If you
would be interested in pursuing getting a fix checked in for the problem,
helping to improve the existing patch to address whatever problem exists
with it would be a place to start.

Karen

-- 
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: get_next_by title?

2010-04-22 Thread ChrisR
Thanks Daniel!

I didn't realize that "FOO_gt=..." would go to the next.  I guess I
was thinking that'd only work with dates, ints, things that have to do
with numbers.  (I'm new to this stuff).

Provided what you gave me, I came up with the follow:

def get_prev_by_title(self):
get_prev = Product.objects.order_by('-
title').filter(title__lt=self.title)
try:
return get_prev[0]
except IndexError:
return None


def get_next_by_title(self):
get_next =
Product.objects.order_by('title').filter(title__gt=self.title)
try:
return get_next[0]
except IndexError:
return None

-- 
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.