Re: CRUD - grid? Is Django suitable for this?

2007-05-10 Thread Matt Dennewitz

see: extjs.com grid




On May 10, 2007, at 9:54 PM, walterbyrd wrote:

>
>
> How about a grid where data is not editable inline, but it still
> sortable by clicking on column headers?
>
> On May 10, 2:50 pm, [EMAIL PROTECTED] wrote:
>> Django is good for providing the backend, but most of your
>> functionality is probably going to be provided by ajax/javascript
>> which django will happily communicate with, but does not provide.
>>
>> You might take a look at:  http://developer.yahoo.com/yui/examples/ 
>> datatable/inlineediting.html
>
>
> >


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



Re: CRUD - grid? Is Django suitable for this?

2007-05-10 Thread walterbyrd

How about a grid where data is not editable inline, but it still
sortable by clicking on column headers?

On May 10, 2:50 pm, [EMAIL PROTECTED] wrote:
> Django is good for providing the backend, but most of your
> functionality is probably going to be provided by ajax/javascript
> which django will happily communicate with, but does not provide.
>
> You might take a look at:  
> http://developer.yahoo.com/yui/examples/datatable/inlineediting.html


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



Re: TypeError: expected string or buffer on django.utils.functional.__proxy__

2007-05-10 Thread Malcolm Tredinnick

On Thu, 2007-05-10 at 14:52 +0200, Sandro Dentella wrote:
> 
> 
> Thanks a lot for your answer that explained what I was underevaluating.
> 
> My example was not the real one and while trying to strip it as simple as
> possible I missed to say that I used 'smart_unicode' to get unicode
> object... and smart_unicode changed in r4904 to "respect deferred
> evaluation".

Unfortunately, it wasn't changed in a particularly correct fashion (I
can say that safely, since I was the idiot who made the change). It
still doesn't work properly. That's one of the things we are fixing in
the Unicode branch.

> In my real view I was using gettext, not gettext_lazy but the model has
> defined help_text as gettext_lazy so that I have it as a __proxy__ object.
> 
> I resorted to use for this particular case the old version of smart_unicode,
> could I have done something smarter?

This has a potential problem in that when smart_unicode() is called,
your string is translated at that moment. So if you define your form
well ahead of time and then, when the form is being converted to a
template, the locale setting is different from when you defined the
form, the translation will be in the wrong language.

This isn't fixable in trunk. After spending almost three days chasing
problems trying to fix that in a "simple" way, I ended up starting the
unicode branch because it requires a more holistic change. Ultimately,
getting gettext_lazy() to work with things like smart_unicode() is
probably going to require a bit of a redesign of gettext_lazy(), I
suspect.

For now, all I can say is get by with what you have working for now and
very shortly we will have unicode conversion finished and you can use
that.

Regards,
Malcolm



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



Re: TypeError: save_file() got an unexpected keyword argument 'save'

2007-05-10 Thread Malcolm Tredinnick

On Thu, 2007-05-10 at 23:46 +0200, Baurzhan Ismagulov wrote:
> Hello,
> 
> I've upgraded r3709 to 0.96 and started getting the following error:
> 
> Traceback (most recent call last):
> 
>   File "/var/lib/python-support/python2.4/django/core/handlers/base.py", line 
> 77, in get_response
> response = callback(request, *callback_args, **callback_kwargs)
> 
>   File 
> "/var/lib/python-support/python2.4/django/contrib/admin/views/decorators.py", 
> line 55, in _checklogin
> return view_func(request, *args, **kwargs)
> 
>   File "/var/lib/python-support/python2.4/django/views/decorators/cache.py", 
> line 39, in _wrapped_view_func
> response = view_func(request, *args, **kwargs)
> 
>   File 
> "/var/lib/python-support/python2.4/django/contrib/admin/views/main.py", line 
> 254, in add_stage
> new_object = manipulator.save(new_data)
> 
>   File "/var/lib/python-support/python2.4/django/db/models/manipulators.py", 
> line 105, in save
> f.save_file(new_data, new_object, self.change and self.original_object or 
> None, self.change, rel=False, save=False)
> 
> TypeError: save_file() got an unexpected keyword argument 'save'
> 
> This happens when I try to save a new record to a table using the admin
> interface. I've looked at django/db/models/fields/__init__.py, the
> method does seem to have the save kwarg. What is the problem?

Sounds like your code is somehow inconsistent. The "save" parameter was
added when ticket #639 was fixed (a little bit before 0.96 was
released).

There is a chance that some old *.pyc files from the pre-update version
are getting in the way in your source tree (it shouldn't be happening,
but it might be the case). Might depend on how you did the upgrade. Try
removing old *.pyc files.

Other than that, I don't really have any idea why you would be seeing
this problem on a standard Django install. The code certainly seems to
work and I haven't had any problems with it. So there is something
"special" about your installation. That's not much help, except to
encourage you to look closely at what might be unique about your
particular setup.

Regards,
Malcolm


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



Re: fastCGI

2007-05-10 Thread Malcolm Tredinnick

On Thu, 2007-05-10 at 09:00 -0700, Robert wrote:
> Hi all,
> 
> I have the distinct non-pleasure of setting up Django with fastCGI
> where I have no shell access and no ftp access below public_html..
> The techs at my hosting provider are nice enough to send along the
> fastCGI error output.
> 
> I am getting a very long set of errors from that.. .. a partial
> listing:
> 
> OK.. so... is WSGIServer missing... related to Django, python or
> apache?

The error strings themselves are printed by flup. They are not fatal
errors (which surprises me), since flup will fill in some probably not
correct default values and carry on.

This *may* be a bug in Django's fastcgi support, since I don't see where
we are filling those values before passing control to flup. However,
since I've never used Django fastcgi+flup before and haven't ever really
reviewed that code much, I'm not going to pretend to be an expert.

The good news is that it appears harmless in any case. But somebody who
is interested might want to poke around servers/fastcgi.py and work out
where we are violating the WSGI spec and fix them.

> and
> typecast_... are these normal..?

I've never seen them before, but they don't look like errors. Rather, it
appears that ultra-verbose output from the psycopg2 wrapper is turned
on. Django does a lot of adding typecast functions in the database
backends, so Django is triggering those diagnostics, but they look
harmless.

Regards,
Malcolm




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



Alternative ForeignKey selection interface in admin

2007-05-10 Thread orestis

Hello,

I've searched and I didn't find any good answers on this:

When you use the admin interface to specify a foreign key on a model,
you get a nice little drop-down with a cool plus button to add more.
This is manageable for about 10-20 entries. For more, there are
issues:

a) Usability goes down as it is hard to find and click and make sure
that you've selected the right instance
b) The text representation of the ForeignKey model may not be enough.
A notable example of this are images.

The solution is very simple: Make an option so that the user can use a
popup, using something like the list display of the admin (which
should have search fields set), so he can filter down the options he
has. He should be able to view the whole object (not just the __str__
output), issue search queries etc.

Is there a way to hook up something like this ? I don't mind writing
my own list display for this (in fact I think it should be an option)
but how can I override the widget the admin produces ?

I think this is common enough to be addressed centrally.

BTW, is this about to be implemented on newforms-admin ? The
documentation is a bit cryptic.

PS. As I typed this, an idea struck: Use raw_id_admin, then use some
JS functionality to open the pop-up, display a normal view of objects
etc, and use a callback to set the id in the admin. Good for a quick
hack, but ultimately the raw_id_admin doesn't cut it. A good example
is again images: When an image is selected, you should be able to see
the image - or the thumbnail. A text string or an id tells very
little.

I'd appreciate any feedback on this...


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



Re: Can managers take parameters? Or can you chain a filter in get_object_or_404?

2007-05-10 Thread Malcolm Tredinnick

On Thu, 2007-05-10 at 13:52 +, AndyB wrote:
> This could quite easily be another dumb question but here goes :(
> 
> Can a model have a manager that either takes a parameter or can access
> the current logged in user?
> 
> I simply want to filter any query sets returned from a table called
> Properties depending on the current user without having to catch every
> place in the application where I access the Properties table.

Short answer: you can either pass in the parameter or store in in the
current thread's threadlocal space. See
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser for the
latter

Longer answer: you need to store the current user somewhere that the
manager can get to it. Passing it in as a parameter is always possible,
since custom manager methods are just Python methods, so you can pass in
whichever parameters you like, providing you remember to call them
correctly.

Having the user determined automatically requires storing it somewhere
(e.g. in threadlocal) because Models -- and the whole ORM layer -- are
distinct from views and "user" is a view-level concept that models don't
care about.

Regards,
Malcolm



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



Re: Users creating subdomains with a django project

2007-05-10 Thread [EMAIL PROTECTED]

I'm no expert - but I picked up on this as you linked to my website
and my subdomains article.

Since writing that snippet I've moved the subdomain code out into some
nifty Middleware that sets a few 'request' variables so they're always
available in my views & templates. In another example where different
companies have their own subdomains (via a Company model), the
middleware confirms the current user (eg request.user) is allowed to
access data for that company (if request.user in
Company.user_set.all(), or something similar), raises the relevant
error page if they don't have access, and if they do it sets
request.company (an instance of the Company model) and Django
continues by selecting the right view to use.

Is it possible to alter the settings on-the-fly? If so modifying
settings.SITE_ID may work for some people, especially where you want
to use different content for different sites. In my case, I'm using
subdomains to limit access a different subset of data, but using the
same views/models/templates.

Ross


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



Re: Abstract class mapped to tables in postgres

2007-05-10 Thread Russell Keith-Magee

On 5/10/07, Diego <[EMAIL PROTECTED]> wrote:
>
> In my model I have an abstract class ServAbstract and ahother subclass
> ServA and ServB derived from ServAbstract.
> In the databse It might generate three tables:
>
> table_ServAbstract
> table_ServA
> table_ServB
>
> , and when by the admin interface I add a new ServA,
> table_ServAbstract y table_ServA might be modified.
>
> By the moment I use onoToOne relation betwen table_ServAbstract and
> table_ServA , and betwen table_ServAbstract and table_ServB, but I
> thing is not the right way.
>
> Any ideas?

At present, a OneToOne relation is your only real option.

We have plans to introduce model inheritance - including abstract base
classes - in the near future. See

http://code.djangoproject.com/wiki/ModelInheritance

for details.

Yours,
Russ Magee %-)

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



Re: test.client: where are context & template?

2007-05-10 Thread Russell Keith-Magee

On 5/11/07, sandro dentella <[EMAIL PROTECTED]> wrote:
>
>
> I'm trying to use test.client to test some pages that are login
> protected.
>
> 1. the docs say that syntax is:
>"""
>c = Client()
>c.login(username='fred', password='secret')
># Now you can access a login protected view
>"""
>
>while the signature is:
>
>def login(self, path, username, password, **extra):

This is a recent backwards-incompatible change in the development
stream. The login method was changed to make it more robust, capable
of supporting different authentication schemes, and less bound to
templates.

If you have Django 0.96 (or a pre-5152 SVN checkout), the old
prototype will be correct, and you should consult the 0.96 docs
(/documentation/0.96/testing/).

If you have a post-5152 SVN checkout, the new prototype will be
correct, and the docs on /documentation/testing/ will be correct.

> 2. the response of c.get() has correct content but no context and no
>template. Any possible explanation?

There won't be any context or template objects in one of two circumstances:
- No templates were used to render the content
- The test case isn't being run in a test environment. The signal that
capture template rendering information don't exist by default - they
are installed as part of a test system startup script
(setup_test_environment). If you are running the unit tests outside of
'./manage.py test', this script probably won't be called.

> A NOTE to save time to people that may read this while trying to
> debug the c.login. It's important you LOGIN_URL end with a slash,
> if not - as was my case- c.get issued by c.login will receive a 301
> instead of a 302. That allows the browser to continue, not the
> login method. ;-(

Hence one of the many reasons for the backwards incompatible change.
This problem doesn't affect the new version of Client.login().

Yours,
Russ Magee %-)

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



Re: how do I get new record PK after save()?

2007-05-10 Thread Russell Keith-Magee

On 5/11/07, Bob Dively <[EMAIL PROTECTED]> wrote:
>
> On May 10, 5:12 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> > You have to change it to:
> >
> > Foo_ID = models.AutoField(primary_key=True, editable=False)
>
> Ah, ok, so even though the db (MySQL) is taking care of incrementing
> the column value on insert, the model has to know that the DB is doing
> it?

Not quite. AutoField defines a field that tells the DB to choose the
next available value. An AutoField is added automatically to every
Django model that doesn't define its own 'primary_key=True' field
(i.e., you don't need to manually define a primary key on your models
unless you want to do something special).

IntegerField is just a standard integer. It _can_ be set as a primary
key, which enforces the predictable uniqueness, etc constraints, and
overrides the creation of the default AutoField primary key. However,
if you use IntegerField for your primary key, neither Django nor your
DB backend will populate the value. You will need to provide an
integer value for every object you save.

Yours,
Russ Magee %-)

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



Re: How can I get the admin interface to not ignore newlines in a text field?

2007-05-10 Thread Michael Lake

Alexander Pugachev wrote:
> Newlines characters do not break lines in HTML. You need  in strings to
> show text in few lines in list view.

Ah :-) Obvious now why it wasn't rendering the text as text with newlines..
Thanks.

-- 
Michael Lake
Computational Research Support Unit
Science Faculty, UTS
Ph: 9514 2238




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



test.client: where are context & template?

2007-05-10 Thread sandro dentella


I'm trying to use test.client to test some pages that are login
protected.


1. the docs say that syntax is:
   """
   c = Client()
   c.login(username='fred', password='secret')
   # Now you can access a login protected view
   """

   while the signature is:

   def login(self, path, username, password, **extra):

2. the response of c.get() has correct content but no context and no
   template. Any possible explanation?


A NOTE to save time to people that may read this while trying to
debug the c.login. It's important you LOGIN_URL end with a slash,
if not - as was my case- c.get issued by c.login will receive a 301
instead of a 302. That allows the browser to continue, not the
login method. ;-(



sandro
*;-)


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



TypeError: save_file() got an unexpected keyword argument 'save'

2007-05-10 Thread Baurzhan Ismagulov

Hello,

I've upgraded r3709 to 0.96 and started getting the following error:

Traceback (most recent call last):

  File "/var/lib/python-support/python2.4/django/core/handlers/base.py", line 
77, in get_response
response = callback(request, *callback_args, **callback_kwargs)

  File 
"/var/lib/python-support/python2.4/django/contrib/admin/views/decorators.py", 
line 55, in _checklogin
return view_func(request, *args, **kwargs)

  File "/var/lib/python-support/python2.4/django/views/decorators/cache.py", 
line 39, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

  File "/var/lib/python-support/python2.4/django/contrib/admin/views/main.py", 
line 254, in add_stage
new_object = manipulator.save(new_data)

  File "/var/lib/python-support/python2.4/django/db/models/manipulators.py", 
line 105, in save
f.save_file(new_data, new_object, self.change and self.original_object or 
None, self.change, rel=False, save=False)

TypeError: save_file() got an unexpected keyword argument 'save'

This happens when I try to save a new record to a table using the admin
interface. I've looked at django/db/models/fields/__init__.py, the
method does seem to have the save kwarg. What is the problem?

Thanks in advance,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

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



Re: how do I get new record PK after save()?

2007-05-10 Thread Bob Dively

On May 10, 5:12 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> You have to change it to:
>
> Foo_ID = models.AutoField(primary_key=True, editable=False)

Ah, ok, so even though the db (MySQL) is taking care of incrementing
the column value on insert, the model has to know that the DB is doing
it? Thanks! Works like a charm.


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



Re: how do I get new record PK after save()?

2007-05-10 Thread [EMAIL PROTECTED]

You have to change it to:

Foo_ID = models.AutoField(primary_key=True, editable=False)



On May 10, 5:06 pm, Bob Dively <[EMAIL PROTECTED]> wrote:
> Another n00b question: How do I get a new record's PK after save()?
>
> If I have:
>
> class Foo(models.Model):
> Foo_ID = models.IntegerField(primary_key=True, editable=False)
> Foo_Text = models.CharField(blank=True, maxlength=150)
>
> And I have a view that contains something like:
>
> if request.method == 'POST':
> f = FooForm(request.POST)
> if f.is_valid():
> f2 = f.save(commit=False)
> f2.save()
>
> >From what I've been reading it looks like I should be able to get the
>
> new record's PK with:
>
> f2.id
>
> or maybe
>
> f2.Foo_ID
>
> But no joy. The result is either None or an error message that Foo has
> no attributes id. FWIW, the record is created and it has a PK.


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



how do I get new record PK after save()?

2007-05-10 Thread Bob Dively

Another n00b question: How do I get a new record's PK after save()?

If I have:

class Foo(models.Model):
Foo_ID = models.IntegerField(primary_key=True, editable=False)
Foo_Text = models.CharField(blank=True, maxlength=150)

And I have a view that contains something like:

if request.method == 'POST':
f = FooForm(request.POST)
if f.is_valid():
f2 = f.save(commit=False)
f2.save()

>From what I've been reading it looks like I should be able to get the
new record's PK with:

f2.id

or maybe

f2.Foo_ID

But no joy. The result is either None or an error message that Foo has
no attributes id. FWIW, the record is created and it has a PK.


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



Re: CRUD - grid? Is Django suitable for this?

2007-05-10 Thread Matt Dennewitz


Check out:
http://extjs.com/deploy/ext/docs/index.html

Under "Grid" is the best open source grid that youll find today. AJAX- 
enabled with beautiful inline editing and more.
Free for open source projects, cheap to purchase for commercial use.  
I use it for just about everything!



Matt


On May 10, 2007, at 3:50 PM, [EMAIL PROTECTED] wrote:

>
>
> Django is good for providing the backend, but most of your
> functionality is probably going to be provided by ajax/javascript
> which django will happily communicate with, but does not provide.
>
> You might take a look at:  http://developer.yahoo.com/yui/examples/ 
> datatable/inlineediting.html
>
>
>
>
> >


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



Re: CRUD - grid? Is Django suitable for this?

2007-05-10 Thread dballanc

Django is good for providing the backend, but most of your
functionality is probably going to be provided by ajax/javascript
which django will happily communicate with, but does not provide.

You might take a look at:  
http://developer.yahoo.com/yui/examples/datatable/inlineediting.html




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



CRUD - grid? Is Django suitable for this?

2007-05-10 Thread walterbyrd

I assume Django is good for this type of thing:

A grid that can be sorted by icons on the top of each column. So if I
click on the icon on the 3rd row of the grid, the entire grid will be
sorted by that field.

Also, I would like to be edit the fields like a spreadsheet, if
possible.


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



Re: Scalability / Traffic-Volume Numbers

2007-05-10 Thread David Cancel

We use Django for all our Compete.com websites, performance is great,
We've been DUGG and Slashdot'd several times. We are averaging
200-300k users / per month and about 25k django-powered pageviews per
day.

Cheers,
David


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



Re: Translation of class names

2007-05-10 Thread Aidas Bendoraitis
Maybe you are calling make-messages from the wrong directory, or
Russian is not in the LANGUAGES?

Regards,
Aidas Bendoraitis aka Archatas

On 5/8/07, Pashka R. <[EMAIL PROTECTED]> wrote:
> 2007/5/7, Konstantin Pavlovsky <[EMAIL PROTECTED]>:
> >
> > up!
> > nobody used i18n things?
>
> [offtopic] Может создать группу ru_django? [/offtopic]
>
> --
> //wbr Pashka R. <[EMAIL PROTECTED]>
>
> >
>

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



Indian share market information

2007-05-10 Thread Ram

Dear members Good morning
You can view daily market analysis report at http://www.bcozindia.com/IP_MAR.asp
(daily updated after 8 am)

You can view daily intraday calls given to the registered members at
http://www.bcozindia.com/intraday%20calls.asp (daily updated after 5
pm)

Market this week section can be viewed at
http://www.bcozindia.com/Share_Market_Information_lovjitsingh.asp
(weekly updated)

Daily Share Market Newsletters can be downloaded from:
http://www.bcozindia.com/Daily_Share_Market_Newsletter.asp (daily
uploaded after 6 pm)


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



Indian share market information

2007-05-10 Thread Ram

Dear members Good morning
You can view daily market analysis report at http://www.bcozindia.com/IP_MAR.asp
(daily updated after 8 am)

You can view daily intraday calls given to the registered members at
http://www.bcozindia.com/intraday%20calls.asp (daily updated after 5
pm)

Market this week section can be viewed at
http://www.bcozindia.com/Share_Market_Information_lovjitsingh.asp
(weekly updated)

Daily Share Market Newsletters can be downloaded from:
http://www.bcozindia.com/Daily_Share_Market_Newsletter.asp (daily
uploaded after 6 pm)


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



Re: Komodo and Django - code completion / code intellisensing

2007-05-10 Thread oliver

Thanks, for both comments but still no luck.
I tried multiple various but it still gives me the same error.

my projects are in c:\django-projects\Project1..

I installed the latest beta of komodo, but has the same thing.
Python2.5 is installed in c:/python25 and is in my path (from the CMD
i can start pyton any where)

any other suggestions?

thanks again for helping

oli

On May 10, 3:12 pm, Ceph <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Go to Edit > Preferences. Expand the "Languages" group by clicking the
> [+] symbol. Click "Python". Click the little "Add..." button under
> "Additional Python Import Directories". Add the directory ABOVE your
> project and you should have intellisense enabled.
>
> On May 9, 12:01 pm, oliver <[EMAIL PROTECTED]> wrote:
>
> > Hi i am evaluating komodo as my django/python ide but i can't get the
> > code completion to work. It gives me this error:
>
> > error evaluating 'models' at models.py#4: NameError: global name 'XXX'
> > is not defined (C:\Prog..\Active..\lib\mozilla\python\komodo
> > \codintel2\tree_python.py#169 in _members_from_elem) (error
> > determining completions)
>
> > I am on Windows XP, python 2.5, komodo ide 4.0, latest django svn.
> > This error appears when you type for example:
>
> > class ...
> >   name = models.
>
> > right after the models "."
>
> > any one got this to work or is this a general bug in komodo?
>
> > Thanks!


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



Re: Validating dynamically generated forms

2007-05-10 Thread dballanc

The problem appears to be because you are using a numeric key as field
name.
change this:  field_id = t['id']   to  field_id = str(t['id']) , or
use a real string as the name.



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



connection mysqldb : wait timeout exceeded

2007-05-10 Thread [EMAIL PROTECTED]

Hello,

I have a problem concerning my requests on a basis mysql.
All my files are in UTF-8.
I have put my data base in UTF-8 and since this moment nothing does
not function.
None of my requests sql functions.

I have the error message:

(1205, ' Lock wait timeout exceeded; try restarting transaction')

Thank you to help me.

Azara


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



*single* django instance, multiple sites/domains

2007-05-10 Thread Florian Apolloner

Fredrik Lundh described a fine way to serve multiple hosts from a
single django instance.
As somebody else already asked in the comments, I would like to vary
the SITE_ID according to the host (maybe a db lookup). Otherwise I
would loose functionality of  flatpages/etc., or am I mistaken?

Any ideas how to achieve my goal?

Thanks, Florian


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



Re: Saving Objects from Models??

2007-05-10 Thread anders conbere

Paper_UserReg(request.POST['username'],request.POST['password'],request.POST['name_of_author'],request.POST['email_of_author'],request.POST['college_name'],int(request.P
OST['phone_of_author']),None)

That is NOT sanitized data, and if you think that putting them in
hidden fields in some way prevents other data from being posted your
sorely mistaken. ALL data coming from POST or GET should be sanitized
before being applied.

~ Anders

On 5/10/07, theju <[EMAIL PROTECTED]> wrote:
>
> The data is sanitized (taken from a form,cleaned and put in hidden
> fields, confirmed by the user and then saved to a model...its just
> that i've not showed all the code) and only then am I posting it to
> the model.
>
> Anyways thanks for the idea on the super __init__ function. Will check
> it up...
>
> Thanks Anders.
>
> -Thejaswi Puthraya
>
>
> >
>

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



Re: Saving Objects from Models??

2007-05-10 Thread theju

The data is sanitized (taken from a form,cleaned and put in hidden
fields, confirmed by the user and then saved to a model...its just
that i've not showed all the code) and only then am I posting it to
the model.

Anyways thanks for the idea on the super __init__ function. Will check
it up...

Thanks Anders.

-Thejaswi Puthraya


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



Re: Comments

2007-05-10 Thread cornelius bolten

levi,

the following website has a good example online
http://www.b-list.org/weblog/2006/07/16/django-tips-hacking-freecomment

cornelius

Levi McCallum schrieb:
> Hi,
> 
> I have been looking into building my first Django project, and I guess
> a blog was the most simplest thing I could think of for this moment.
> Now, I come from a PHP background, and Django is very new to me and
> Python is amazing, yet I do not know it all, so things are a little
> slow in the process.
> 
> My question is, I am building a comment function where a User will
> post a simple comment through a form field on the page. I have already
> setup my model, and done all the db back-end things, but I am not sure
> where to start for the front end, and the data processing. I have a
> few prerequisites though, that whenever someone enters a comment, and
> click the "remember me" Boolean field to true, I would like it to save
> a cookie or something into their system so for later, they would be
> able to come back and not have to fill anything out, the data would
> already be in the fields.
> 
> If you could just point me to some example code or a guide that would
> be great.
> 
> Thanks.
> 
> 
> > 

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



Re: Named URL problem

2007-05-10 Thread Olivier Guilyardi

[EMAIL PROTECTED] wrote:
> I'd suggest trying {% url telemeta-collection-detail object.id %}

Thanks that fixed it ! It's not object.id, it's p.id, but it wasn't defined at
this point in the template. It put the statement back in the loop where p.id is
defined and it works great :)

--
  Olivier

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



Comments

2007-05-10 Thread Levi McCallum

Hi,

I have been looking into building my first Django project, and I guess
a blog was the most simplest thing I could think of for this moment.
Now, I come from a PHP background, and Django is very new to me and
Python is amazing, yet I do not know it all, so things are a little
slow in the process.

My question is, I am building a comment function where a User will
post a simple comment through a form field on the page. I have already
setup my model, and done all the db back-end things, but I am not sure
where to start for the front end, and the data processing. I have a
few prerequisites though, that whenever someone enters a comment, and
click the "remember me" Boolean field to true, I would like it to save
a cookie or something into their system so for later, they would be
able to come back and not have to fill anything out, the data would
already be in the fields.

If you could just point me to some example code or a guide that would
be great.

Thanks.


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



Re: Curious error with Session Variables

2007-05-10 Thread Diego pylorca
Thanks Graham :)

it works!!

On 5/9/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
>
>
> Try reenabling PHP, but delve into the PHP setup and disable the
> loading of the PHP mhash module first.
>
> There have been cases where the PHP mhash module has clashed in some
> way with the Python md5 hash modules and caused the Python module to
> give back incorrect results. This may have an effect on session
> cookies if a md5 hash is used in some way to generate it.
>
> Graham
>
> On May 9, 11:16 pm, "Diego pylorca" <[EMAIL PROTECTED]> wrote:
> > Nop,
> >
> > when I disable mod-php5, the admin works correctly :(
> >
> > my web browsers are firefox and opera and IE, but it is not a client
> host
> > problem :'(
> >
> > On 5/8/07, John DeRosa <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Perhaps check your firewall, anti-hijack, anti-trojan, etc. software.
> > > You may have a cookie guard enabled.
> >
> > > For example, Webroot's Spy Sweeper has a set of "shields" for web
> > > browsers, and they include the blocking of certain tracking cookies
> and
> > > some IE security 'protection'.  Perhaps your system is running a
> similar
> > > product?
> >
> > > John
> >
> > > Diego pylorca wrote:
> > > > m
> >
> > > > I deployed my site, and in the admin when i try to login i get this
> > > message:
> >
> > > > "Looks like your browser isn't configured to accept cookies. Please
> > > > enable cookies, reload this page, and try again."
> >
> > > > the cookies is enabled.
> >
> > > > my server is a debian etch stable (intalled modpython apache2 and
> mysql
> > > > from apt)
> >
> > > > i ve run django/bin/daily_cleanup.py and flush the session table...
> >
> > > > PD: sory by me bad english
> >
> > > > On 4/4/07, *chasfs* <[EMAIL PROTECTED] >
> wrote:
> >
> > > > There are several things going on here. If you have multiple
> django
> > > > sites
> > > > all setting sessions cookies, make sure that the
> SESSION_COOKIE_NAME
> > > > and SESSION_COOKIE_DOMAIN are unique in the respective
> settings.py
> > > > files.
> >
> > > > You also need to clean out old session rows in the
> django_session
> > > > database.
> > > > You can use django/bin/daily_cleanup.py to do this.
> >
> > > > Good luck,
> > > > -chasfs
> >
> > > > On Apr 3, 1:36 pm, "Ramdas S" < [EMAIL PROTECTED]
> > > > > wrote:
> > > >  > Since last few days I am getting this error on Django web
> sites
> > > > hosted.
> > > >  > Obviously it is clashing with something.
> >
> > > >  > When I work on admin interface to add or delete content, I
> get
> > > > logged off
> > > >  > and it takes some time for me to login again.
> >
> > > >  > I get the following messages
> >
> > > >  > Please enter a correct username and password. Note that both
> > > > fields are
> > > >  > case-sensitive.
> >
> > > >  > If I keep on trying then the message changes to
> >
> > > >  > Looks like your browser isn't configured to accept cookies.
> > > > Please enable
> > > >  > cookies, reload this page, and try again.
> >
> > > >  > Later if I persist
> >
> > > >  > I get this error
> >
> > > >  > -
> >
> > > >  > SuspiciousOperation at /admin/ User may have tampered with
> > > session
> > > >  > cookie. Request
> > > >  > Method: POST  Request URL:http://developeriq.com/admin/
> > > > Exception Type:
> > > >  > SuspiciousOperation  Exception Value: User may have tampered
> with
> > > > session
> > > >  > cookie.  Exception Location:
> >
> > >
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> >
> > > >  > in _decode_post_data, line 40
> >
> > > >  > I am using the latest development version Mod_Python, Apache
> and
> > > > Ubuntu
> > > >  > Linux
> >
> > > >  > What can be the reason
> >
> > > >  > Thanks
> >
> > > >  > Ramdas S
> >
> > > >  > The Server is a dedicated server, and it also runs PHP, MySQl
> and
> > > > some PHP
> > > >  > and Python software.
> >
> > > > --
> > > > Diego F. Toritto.
> >
> > --
> > Diego F. Toritto.
>
>
> >
>


-- 
Diego F. Toritto.

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



fastCGI

2007-05-10 Thread Robert

Hi all,

I have the distinct non-pleasure of setting up Django with fastCGI
where I have no shell access and no ftp access below public_html..
The techs at my hosting provider are nice enough to send along the
fastCGI error output.

I am getting a very long set of errors from that.. .. a partial
listing:

OK.. so... is WSGIServer missing... related to Django, python or
apache?
and
typecast_... are these normal..?

Thanks very much for any assistance

Robert

# ./mysite.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
[27744] initpsycopg: initializing psycopg 2.0.5 (dt ext pq3)
[27744] typecast_init: initializing NUMBER
[27744] typecast_new: new type at = 0xb54f8300, refcnt = 1
[27744] typecast_new: typecast object created at 0xb54f8300
[27744] typecast_add: object at 0xb54f8300, values refcnt = 2
[27744] typecast_add: adding val: 20
[27744] typecast_add: adding val: 23
[27744] typecast_add: adding val: 21
[27744] typecast_add: adding val: 701
[27744] typecast_add: adding val: 700
[27744] typecast_add: adding val: 1700
[27744] typecast_add: base caster: (nil)
[27744] typecast_init: initializing LONGINTEGER


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



loaddata and foreignKey: manage.py silently failing

2007-05-10 Thread sandro dentella

hi,

  I'm trying to play with initial_data fixture. I dumpdata (json
format)
  and reload it cleanly if there are no foreign key contraints on the
table.
  If the tables i'm dumping have foreign keys (in my case holydays/
nation
  bith in the same fixture), I
  get an error from the db that aborts the transaction and:

1. manage.py loaddata says nothing: worse: says:

   [EMAIL PROTECTED]:~/src/django/siti/jobs$ ./manage.py loaddata
ref.json
   Loading 'ref' fixtures...
   Installing json fixture 'ref' from absolute path.
   Installed 112 object(s) from 1 fixture(s)

2. no data is loaded


postgresql log including lat insert going OK

STATEMENT:  INSERT INTO
"ref_refholiday" 
("date_create","date_last_modify","status","ref_nation_code","day","month","year","name",id)
VALUES ('2007-05-10 17:46:30.980677','2007-05-10 17:46:30.980729','1',
293,'26','12','0','Santo Stefano',33)
LOG:  duration: 0.941 ms  statement: SELECT
setval('ref_refholiday_id_seq', (SELECT max("id") FROM
"ref_refholiday"));
STATEMENT:  SELECT setval('ref_refholiday_id_seq', (SELECT max("id")
FROM "ref_refholiday"));
LOG:  duration: 0.578 ms  statement: SELECT
setval('ref_refnation_id_seq', (SELECT max("id") FROM
"ref_refnation"));
STATEMENT:  SELECT setval('ref_refnation_id_seq', (SELECT max("id")
FROM "ref_refnation"));
ERROR:  insert or update on table "ref_refholiday" violates foreign
key constraint "ref_refholiday_ref_nation_code_fkey"
DETAIL:  Key (ref_nation_code)=(293) is not present in table
"ref_refnation".


Any hints?

TIA
sandro
*:-)


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



Re: Validating dynamically generated forms

2007-05-10 Thread [EMAIL PROTECTED]

I didn't examine your code but I suggest using form_for_instance or
form_for_model to generate a dynamic form from a django app model.


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



Re: Named URL problem

2007-05-10 Thread [EMAIL PROTECTED]

I'd suggest trying {% url telemeta-collection-detail object.id %}


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



Re: Saving Objects from Models??

2007-05-10 Thread anders conbere

Well this is for starters far far away from the django way of solving
this problem. The typical solution would be to do something like
create a user profile that FK's into the User, to check all the data
in a view and then to create the objects. You can see a nice example
of this in James Bennet's Django-Registration app
(http://code.google.com/p/django-registration/ ).

Secondly at the very least you need to call the supers __init__
function, as that will set up the auto created id fields and I assume
various other tidbits that are used by models.Model instances.

Lastly it looks like you aren't use a form instance to sanitize your
user data, pulling data directly from request.POST is dangerous and
should be avoided by passing it through a form object. Making a form
object in this case should be as simple as for =
form_for_model(Paper_UserReg)(request.POST) then you can
form.is_valid() and get cleaned data from the form object by
requesting form.clean_data.

in all this just seems like an ugly hack with very little added value
over simply using a standard model, and checking input (hell making a
function to do that). I don't see any reason to overwrite init here.

~ Anders



On 5/10/07, theju <[EMAIL PROTECTED]> wrote:
>
> I have a class in a model(shown below).
> 
> class Paper_UserReg(models.Model):
> def
> __init__(self,username,password,name_of_author,email_of_author,college_name,unique_id=None):
> self.username = username
> self.password = password
> self.name_of_author = name_of_author
> self.email_of_author = email_of_author
> self.college_name = college_name
>
> from uuid import uuid1
> self.unique_id = str(uuid1())[:13]
>
> user =
> User.objects.create_user(self.username,self.email_of_author,self.password)
> return None
>
> class Admin:
> list_display =
> ["name_of_author","college_name","unique_id"]
>
> def __str__(self):
> return self.username
>
> name_of_author  = models.CharField(maxlength=50)
> email_of_author  = models.EmailField()
> college_name  = models.CharField(maxlength=50)
> unique_id = models.CharField(maxlength=13)
> -
> and the corresponding view is:
> 
> try:
> u =
> Paper_UserReg(request.POST['username'],request.POST['password'],request.POST['name_of_author'],request.POST['email_of_author'],request.POST['college_name'],int(request.P
> OST['phone_of_author']),None)
> #u.save()
> except IntegrityError:
> return render_to_response("user_details_confirmation.html",
> {"user_exists":"User Already Exists"})
> return render_to_response("user_created.html",
> {"user_created":"Congratulations!!! User created."})
>
> 
> when i run the application, the user is created (and also able to
> login in the login page created) and i can see this in the admin pages
> whereas the rest of the data ie the name_of_author, phone_of_author
> etc are not saved in the Paper_UserRegs page in the admin dashboard(or
> in the database also). If i remove the comment on u.save() then i get
> an attribute error that says 'Paper_UserReg' object has no attribute
> 'id'.
>
> What should I do so that both the user is created and the rest of the
> fields are also updated in the database?
>
> PS: I could have inherited the User class and created a sub class but
> the necessity was such that i had to indulge in such a bad practice.
>
> Thanking in advance
> Thejaswi Puthraya
> http://thejuhyd.blogspot.com
>
>
> >
>

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



Extending generic views and pagination

2007-05-10 Thread ilDave

Hi all!
I'm a new python and django user, and this is my first post in this
group!

I'm writing a small app that shows a list of objects after a
successfull login.
I made a custom view to handle authentication and at the same time to
keep the semplicity of the generic view list_detail.obkect_list:

def myobjectlist(request):
if request.user.is_authenticated():
return list_detail.object_list(request,
queryset=myObj.objects.all().order_by('-date), paginate_by=10,
extra_context = {'user' : request.user,})
else:
return HttpResponseRedirect('/login/')

In urls.py, I have a line like this:
(r'^list/$', myobjectlist),

Everything works fine if there is only one page.
But if I click to the link to the second page, that sends me to /list/?
page=2, I get a 404 error.
It seems that the list_detail.object_list wrapped inside the
myobjectlist viw can't handle the querystring parameter and return the
right objects... is this the reason for the error or I'm missing
something?

How can I resolve this?

Thanks in advance


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



Re: Komodo and Django - code completion / code intellisensing

2007-05-10 Thread Ceph

Hello,

Go to Edit > Preferences. Expand the "Languages" group by clicking the
[+] symbol. Click "Python". Click the little "Add..." button under
"Additional Python Import Directories". Add the directory ABOVE your
project and you should have intellisense enabled.

On May 9, 12:01 pm, oliver <[EMAIL PROTECTED]> wrote:
> Hi i am evaluating komodo as my django/python ide but i can't get the
> code completion to work. It gives me this error:
>
> error evaluating 'models' at models.py#4: NameError: global name 'XXX'
> is not defined (C:\Prog..\Active..\lib\mozilla\python\komodo
> \codintel2\tree_python.py#169 in _members_from_elem) (error
> determining completions)
>
> I am on Windows XP, python 2.5, komodo ide 4.0, latest django svn.
> This error appears when you type for example:
>
> class ...
>   name = models.
>
> right after the models "."
>
> any one got this to work or is this a general bug in komodo?
>
> Thanks!


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



Named URL problem

2007-05-10 Thread Olivier Guilyardi

Hi,

Named URLs don't work for me so far. I'm using rev 5180.

In my site's urls.py I have:
(r'^', include('telemeta.urls')),

In telemeta/urls.py:
url(r'^collections/(?P[0-9A-Z._-]+)/?$',
'django.views.generic.list_detail.object_detail',
dict(all_collections, template_name="collection_detail.html"),
name="telemeta-collection-detail"),

The following raise no error and renders nothing:
{% url telemeta-collection-detail p.id %}

Same thing with:
{% url telemeta-collection-detail object_id=p.id %}

What am I doing wrong ?

--
  Olivier

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



Can managers take parameters? Or can you chain a filter in get_object_or_404?

2007-05-10 Thread AndyB

This could quite easily be another dumb question but here goes :(

Can a model have a manager that either takes a parameter or can access
the current logged in user?

I simply want to filter any query sets returned from a table called
Properties depending on the current user without having to catch every
place in the application where I access the Properties table.

Failing that can I still use get_object_or_404 if I want to have two
conditions: pk=something and category=somethingelse

Is there another way of doing this that hasn't occurred to me?

Thanks for anyone's assistance. I'm not grokking something fundamental
about the database api...


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



Abstract class mapped to tables in postgres

2007-05-10 Thread Diego

In my model I have an abstract class ServAbstract and ahother subclass
ServA and ServB derived from ServAbstract.
In the databse It might generate three tables:

table_ServAbstract
table_ServA
table_ServB

, and when by the admin interface I add a new ServA,
table_ServAbstract y table_ServA might be modified.

By the moment I use onoToOne relation betwen table_ServAbstract and
table_ServA , and betwen table_ServAbstract and table_ServB, but I
thing is not the right way.

Any ideas?

Thanks a lot


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



Saving Objects from Models??

2007-05-10 Thread theju

I have a class in a model(shown below).

class Paper_UserReg(models.Model):
def
__init__(self,username,password,name_of_author,email_of_author,college_name,unique_id=None):
self.username = username
self.password = password
self.name_of_author = name_of_author
self.email_of_author = email_of_author
self.college_name = college_name

from uuid import uuid1
self.unique_id = str(uuid1())[:13]

user =
User.objects.create_user(self.username,self.email_of_author,self.password)
return None

class Admin:
list_display =
["name_of_author","college_name","unique_id"]

def __str__(self):
return self.username

name_of_author  = models.CharField(maxlength=50)
email_of_author  = models.EmailField()
college_name  = models.CharField(maxlength=50)
unique_id = models.CharField(maxlength=13)
-
and the corresponding view is:

try:
u =
Paper_UserReg(request.POST['username'],request.POST['password'],request.POST['name_of_author'],request.POST['email_of_author'],request.POST['college_name'],int(request.P
OST['phone_of_author']),None)
#u.save()
except IntegrityError:
return render_to_response("user_details_confirmation.html",
{"user_exists":"User Already Exists"})
return render_to_response("user_created.html",
{"user_created":"Congratulations!!! User created."})


when i run the application, the user is created (and also able to
login in the login page created) and i can see this in the admin pages
whereas the rest of the data ie the name_of_author, phone_of_author
etc are not saved in the Paper_UserRegs page in the admin dashboard(or
in the database also). If i remove the comment on u.save() then i get
an attribute error that says 'Paper_UserReg' object has no attribute
'id'.

What should I do so that both the user is created and the rest of the
fields are also updated in the database?

PS: I could have inherited the User class and created a sub class but
the necessity was such that i had to indulge in such a bad practice.

Thanking in advance
Thejaswi Puthraya
http://thejuhyd.blogspot.com


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



Re: TypeError: expected string or buffer on django.utils.functional.__proxy__

2007-05-10 Thread Sandro Dentella



Thanks a lot for your answer that explained what I was underevaluating.

My example was not the real one and while trying to strip it as simple as
possible I missed to say that I used 'smart_unicode' to get unicode
object... and smart_unicode changed in r4904 to "respect deferred
evaluation".

In my real view I was using gettext, not gettext_lazy but the model has
defined help_text as gettext_lazy so that I have it as a __proxy__ object.

I resorted to use for this particular case the old version of smart_unicode,
could I have done something smarter?

Thanks again
sandro
*:-)


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



Re: assertRedirects

2007-05-10 Thread Russell Keith-Magee

On 5/10/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> On 5/10/07, Jiri Barton <[EMAIL PROTECTED]> wrote:
> >
> > Why does assertRedirects of TestCase succeeds only if the response
> > code is 302? One would think any 3xx should do - they are *redirects*
> > at all. At least, I would think 301 were okay because that is what
> > django.views.generic.simple.redirect_to generates.
> >
> I'll add a configurable argument that allows you to specify alternate
> status codes (defaulting to 302). Thanks for the suggestion.

FYI, I added these arguments in [5179].

Yours,
Russ Magee %-)

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



Re: Komodo and Django - code completion / code intellisensing

2007-05-10 Thread Paul Childs

I'm just guessing here but do you have your project in your
pythonpath?

If not, try this...

To put the project on the sys.path you can do it two ways:

1.  import sys and then write a  line of code sys.path.append("path/to/
project/parent/directory") for example: if the project is located at c:
\idms_project\idms then the way to import would be:
sys.path.append(r"c:\idms_project"), or;

2.  Follow the directions here: 
http://www.imladris.com/Scripts/PythonForWindows.html
to add the path to the PYTHONPATH in the windows registry.

/Paul


On May 9, 1:01 pm, oliver <[EMAIL PROTECTED]> wrote:
> Hi i am evaluating komodo as my django/python ide but i can't get the
> code completion to work. It gives me this error:
>
> error evaluating 'models' at models.py#4: NameError: global name 'XXX'
> is not defined (C:\Prog..\Active..\lib\mozilla\python\komodo
> \codintel2\tree_python.py#169 in _members_from_elem) (error
> determining completions)
>
> I am on Windows XP, python 2.5, komodo ide 4.0, latest django svn.
> This error appears when you type for example:
>
> class ...
>   name = models.
>
> right after the models "."
>
> any one got this to work or is this a general bug in komodo?
>
> Thanks!


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



14 year guy takes on Myspace

2007-05-10 Thread Rico

14 year guy takes on Myspace

http://www.uncov.com/2007/5/10/web-2-0-so-easy-a-14-year-old-can-do-it


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



Re: How can I get the admin interface to not ignore newlines in a text field?

2007-05-10 Thread Alexander Pugachev
Newlines characters do not break lines in HTML. You need  in strings to
show text in few lines in list view.

2007/5/10, Michael Lake <[EMAIL PROTECTED]>:
>
>
> Michael Lake wrote:
> > Alexander Pugachev wrote:
> >>What is the type of the field? It should be TextField?
> >
> > Yes it is:
> >description = models.TextField(core=True)
>
> To be more precise; the new lines do not show when the admin interface
> just displays
> the field but it does show the newlines when you click on the rows ID and
> edit that row.
>
> >>>Hi all
> >>>
> >>>I have a content field which has newlines in it. When I do a select
> from
> >>>the database of that field I get the output like this:
> >>>line 1
> >>>line 2
> >>>
> >>>But when I view this in the admin interface I get
> >>>line 1 line 2
> >>>
> >>>How can I get the admin interface to not ignore newlines?
> >>>
> >>>Mike
>
>
> --
> Michael Lake
> Computational Research Support Unit
> Science Faculty, UTS
> Ph: 9514 2238
>
>
>
>
> >
>

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



Re: widgets.py And unicode

2007-05-10 Thread Thomas Rabaix

Malcolm Tredinnick wrote:
> On Thu, 2007-05-10 at 01:45 +0200, Thomas Rabaix wrote:
>> Hello,
>>
>> I have a newform object which I prepopulate some fields :
>>
>>  form = MenuForm()
>>
>>  tu = ()
>>  for m in Menu.objects.all():
>>  tu += ((m.id,m),)
>>  form.fields['parent_id'].choices = tu
>>
>> In the case of Menu.__str__ return a utf-8 string, the SelectWidget 
>> raise an UnicodeError. To make it work I have to make this changes :
>>
>> --- widgets.py  (revision 5173)
>> +++ widgets.py  (working copy)
>> @@ -168,7 +168,7 @@
>>   for option_value, option_label in chain(self.choices, choices):
>>   option_value = smart_unicode(option_value)
>>   selected_html = (option_value == str_value) and u' 
>> selected="selected"' or ''
>> -output.append(u'%s' % 
>> (escape(option_value), selected_html, escape(smart_unicode(option_label
>> +output.append(u'%s' % 
>> (escape(option_value), selected_html, 
>> escape(smart_unicode(option_label.__str__()
>>   output.append(u'')
>>   return u'\n'.join(output)
>>
>> is it a bug or am i doing something in the wrong way ?
> 
> Sounds like you option_label is wrapped in a gettext_lazy() call, which
> is known not to work (otherwise, adding the extra __str__ wouldn't do
> anything as far as I can see).
> 
> Of course, there are a lot of known problems with unicode handling in
> trunk, which is why we have the unicode branch in development, as
> mentioned here a few times.
> 
> Regards,
> Malcolm
> 
> 
> 
> > 

Well, I have put back the first change in widgets.py and add the this to 
the models.py in newforms

--- models.py   (revision 5173)
+++ models.py   (working copy)
@@ -107,6 +107,8 @@
  fields = SortedDictFromList([(f.name, f.formfield()) for f in 
field_list if f.editable])
  return type('FormForFields', (BaseForm,), {'base_fields': fields})

+from django.utils.encoding import StrAndUnicode, smart_unicode
+
  class QuerySetIterator(object):
  def __init__(self, queryset, empty_label, cache_choices):
  self.queryset, self.empty_label, self.cache_choices = 
queryset, empty_label, cache_choices
@@ -115,7 +117,8 @@
  if self.empty_label is not None:
  yield (u"", self.empty_label)
  for obj in self.queryset:
-yield (obj._get_pk_val(), str(obj))
+   value = smart_unicode(obj.__str__())
+yield (obj._get_pk_val(), value)
  # Clear the QuerySet cache if required.
  if not self.cache_choices:
  self.queryset._result_cache = None

The iterator did not return a unicode string.

And when I populated my form I just do this :
 form = MenuForm()

 tu = ()
 for m in Menu.objects.all():
 tu += ((m.id,smart_unicode(m.__str__())),)
 form.fields['parent_id'].choices = tu

All seems to works fines ...

Thomas Rabaix

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



Re: Feed Displaying Odd Dates

2007-05-10 Thread Malcolm Tredinnick

On Thu, 2007-05-10 at 00:05 -0700, Bryan Veloso wrote:
> > The secret is to look in the syndication documentation and search for
> > the word "pubdate". There, it talks about the item_pubdate() method that
> > can be used to generate the date for a single item.
> 
> I tried that, it'd be...
> 
> def item_pubdate(self)
> return Entry.pub_date
> 
> But it'd give me errors about things being stupid. o_O;
> Okay, errors about the object not having an attribute of pub_date.

Remember that there are multiple ways to specify the publication date
for items. The method you are creating above is one of the two ways to
supply a publication date that is the same for every item in the feed.
It should return a string that is the date you work in some fashion (not
based on individual items).

If you want the publication date to depend on the item, you want the
first type of method described in the documentation (you are using the
second type) in the item_pubdate section:

def item_pubdate(self, item):
return item.pub_date

Notice that this method receives the Entry instance that you can use to
create the date. Your first example, above, tried to extra the attribute
from the model class, not an instance.

Regards,
Malcolm



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



Re: How well should I know Python before using Django?

2007-05-10 Thread Bryan Veloso

> To use Django, a developer should have an  exceptionally strong
> knowledge of the following area(s) of Python: __
>
> dictionaries

Amen. Those things still baffle me a bit. Other than that, I'd say #1.


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



Re: Feed Displaying Odd Dates

2007-05-10 Thread Bryan Veloso

> The secret is to look in the syndication documentation and search for
> the word "pubdate". There, it talks about the item_pubdate() method that
> can be used to generate the date for a single item.

I tried that, it'd be...

def item_pubdate(self)
return Entry.pub_date

But it'd give me errors about things being stupid. o_O;
Okay, errors about the object not having an attribute of pub_date.


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