Re: django.core.management changes

2007-08-30 Thread James Bennett

On 8/30/07, akonsu <[EMAIL PROTECTED]> wrote:
> my script creates a fixture file at FIXTURE_PATH, and then runs the
> reset command on my application. the relevant code is listed below.
> now that i synced to the latest trunk, this code no longer runs
> because the management module has no procedure 'reset'.

If you are following Django's SVN version, *always* keep an eye on the
list of backwards-incompatible changes:

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

Every time something like this happens, we document it. In this case:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Changestomanagement.pycommands

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Django-based forum software?

2007-08-30 Thread Aaron Maxwell

Thanks, everyone.
-Aaron

On Thursday 30 August 2007 09:47:41 Aaron Maxwell wrote:
> Hi,
>
> Does anyone know of a django forum app?  I.e., to build a site providing a
> user forum.
>
> This is kind of hard to search on - try googling for "django forum"...



-- 
Aaron Maxwell
http://redsymbol.net

Business Owners and Self-Employed:  You're NOT Alone!
The Business Butler - http://businessbutler.us

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



Choice field value shows up as none in change_list in admin

2007-08-30 Thread Catriona

Hello

I have a choice field:
interaction_type = models.PositiveIntegerField(choices =
INTERACTION_TYPE, default=0, null = False, blank = False)

which I have made available in the admin interface using
list_display = ( 'interaction_type', 'interaction_date')

The problem is that even though a value is being stored, the name does
not show up in the admin screen - only (None).

How do I show the choice name?

Thanks

Catriona


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



Template Error

2007-08-30 Thread Jesse G. Lands

This only occurs (as far as I have found) when I use the {% block %}
feature of a template.  Anyone know of a reason why?


Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/template/__init__.py" in
render_node
  723. result = node.render(context)
File "/usr/lib/python2.5/site-packages/django/template/loader_tags.py"
in render
  19. context.push()

  AttributeError at /tickets/
  'str' object has no attribute 'push'



-- 
JLands
Arch Current   
Registered Linux User #290053
 When you have accomplished your goal
simply walk away.
This is the path way to Heaven.

--~--~-~--~~~---~--~~
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: Testing/Fixtures/Production/TestRunner

2007-08-30 Thread Chris Green

[ Sorry for long delay,  django is one of my "also projects" ]

On Aug 11, 11:15 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> As for how to fix this problem, I have two suggestions.
>
> 1) Are you sure you can't just fix this with a static fixture?

Yes, that should work just fine.  The reason I added them dynamically
is when I was rebuilding the models and playing around a lot, it
seemed easier to add them by name.

> 2) Alternatively, have you considered using a syncdb 'post_sync'
> trigger? When Django loads an application, it looks for management.py,
> and loads it if it is available. This provides an entry point to
> listen for the 'post_sync' signal.

That's cute.  I just learned of that framework the other day in the
django master slides

> > Since strptime() breaks with dates before 1901, it gets serialized out
> > with dumpdata but fails on a loaddata()
>
> Ok - this looks to be a python problem (although I'm seeing the issue
> with strftime, not strptime). It's worth logging as a ticket so that
> it isn't forgotten.
>
> Although this is a python problem, it is a python problem born of a
> desire to solve Y2K issues by supporting '04' as 1904. Since we are
> only using dates on the backend and in serialization, we can impose
> more rigorous datetime formatting constraints, so we might be able to
> solve this problem by using an alternate strftime/strptime
> implementation that requires 4 digit years. If you want to try your
> hand at this, feel free.


I'll enter a ticket for that one;  I can probably pull something
together as it bites me often enough on a system I have to
interoperate with.


--~--~-~--~~~---~--~~
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: Collapse edit inline?

2007-08-30 Thread Alex Koshelev

No, you can not collapse edit inline block in admin.


--~--~-~--~~~---~--~~
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: Strange encoding behavior

2007-08-30 Thread Michael Radziej

On Thu, Aug 30, Anderson Santos wrote:

> 
> I am still having this issue.
> I have in my settings DEFAULT_CHARSET = "utf-8", and I created a new
> database with UTF-8 encoding (using PGAdmin).
> So I go to admin page, click on my model and then the "add" button, I
> include a special char (á, ç, etc) and I get a Unicode error on both,
> Linux and Windows.
> 
> The error message on Linux is:
> 
> 'utf8' codec can't decode bytes in position 1-2: unexpected end of
> data
> 
> 
> The error message on Windows is:
> 
> 'utf8' codec can't decode bytes in position 1-3: invalid data
> 
> 
> The problem is, it DOES saves the data and displays correctly on the
> listing admin page for the model. The error only occurs when I try to
> edit, on display. If the record don't have any special char, it works
> correctly.
> 
> 
> Both occurs on force_unicode procedure
> 
> 
> When I try to add from manage.py shell onlinux (with or without
> special chars), it raises an error "SET client_encoding to 'UNICODE'"
> in  django/db/backends/postgresql/base.py
> 
> I really have no clue why it's happening. I just updated from svn so I
> have the latest django.
> 
> Any help will be really appreciate

Can you please post the model class, including (if present) __unicode__()
and __str__() functions?

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: django-voting and django-tagging error

2007-08-30 Thread Benoit Chesneau

If you use trunk. problem was fixed.

- benoît

On 8/30/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On 8/30/07, Kelsey Ruger <[EMAIL PROTECTED]> wrote:
> >
> > I just checked out the latest versions of django-voting and django-
> > tagging. When attempting a syncdb I get the following error - tagging:
> > 'DatabaseWrapper' object has no attribute 'ops' or voting:
> > 'DatabaseWrapper' object has no attribute 'ops'. Anyone have an idea
> > on what this is?
> >
>
> What version of Django are you using?  This recently changed on django's 
> trunk:
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Refactoreddatabasebackends
>
> ... And this note on django-tagging's homepage:
> "
> Post version 0.1, django-tagging requires a recent SVN checkout of
> Django as it's tracking Backwards Incompatible Changes made to Django
> since 0.96.
> "
>
> >
>


-- 
bchesneau.info | neurofriends.net | osbud.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-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
-~--~~~~--~~--~--~---



Collapse edit inline?

2007-08-30 Thread [EMAIL PROTECTED]

I've got a Model that I'm editing inline, but it's not used often. Any
way I can collapse it?
I know there's
class Admin:
fields = (
('Date information', {'fields': ('pub_date',), 'classes':
'collapse'}),
)
But I don't think that'll work for something being edited inline.


--~--~-~--~~~---~--~~
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: django-voting and django-tagging error

2007-08-30 Thread Jeremy Dunck

On 8/30/07, Kelsey Ruger <[EMAIL PROTECTED]> wrote:
>
> I just checked out the latest versions of django-voting and django-
> tagging. When attempting a syncdb I get the following error - tagging:
> 'DatabaseWrapper' object has no attribute 'ops' or voting:
> 'DatabaseWrapper' object has no attribute 'ops'. Anyone have an idea
> on what this is?
>

What version of Django are you using?  This recently changed on django's trunk:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Refactoreddatabasebackends

... And this note on django-tagging's homepage:
"
Post version 0.1, django-tagging requires a recent SVN checkout of
Django as it's tracking Backwards Incompatible Changes made to Django
since 0.96.
"

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



Unicode JSON Serialization Bug?

2007-08-30 Thread mynameisgabe

Hello All-

I've been told that I may have encountered a bug - I'm trying to
serialize a model that includes fields that could be unicode data.
Here is the information I collected.  Let me know if there's anything
else that would be helpful.

Specs of the local dev workstation - having the same issues in prod
using Linux/FastCGI:

Windows XP Home Edition Version 2002 SP 2
Python 2.4.4
Latest Django from SVN: 0.97-pre-SVN-6024
SQLite3
Using internal django web server (for dev)

Here's the traceback:

Traceback (most recent call last):
File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
get_response
 77. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Documents and Settings\Gabe Harriman\My
Documents\dev\texty\cms\views.py" in syndicate
 178. comments = serializers.serialize("json",
texty.comment_set.all(), fields=('name','comment','created_date',),
ensure_ascii=False)
File "C:\Python24\lib\site-packages\django\core\serializers
\__init__.py"
in serialize
 67. s.serialize(queryset, **options)
File "C:\Python24\lib\site-packages\django\core\serializers\base.py"
in serialize
 50. self.end_serialization()
File "C:\Python24\lib\site-packages\django\core\serializers\json.py"
in end_serialization
 26. simplejson.dump(self.objects, self.stream,
cls=DjangoJSONEncoder, **self.options)
File "C:\Python24\lib\site-packages\django\utils\simplejson
\__init__.py" in dump
 139. fp.write(chunk)

 UnicodeEncodeError at /cms/syndicate/d5f8eba5-d4a8-4590-
a3d9-4d9e34503c5b.js
 'ascii' codec can't encode characters in position 1-7: ordinal not
in range(128)


Unicode error hint:
The string that could not be encoded/decoded was: "ﺥﺾﻤﻼﺚﻴﻴ"

As you can see from above, the error starts here:

comments = serializers.serialize("json", texty.comment_set.all(),
fields=('name','comment','created_date',), ensure_ascii=False)

The data in the name field is "ﺥﺾﻤﻼﺚﻴﻴ".  The rest is normal ascii
data.

Let me know if this looks like a bug or not.  If not, I'll keep
hacking away on my end.  Sorry if I left anything out - I'm new to
this whole unicode thing.


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



django-voting and django-tagging error

2007-08-30 Thread Kelsey Ruger

I just checked out the latest versions of django-voting and django-
tagging. When attempting a syncdb I get the following error - tagging:
'DatabaseWrapper' object has no attribute 'ops' or voting:
'DatabaseWrapper' object has no attribute 'ops'. Anyone have an idea
on what this is?


--~--~-~--~~~---~--~~
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: @url tag - getting rid of urlpatterns

2007-08-30 Thread Gary Wilson

On Aug 30, 3:08 am, Ilya Semenov <[EMAIL PROTECTED]> wrote:
> Second, I think the use of generic views is over-estimated.

I tend to agree a bit here.  I like having all my URLs in one file and
all my views in another.  Using generic views usually clutters the
urls file too much for me.  Generic views usually don't save enough
code to be worth it in my experience, it just moves the code to a
different place.  Also, if I ever wanted to change the view up to do
more custom things, I would have to undue the generic view setup and
create a regular view anyway, so why not just do that in the first
place.

> > 2. One of the best things (again, in my opinion) of urls.py is that it
> > shows whole user interface of an app in one place. You loose this
> > feature with decorators scattered all over views.

Yes, I think this is a very nice thing about having a file dedicated
to url conf.  It give you a nice summary of what the application does
and how it's organized.  I would not like having to scan through all
my views to figure out the URL structure.

> While I see the rationale in your words, that position is very
> arguable.
>
> Encapsulation is one of the greatest programming principles. From the
> architectural point of view, the app-level urls.py shouldn't bother
> what members area urls are there in members module, since it can
> safely delegate the responsibility to manage the list of members urls
> and just pull the data when needed.

Isn't this what include() is for:
(r'^members/', include('myapp.members'))

All the members URLs can be encapsulated in the members module.

Gary


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Strange encoding behavior

2007-08-30 Thread Anderson Santos

I am still having this issue.
I have in my settings DEFAULT_CHARSET = "utf-8", and I created a new
database with UTF-8 encoding (using PGAdmin).
So I go to admin page, click on my model and then the "add" button, I
include a special char (á, ç, etc) and I get a Unicode error on both,
Linux and Windows.

The error message on Linux is:

'utf8' codec can't decode bytes in position 1-2: unexpected end of
data


The error message on Windows is:

'utf8' codec can't decode bytes in position 1-3: invalid data


The problem is, it DOES saves the data and displays correctly on the
listing admin page for the model. The error only occurs when I try to
edit, on display. If the record don't have any special char, it works
correctly.


Both occurs on force_unicode procedure


When I try to add from manage.py shell onlinux (with or without
special chars), it raises an error "SET client_encoding to 'UNICODE'"
in  django/db/backends/postgresql/base.py

I really have no clue why it's happening. I just updated from svn so I
have the latest django.

Any help will be really appreciate


cheers


Anderson




On 29 ago, 18:30, Anderson Santos <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I am migrating a stable lighttpd+fcgi django app to apache+mod_python
> and I am dealing with a strange encoding behavior. Here what I did:
>
> With a plain migration from the working app to the new mod_python one
> I got a lot of LATIN1 codec errors that never occured on the last
> architecture.  So, I decided to migrate everything to UTF-8.
>
> - I had a Latin1 encoded Postgresql database. I backed it up, created
> a new one with utf-8 encoding and restored the data
> - I changed the settings to DEFAULT_CHARSET = UTF-8
>
> Now everything is fine: flatpages, admin in general, etc, except when
> I click to edit a record on admin interface it raises the error:
>
> UnicodeDecodeError at /admin/suporte/download/95/
> 'utf8' codec can't decode bytes in position 8-10: invalid data
>
> Unicode error hint
>
> The string that could not be encoded/decoded was: aliza??o de B
>
> Template error
>
> In template /srv/djprojects/django_src_trunk/django/contrib/admin/
> templates/admin/change_form.html, error at line 15
>
> Traceback (innermost last)
> Switch back to interactive view
>
> * /srv/djprojects/django_src_trunk/django/template/__init__.py in
> render_node
>747.
>748. def render_node(self, node, context):
>749. return node.render(context)
>750.
>751. class DebugNodeList(NodeList):
>752. def render_node(self, node, context):
>753. try:
>754. result = node.render(context) ...
>755. except TemplateSyntaxError, e:
>756. if not hasattr(e, 'source'):
>757. e.source = node.source
>758. raise
>759. except Exception, e:
>760. from sys import exc_info
>
> Traceback (most recent call last):
> File "/srv/djprojects/django_src_trunk/django/template/__init__.py" in
> render_node
>   754. result = node.render(context)
> File "/srv/djprojects/django_src_trunk/django/template/__init__.py" in
> render
>   790. return self.filter_expression.resolve(context)
> File "/srv/djprojects/django_src_trunk/django/template/__init__.py" in
> resolve
>   603. obj = func(obj, *arg_vals)
> File "/srv/djprojects/django_src_trunk/django/template/
> defaultfilters.py" in _dec
>   25. args[0] = force_unicode(args[0])
> File "/srv/djprojects/django_src_trunk/django/utils/encoding.py" in
> force_unicode
>   39. s = unicode(str(s), encoding, errors)
>
>   UnicodeDecodeError at /admin/suporte/download/95/
>   'utf8' codec can't decode bytes in position 8-10: invalid data
>
> """
>
> But when displayed on admin list for the model, it displays the
> encoding correctly, even the special chars. The line in template is
> the following:
>
> 
> #...
> {% if add %}{% trans "Add" %} {{ opts.verbose_name|escape }}{% else %}
> {{ original|truncatewords:"18"|escape }}{% endif %}
> #...
>
> When I click on a record that don't have special char, it works fine
> for editing, the error just occur with records with special chars.
> Again, the listing displays without problem, it seems to be a problem
> to force unicode procedure on template system.
>
> I appreciate any help.
>
> Cheers,
>
> Anderson


--~--~-~--~~~---~--~~
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: Django-based forum software?

2007-08-30 Thread Jarek Zgoda

At some point of time we decided to use this software in our product,
but now it's clear it would be more feasible to write something like
that on our own. It's very hard to customize and does not play good
with current django auth framework.

On 30 Sie, 18:50, daev <[EMAIL PROTECTED]> wrote:
> http://code.google.com/p/diamanda/


--~--~-~--~~~---~--~~
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: Stand-alone Django ORM question

2007-08-30 Thread Abhijit Choudhury
Thanks, I had to create mysite/app, add mysite.app to the INSTALLED_APPS and 
then run django_admin.py syncdb to create the tables. Is there a programmatic 
way to create the tables?

BTW, the class Meta app_name did not seem to work.

Thanks again,
Abhijit

- Original Message 
From: daev <[EMAIL PROTECTED]>
To: Django users 
Sent: Thursday, August 30, 2007 11:47:31 AM
Subject: Re: Stand-alone Django ORM question


Define app_name in Meta nested-class:

class Meta:
app_name = "some_name"










   

Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail=summer+activities+for+kids=bz
 
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Seeking Django Developer

2007-08-30 Thread Jeremy Rue

Hi Guys,

I hope this is the appropriate venue to send this out to. If not, I
apologize for the spam; it's the only message I will send out.

We're looking for two web developers at the UC Berkeley Graduate School of
Journalism, one who specializes in Django/Python. I've included the job
description in this e-mail, and perhaps people can pass it along to anyone
they know who might be interested in the San Francisco Bay Area.

The description might be a little ambiguous because we were forced
to put both positions -- a web master, and a web application developer --
into one description. We can answer any additional questions about the
position.

Thanks for your time,

Jeremy Rue
Multimedia Training Instructor
Knight Digital Media Center
UC Berkeley Graduate School of Journalism
http://journalism.berkeley.edu
(510)643-1927



The University of California, Berkeley, Graduate School of Journalism is
seeking a Web Developer.

The Web Developer will work on a team managing the technical needs for our
growing suite of websites. These include the School's main public website
and private intranet, as well as sites for various School-related
programs, such as the Knight Digital Media Center, the News Initiative for
the Future of Journalism, the Center for Citizen Media, and China Digital
Times.

The candidate will assist with smaller websites connected to the School's
classes. The team responds to the needs of faculty, staff, and students,
working as necessary with department coordinators, instructors, and the
system administrator. This is primarily a technical, rather than an
editorial or design position. However, editorial and design experience is
advantageous.

The School relies heavily on PHP/MySQL web database applications, both
open source and custom built. The incumbent must have strong PHP/MySQL
development experience, as well as a solid working knowledge of HTML, CSS,
and some JavaScript. One of the projects is built on Python (Django),
therefore Python experience is desired.

The School is solely Macintosh-based and runs its own Apple XServes, so
prospective candidates must be Mac-friendly and Unix-capable. Since we
manage our own web server, candidates with Apache configuration experience
are desired. The School also webcasts a regular schedule of live events so
some familiarity with video compression and media streaming techniques is
preferred.

Responsibilities:
- Manage and upgrade the School's main website and intranet, and assist
with smaller websites connected to the School's classes and other related
programs
- Create secure and stable web applications built on open standards
- Prioritize requests coming from multiple sources and respond to the
needs of faculty, staff, and students
- Work closely with department coordinators, instructors, and the system
administrator
- Assist students with web development questions

The University of California, Berkeley is an Equal Opportunity Employer.
We offer a diverse working environment, competitive salaries, and
comprehensive benefits.

Experience required:

Requirements:

- Experience with PHP web application development and MySQL database
administration
- Expertise with HTML and CSS
- Experience in working with or building content management systems and/or
customizing WordPress themes or plug-ins, or a similar publishing platform
- Experience with Apple OS; Linux or Windows users who are adaptable and
learn quickly may qualify
- Excellent verbal and written communication and interpersonal skills
- Experience with Unix or Mac OS X server administration

Preferred:
- Experience with Python and streaming media servers
- Proficient graphical web design and writing/editorial skills
- Experience in working with frameworks, such as Rails, Django, or
Symfony, and configuring and managing Apache
- Ability to work with Macromedia Dreamweaver and programming languages,
such as Perl
- Experience in working with journalists or within a news media organization

The annual salary range for this position is $47,844 - $70,000 plus
excellent University of California benefits.

This is a full-time position.

How to apply:

Apply online at: http://jobs.berkeley.edu

Search for job code 7045.

Web site: http://jobs.berkeley.edu



--~--~-~--~~~---~--~~
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: unique_together and composite columns indexing

2007-08-30 Thread Peter Melvyn

On 8/30/07, Peter Melvyn <[EMAIL PROTECTED]> wrote:

> 2.a If I let MySQL to explain a select command from such table, there is no
>composite index listed
> 2.a If I create a composite index by explicit command, it is listed by explain
>command among available indices

You are right: I inspected indices using SHOW INDEX FOR  command
and I can see now there is really composite index created internally.

Peter

--~--~-~--~~~---~--~~
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: unique_together and composite columns indexing

2007-08-30 Thread Peter Melvyn

On 8/30/07, Nis Jørgensen <[EMAIL PROTECTED]> wrote:

> > CREATE INDEX `xxx_amodel_col_a_col_b`
> >ON `wss_amodel` (`col_a`,`col_b`);
>
> Postgresql will implicitly generate this index when it encounters the
> UNIQUE constraint. My guess is that other backends will do the same.

Are you sure? I don't have PostgreSQL installed, but it seems that
SQLite3 and MySQL5 do not create a composite index on UNIQUE
constraint automatically:

1.a If I inspect sqlite_master table or use .indices command, there is no
   composite index
1.b If I create a composite index by explicit command, it appears in
   sqlite_master table and is listed by .indices command

2.a If I let MySQL to explain a select command from such table, there is no
   composite index listed
2.a If I create a composite index by explicit command, it is listed by explain
   command among available indices

Peter

--~--~-~--~~~---~--~~
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: admin site and parent/child relationship

2007-08-30 Thread Lic. José M. Rodriguez Bacallao
ok, thanks

On 8/30/07, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
>
> There is no way to do so in django admin now.
>
>
> >
>


-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic por
profesionales
-

--~--~-~--~~~---~--~~
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: admin site and parent/child relationship

2007-08-30 Thread Alex Koshelev

There is no way to do so in django admin now.


--~--~-~--~~~---~--~~
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: django.core.management changes

2007-08-30 Thread akonsu

Alex, thanks for your help.

the code that worked is:

call_command('reset', 'myapp', interactive = False)
call_command('loaddata', FIXTURE_PATH, verbosity = 0)

cheers
konstantin


On Aug 30, 2:51 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> try this:
>
> from django.core.management import call_command
> call_command( "reset", models.get_app('myapp'), interactive = False )
> call_command( "load_data", [FIXTURE_PATH], verbosity = 0 )


--~--~-~--~~~---~--~~
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: Newbie with generic views

2007-08-30 Thread Mike Atlas

I'm on my way. Thanks...sometimes asking the right question is the
best way to answer it for yourself :(

competitor_list.html
=
{% extends "base.html" %}
{% block content %}


{% for object in object_list %}
{{ object.fullname }}
{% endfor %}

{% endblock %}
=

On Aug 30, 3:04 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> What is field.choices ? object_list doesn't pass _field_ variable to
> context.http://www.djangoproject.com/documentation/generic_views/#django-view...
> see Template context section


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



admin site and parent/child relationship

2007-08-30 Thread Lic. José M. Rodriguez Bacallao
Hi people, I got a little problem with the admin page, I have models to
represent Country/State situation and a Person model that reference  Country
and State models but I want in admin that when I change a country of a
person, the list of states get updated to states of that country. How can I
do that?

-- 
Lic. José M. Rodriguez Bacallao
Cupet
-
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo
mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic por
profesionales
-

--~--~-~--~~~---~--~~
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: Newbie with generic views

2007-08-30 Thread Mike Atlas

Hmm...

Looks like I need to access the object_list context... that seems to
be the first step that I'm missing...

I understand better somewhat already...although a link to any
resources anyone might know of would be nice...

Thanks.

Mike

On Aug 30, 2:59 pm, Mike Atlas <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I'm trying to make a generic view to see some data, and I'm having
> some trouble.
>
> I have some objects already in the database for the model I'm trying
> to generate this for.
>
> Here's my urls.py:
> #=
> from django.conf.urls.defaults import *
> from django.views.generic.list_detail import object_list
> from mysite.myapp.models import Competitor
>
> competitor_list_info = {
> 'queryset' :   Competitor.objects.all(),
> 'allow_empty': True,
> 'template_name': 'competitor_list.html'
>
> }
>
> urlpatterns = patterns('',
>  #snip#
>  (r'competitors/$', object_list, competitor_list_info)
> )
> #=
>
> And here's my simple template, competitor_list.html:
> #=
> {% extends "base.html" %}
> {% block content %}
> 
> {% for choice in field.choices %}
>  href="{{ choice.url }}">{{ choice.label|escape }}
> {% endfor %}
> 
> {% endblock %}
> #=
>
> And I get no output...
>
> What am I missing here? Can someone point me in the right direction? I
> can't seem to find any good documentation on writing templates for
> generic views.
>
> Thanks,
>
> Mike


--~--~-~--~~~---~--~~
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: Newbie with generic views

2007-08-30 Thread Alex Koshelev

What is field.choices ? object_list doesn't pass _field_ variable to
context.
http://www.djangoproject.com/documentation/generic_views/#django-views-generic-list-detail-object-list
see Template context section


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



Newbie with generic views

2007-08-30 Thread Mike Atlas

Hi guys,

I'm trying to make a generic view to see some data, and I'm having
some trouble.

I have some objects already in the database for the model I'm trying
to generate this for.

Here's my urls.py:
#=
from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_list
from mysite.myapp.models import Competitor

competitor_list_info = {
'queryset' :   Competitor.objects.all(),
'allow_empty': True,
'template_name': 'competitor_list.html'
}

urlpatterns = patterns('',
 #snip#
 (r'competitors/$', object_list, competitor_list_info)
)
#=


And here's my simple template, competitor_list.html:
#=
{% extends "base.html" %}
{% block content %}

{% for choice in field.choices %}
{{ choice.label|escape }}
{% endfor %}

{% endblock %}
#=

And I get no output...

What am I missing here? Can someone point me in the right direction? I
can't seem to find any good documentation on writing templates for
generic views.

Thanks,

Mike


--~--~-~--~~~---~--~~
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: django.core.management changes

2007-08-30 Thread Alex Koshelev

try this:

from django.core.management import call_command
call_command( "reset", models.get_app('myapp'), interactive = False )
call_command( "load_data", [FIXTURE_PATH], verbosity = 0 )


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



django.core.management changes

2007-08-30 Thread akonsu

hello,

my script creates a fixture file at FIXTURE_PATH, and then runs the
reset command on my application. the relevant code is listed below.
now that i synced to the latest trunk, this code no longer runs
because the management module has no procedure 'reset'.

what is the proper way to do what i want now?

please help.
thanks.

konstantin

from django.core import management

management.reset(models.get_app('myapp'), interactive = False)
management.load_data([FIXTURE_PATH], verbosity = 0)


--~--~-~--~~~---~--~~
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: dynamic filtering in a QuerySet

2007-08-30 Thread daev

Use strings instead of unicode. Key word arguments names must be
strings.


--~--~-~--~~~---~--~~
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: dynamic filtering in a QuerySet

2007-08-30 Thread Greg Donald

On 8/30/07, daev <[EMAIL PROTECTED]> wrote:
>
> widgets = widgets.filter( **filters )

When I try that I get the error:

filter() keywords must be strings

Does that have anything to do with the fact that they are unicode?

filters: {u'LOB': u'B'}



-- 
Greg Donald
http://destiney.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: Django-based forum software?

2007-08-30 Thread Nicolas Steinmetz

Aaron Maxwell a écrit :
> Hi,
> 
> Does anyone know of a django forum app?  I.e., to build a site providing a 
> user forum.
> 
> This is kind of hard to search on - try googling for "django forum"...
> 





Regards,
Nicolas


--~--~-~--~~~---~--~~
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: Django-based forum software?

2007-08-30 Thread Empty

http://code.google.com/p/counterpoint/

Empty
blog.michaeltrier.com

On 8/30/07, daev <[EMAIL PROTECTED]> wrote:
>
> http://code.google.com/p/diamanda/
>
>
>
> >
>

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



Django-based forum software?

2007-08-30 Thread Aaron Maxwell

Hi,

Does anyone know of a django forum app?  I.e., to build a site providing a 
user forum.

This is kind of hard to search on - try googling for "django forum"...

-- 
Aaron Maxwell
http://redsymbol.net

Business Owners and Self-Employed:  You're NOT Alone!
The Business Butler - http://businessbutler.us

--~--~-~--~~~---~--~~
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: Django-based forum software?

2007-08-30 Thread daev

http://code.google.com/p/diamanda/


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



dynamic filtering in a QuerySet

2007-08-30 Thread Greg Donald

How can I apply dynamic filtering to a Django QuerySet?

widgets = Widget.objects.all()[:10]
filters = {'foo':1,'bar':1,'baz':1}
for f in filters:
widgets = widgets.filter(f=filters[f])

This breaks down because I can't figure out how to use an expression
as a named parameter.

I've tried eval() and all sort of back tick and quoting combinations,
nothing seems to work.

Thanks,


-- 
Greg Donald
http://destiney.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: dynamic filtering in a QuerySet

2007-08-30 Thread daev

widgets = widgets.filter( **filters )


--~--~-~--~~~---~--~~
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: Stand-alone Django ORM question

2007-08-30 Thread daev

Define app_name in Meta nested-class:

class Meta:
app_name = "some_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
-~--~~~~--~~--~--~---



Re: django under 2.5

2007-08-30 Thread Alvaro Mouriño

On 8/30/07, John Shaffer <[EMAIL PROTECTED]> wrote:
>
> On 8/28/07, Alvaro Mouriño <[EMAIL PROTECTED]> wrote:
> > I have been running django under python 2.4 but now I'm considering
> > switching to 2.5. Are there any known compatibility issues? Or is it
> > just straightforward?
>
> Django itself should work fine. Usually your apps and projects will
> work without any changes, but you should always check the docs:
> http://docs.python.org/whatsnew/porting.html
>
Thanks everyone! I was a bit afraid of switching, but I guess that
would be easier to fix what stops working than downgrade 3rd party
apps to 2.4.

AlvAro

"You can't change the world, but you can change your mind."
Software Libre: El conocimiento no puede tener dueño.

--~--~-~--~~~---~--~~
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: Stand-alone Django ORM question

2007-08-30 Thread canen

I'm not sure but maybe you need the INSTALLED_APPS setting.


On Aug 30, 10:21 am, ceeed <[EMAIL PROTECTED]> wrote:
> Hello,
> I am a Django newbie and trying to learn it.
>
> As a project, I am trying to use the Django ORM in a stand-alone sense
> (i.e., without creating a project and app). I am using SQLITE and have
> defined the models. I would like to a) create the table in the
> database based on my models, b) populate the table, and c) do queries.
>
> I am running into various problems. My models.py file looks like this:
>
> from django.db import models
> class Template(models.Model):
> name = models.CharField("Name of template", max_length=30)
> type = models.CharField("Type of template", max_length=10)
> style = models.CharField("Style of template", max_length=10)
> def __unicode__(self): return u'%s' % self.name
>
> My settings file looks like this
>
> DEBUG = True
> DATABASE_ENGINE = 'sqlite3'   # 'postgresql_psycopg2',
> 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
> DATABASE_NAME = '/Users/abhijit/moad.db' # Or path to
> database file if using sqlite3.
> DATABASE_USER = '' # Not used with sqlite3.
> DATABASE_PASSWORD = '' # Not used with sqlite3.
> DATABASE_HOST = '' # Set to empty string for localhost.
> Not used with sqlite3.
> DATABASE_PORT = '' # Set to empty string for default. Not
> used with sqlite3.
>
> I tried the following:
>
> abhijit$ python
> Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
> [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import os
> >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'moad_settings'
> >>> from django.db import models
> >>> from models import *
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "models.py", line 6, in 
> class Template(models.Model):
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/db/models/base.py", line 51, in __new__
> new_class._meta.app_label = model_module.__name__.split('.')[-2]
> IndexError: list index out of range
>
>
>
> Any help/pointers would be appreciated.
> Thanks,


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



Re: template image problem

2007-08-30 Thread Tim Chase

> Static content is served by http server not django.
> http://www.djangoproject.com/documentation/static_files/

For development purposes, in my urls.py after defining all my 
"business" urls, I have

from sys import argv
if 'runserver' in argv:
 urlpatterns += patterns('',
 (r'^media/(?P.*)$',
 'django.views.static.serve',
 {'document_root': settings.MEDIA_ROOT}
 ),
 # a couple other debugging tools here
 )

which allows me to serve media in development, but in my 
production environment (mod_python+apache), it doesn't offer 
those URL patterns because they're handled by apache alone.

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



Stand-alone Django ORM question

2007-08-30 Thread ceeed

Hello,
I am a Django newbie and trying to learn it.

As a project, I am trying to use the Django ORM in a stand-alone sense
(i.e., without creating a project and app). I am using SQLITE and have
defined the models. I would like to a) create the table in the
database based on my models, b) populate the table, and c) do queries.

I am running into various problems. My models.py file looks like this:

from django.db import models
class Template(models.Model):
name = models.CharField("Name of template", max_length=30)
type = models.CharField("Type of template", max_length=10)
style = models.CharField("Style of template", max_length=10)
def __unicode__(self): return u'%s' % self.name

My settings file looks like this

DEBUG = True
DATABASE_ENGINE = 'sqlite3'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '/Users/abhijit/moad.db' # Or path to
database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

I tried the following:

abhijit$ python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['DJANGO_SETTINGS_MODULE'] = 'moad_settings'
>>> from django.db import models
>>> from models import *
Traceback (most recent call last):
  File "", line 1, in 
  File "models.py", line 6, in 
class Template(models.Model):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/django/db/models/base.py", line 51, in __new__
new_class._meta.app_label = model_module.__name__.split('.')[-2]
IndexError: list index out of range
>>>

Any help/pointers would be appreciated.
Thanks,


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



Re: newforms __init__

2007-08-30 Thread Jökull

Awesome. Thanks!

BTW it's right there in the documentation. Apologies.

http://www.djangoproject.com/documentation/newforms/#using-a-subset-of-fields-on-the-form

On Aug 30, 3:40 pm, daev <[EMAIL PROTECTED]> wrote:
> То remove fields from from you don't need to use __init__
> form_for_model, form_for_instance function has _fields_ parameter
> where you can specify all the fields you need/ Example:
>
> Form  = form_for_model( Article, fields = ( "title", "text",
> "tags" ) )
>
> Creates form with this three fields of 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: newforms __init__

2007-08-30 Thread daev

То remove fields from from you don't need to use __init__
form_for_model, form_for_instance function has _fields_ parameter
where you can specify all the fields you need/ Example:

Form  = form_for_model( Article, fields = ( "title", "text",
"tags" ) )

Creates form with this three fields of 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
-~--~~~~--~~--~--~---



newforms __init__

2007-08-30 Thread Jökull

Does anyone have a code example of __init__ where you modify a
form_for_inst/model to remove some fields? I'm trying to build an edit
form but don't want to expose all fields of the model. Maybe I missed
it but I didn't see this scenario covered in the newforms
documentation.

Is this maybe not the right way to go about this kind of scenario. I
thought of building a custom form that closely mirrors the model and
then tying it into an instance at the end before saving.

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: Keeping track of the original values for a record...

2007-08-30 Thread [EMAIL PROTECTED]

Blah... I could have sworn that worked when I tried it yesterday.
but when I went to start working on it today..that method is returning
the changed values as well... very strange... I might have to resort
to calling the values from the DB again before doing a save :(

On Aug 29, 4:34 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Maybe it's a bug in my branch..I'm using the multiple db branch... but
> the other method Mike pointed out appears to work.  Tomorrow I'm going
> to tie it all together and have my save method only fire save if there
> are dirty fields, and log what data has been changed into my event
> table...
>
> Thanks again everyone!
>
> On Aug 29, 4:13 pm, Doug B <[EMAIL PROTECTED]> wrote:
>
> > Hmm.  It works in shell for me, I'm not sure what the difference might
> > be.  It only keeps _original_data for the life of the instance, so if
> > the view completes, the next view is a different instance.  You could
> > make a pickle field to persist it, if you wanted to keep track of the
> > changed values.
>
> > In [2]: m=cm.MarketingStatus(marketing_status_name="Test Name",
> > marketing_status_description="Testing signals")
> > In [3]: m.save()
> > In [4]: m.marketing_status_name="Changed this"
> > In [5]: m.marketing_status_name
> > Out[5]: 'Changed this'
> > In [6]: m._original_data['marketing_status_name']
> > Out[6]: 'Test Name'
>
> > I added a couple print statements to print testing and testing 2 in
> > the save method:
>
> > In [2]: m=cm.MarketingStatus.objects.all()[0]
> > In [3]: m.marketing_status_name = "changed again"
> > In [4]: m.save()
> > testing: Test Name
> > testing2: changed again
>
> > - using this code 
> > def backup_model_data(sender, instance, signal, *args, **kwargs):
> >  instance._original_data = instance.__dict__.copy()
>
> > class MarketingStatus(models.Model):
> > marketing_status_id = models.AutoField(primary_key=True)
> > marketing_status_name = models.CharField(blank=True, maxlength=30)
> > marketing_status_description =
> > models.CharField(blank=True,maxlength=255)
>
> > def save(self):
> > testing =self._original_data['marketing_status_name']
> > testing2 = self.marketing_status_name
> > print "testing: %s" % testing
> > print "testing2: %s" % testing2
> > super(MarketingStatus, self).save()
>
> > dispatcher.connect(backup_model_data,signal=signals.post_init,sender=MarketingStatus)


--~--~-~--~~~---~--~~
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: Internet Explorer, sessions, django on 64-bit machine

2007-08-30 Thread Jarek Zgoda

Jarek Zgoda napisał(a):

> I just got into some strange problem with session and its cookies.
> 
> I have 2 instances of the same app, one running on 64-bit Ubuntu 6.06
> and the second on 32-bit Ubuntu 6.10, both under Django 0.96. Neither
> Firefox or Opera shows any problems, but in Internet Explorer (both 6
> and 7) the session behaves as if it wouldn't be saved sometimes (?!) on
> 64-bit machine. The session cookies for 64-bit machine based app have
> additionally all this __utma .. __utmz items, not found in cookies for
> 32-bit machine.
> 
> Anybody experienced similar weirdness?

More findings:

 - the subdomain cookies are messed with domain cookies in IE.

But still, this does not explain why the application behaves properly
(?!) on 32-bit machines.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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: django under 2.5

2007-08-30 Thread John Shaffer

On 8/28/07, Alvaro Mouriño <[EMAIL PROTECTED]> wrote:
> I have been running django under python 2.4 but now I'm considering
> switching to 2.5. Are there any known compatibility issues? Or is it
> just straightforward?

Django itself should work fine. Usually your apps and projects will
work without any changes, but you should always check the docs:
http://docs.python.org/whatsnew/porting.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: unique_together and composite columns indexing

2007-08-30 Thread Nis Jørgensen

Peter Melvyn skrev:
> Hi all,
>
> if I'm not mistaken, if I have a model with unique constraint
> 'unique_together', Django does not support composite index of related
> columns, i.e.
>
> class AModel (models.Model):
> col_a = models.CharField(maxlength=20, db_index=True)
> col_b = models.CharField(maxlength=20, db_index=True)
> class Meta:
> unique_together = (('col_a','col_b'),)
>
> generates SQL commands:
>
> CREATE TABLE `xxx_amodel` (
> `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
> `col_a` varchar(20) NOT NULL,
> `col_b` varchar(20) NOT NULL,
> UNIQUE (`col_a`, `col_b`)
> );
> CREATE INDEX `xxx_amodel_col_a` ON `wss_amodel` (`col_a`);
> CREATE INDEX `xxx_amodel_col_b` ON `wss_amodel` (`col_b`);
>
>
> Should not be there another meta command, e.g.
>
> indexed_together = (('col_a','col_b'),)
>
> producing index
>
> CREATE INDEX `xxx_amodel_col_a_col_b`
>ON `wss_amodel` (`col_a`,`col_b`);

Postgresql will implicitly generate this index when it encounters the
UNIQUE constraint. My guess is that other backends will do the same.

A more interesting case is when you want to create multifield indices
which aren't unique. Your syntax could be used for this.

Nis






--~--~-~--~~~---~--~~
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: Internet Explorer, sessions, django on 64-bit machine

2007-08-30 Thread Jarek Zgoda

James Bennett napisał(a):

>> The session cookies for 64-bit machine based app have
>> additionally all this __utma .. __utmz items, not found in cookies for
>> 32-bit machine.
>>
>> Anybody experienced similar weirdness?
> 
> The "utma", "utmz", etc. cookies are not set by Django. They are set
> by the web stats system formerly known as Urchin and now known as
> Google Analytics.

OK, I missed my guess. But the app still behaves differently on both
machines wrt FF + Opera vs IE6 + IE7.

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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: is possible to only select the specified fields?

2007-08-30 Thread Diego pylorca

aha

Great, exelent!

and now the question is:

can I get a model instance from a dict without pick the database?


class Entry(models.Model):
e1 = models.x()
e2 = models.x()
e3 = models.y()

def crazymethod(self):
return "blah blah %s" % self.e2

>>> qsv = Entry.objects.values('e1', 'e2')
>>> EntryObject = Entry.somemetohd(qsv[0])
>>>





On 8/30/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 8/29/07, Diego pylorca <[EMAIL PROTECTED]> wrote:
> > ok, but this not return a querySet, return a  dictionary :S
>
> Read the documentation more carefully. Specifically:
>
> > Returns a ValuesQuerySet -- a QuerySet that evaluates to a list
> > of dictionaries instead of model-instance objects.
>
> And:
>
> > Finally, note a ValuesQuerySet is a subclass of QuerySet, so it has all
> > methods of QuerySet. You can call filter() on it, or order_by(), or 
> > whatever.
>
>
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
>
> >
>


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



Re: Internet Explorer, sessions, django on 64-bit machine

2007-08-30 Thread James Bennett

On 8/30/07, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> The session cookies for 64-bit machine based app have
> additionally all this __utma .. __utmz items, not found in cookies for
> 32-bit machine.
>
> Anybody experienced similar weirdness?

The "utma", "utmz", etc. cookies are not set by Django. They are set
by the web stats system formerly known as Urchin and now known as
Google Analytics.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: dynamic links

2007-08-30 Thread Rufman

never mind...i found my error after i got th pydev debugger to work
with django. I didn't know that i was getting the whole object...i was
under the impression i was just getting the primary key.

i have to say django is really neat!!


jake, thx for your help


greets

stephane


--~--~-~--~~~---~--~~
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: is possible to only select the specified fields?

2007-08-30 Thread James Bennett

On 8/29/07, Diego pylorca <[EMAIL PROTECTED]> wrote:
> ok, but this not return a querySet, return a  dictionary :S

Read the documentation more carefully. Specifically:

> Returns a ValuesQuerySet -- a QuerySet that evaluates to a list
> of dictionaries instead of model-instance objects.

And:

> Finally, note a ValuesQuerySet is a subclass of QuerySet, so it has all
> methods of QuerySet. You can call filter() on it, or order_by(), or whatever.



-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: [Urgent] Freelance Django Developers Wanted

2007-08-30 Thread Nis Jørgensen

Siliconbits skrev:
> [This is a repost]
>
> We are currently looking for more Django developers to join us on a
> freelance basis.
>
> Location is irrelevant as long as you have a fast and reliable
> Internet access.
>
> You will be working from home, so you should be able to work
> independently, but also be able to demonstrate effective people and
> time management skills, so as to deliver work within our deadlines.
>
> Send us your daily/hourly rates, your availability as well as a few
> words about work you've done before.
>
> Any questions? Just send me an email.
Who are "we"?

Nis Jørgensen

--~--~-~--~~~---~--~~
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: doc question

2007-08-30 Thread eXt

If you browsed the docs at djangoproject.com and djangobook.com then
there is not much more available. You have to use a search engine and
read the django's source code.
On the other hand Admin is not very flexible at the moment. You might
want to use newforms-admin branch and then read it's options.py file
to see the "exciting stuff". See it at: 
http://code.djangoproject.com/wiki/NewformsAdminBranch

Newforms-admin branch is definitly worth of giving it a try. I
personally use it :)

regards


--
Jakub Wiśniowski

On 30 Sie, 11:58, Sheriff26 <[EMAIL PROTECTED]> wrote:
> hi all
>
> Where can I find all Admin class stuff  like list_display,
> list_filter, ordering, search_fields ?
> I have readed the documentation, ... but i don't find only a few. I
> suppose there are mor options.
>
> 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: foreign keys between different application models

2007-08-30 Thread Graham Carlyle

On Thu, 2007-08-30 at 07:27 +0800, Russell Keith-Magee wrote:
> 1) If you have a non-trivial amount of data in your production
> database, the space and time required to deserialize, store and
> reserialize the contents of the databse could be problematic.

Fortunately I have a small amount of data for the moment
> 
> 2) The technique you propose doesn't address any changes that may be
> required to your data. This isn't a problem if you all you do is add a
> new field that allows null=True,  but if you add a non-optional field,
> the fixture load won't work because the fixture won't contain data for
> the new field. At the very least, there is a transform step between
> the dump and the load.

Yeah thats what I was alluding to with munging the yaml format data.

> Solving this sort of problem is what the SQL ALTER statement, and by
> extension, the schema-evolution pushes, are all about. These change
> the database in-situ, rather than going through an intermediate
> database.

Yeah I've worked on projects where we applied versioned sql scripts,
using a tool that applied any new ones that weren't already in a db
table of applied scripts. But all the sql was in these scripts, whereas
django's handy syncdb lulls the simple minded developer into forgetting
about these issues until upgrade time.

I haven't found a lot of information on how people typically do schema
migrations for Django after reading the docs/scanning the wiki/googling.
However the manual route seems to be a preferred option...

this FAQ entry...
http://www.djangoproject.com/documentation/faq/#if-i-make-changes-to-a-model-how-do-i-update-the-database
recommends hand crafting the upgrade sql and avoiding trying to automate
too much.

cheers,
Graham



--~--~-~--~~~---~--~~
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: doc question

2007-08-30 Thread Sheriff26

thanks !!!

On Aug 30, 1:01 pm, Paul Rauch <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Sheriff26 schrieb:
>
> > hi all
>
> > Where can I find all Admin class stuff  like list_display,
> > list_filter, ordering, search_fields ?
> > I have readed the documentation, ... but i don't find only a few. I
> > suppose there are mor options.
>
> > Thanks
>
> http://www.djangoproject.com/documentation/model-api/#admin-options
>
> greetz Paul Rauch
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with SUSE -http://enigmail.mozdev.org
>
> iQIVAwUBRtaVZxG67lyyQrltAQK9mhAArJzNZkgCBk0KlIzA0OMSltaMwXb1azSy
> liFZu/g/BSwkoG4a9/HSaqEf1Byjr6r8Cgj2aiJf3mGwswMxOMy1tvgA3vVpJpHu
> Nu4DnuXdH/K/UcV+4vldWkCk6eV3ApNoZQMJ1vBZeE1kfcxuLtQU3I7Dlqgfw8l0
> XsjYWYXCw3nrbjfiPtE6m7gYm7Z+Jnh2AuhFgmbGKFguSwCZGoud6X5Lc+hQYTjB
> il+Ud6wum+sBhCSgxwx/8riuC1NU24BnTxmNz2V3JSwq2qAHlhIhor2xJmkSmOVB
> hvXLjddTohiSSZcobC8NzJdABpkAqEoUIIXKDjIzskgRkhKepwbzrp33P0NX0SNN
> erShBZ5xdlMbkfcbmc51/8o2vCoScv8FgJ53EuJ0Up2jQE2s2pj3B3mCNZC1VYrg
> wpaVoux8aKvRmxq/S7FEK4d4Zte6coqYVLv3Xcfg9ZgqO9WCz8pioFFE+WOjtTCm
> BJs4IxDVoEvgsdkFOuXKyFm8BKoCZyKzmzZgtn/1GV9CO8ysprAixSGb59+WIcbE
> aD6rm7FD1QQXBpk1YcNhih9d2ddP1wjQpcwDbkPfYe90RFipbKcy8OiLf2E3pzXT
> 2GUxvdi/CnJ26nc84HS4wPtrAO6DNphjjdwetgz/sAN4CKGgyzIDAo/ixiFR36p0
> jL6kAMI81Bc=
> =mGFx
> -END PGP SIGNATURE-


--~--~-~--~~~---~--~~
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: doc question

2007-08-30 Thread Paul Rauch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Sheriff26 schrieb:
> hi all
> 
> Where can I find all Admin class stuff  like list_display,
> list_filter, ordering, search_fields ?
> I have readed the documentation, ... but i don't find only a few. I
> suppose there are mor options.
> 
> Thanks
> 
>

http://www.djangoproject.com/documentation/model-api/#admin-options

greetz Paul Rauch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iQIVAwUBRtaVZxG67lyyQrltAQK9mhAArJzNZkgCBk0KlIzA0OMSltaMwXb1azSy
liFZu/g/BSwkoG4a9/HSaqEf1Byjr6r8Cgj2aiJf3mGwswMxOMy1tvgA3vVpJpHu
Nu4DnuXdH/K/UcV+4vldWkCk6eV3ApNoZQMJ1vBZeE1kfcxuLtQU3I7Dlqgfw8l0
XsjYWYXCw3nrbjfiPtE6m7gYm7Z+Jnh2AuhFgmbGKFguSwCZGoud6X5Lc+hQYTjB
il+Ud6wum+sBhCSgxwx/8riuC1NU24BnTxmNz2V3JSwq2qAHlhIhor2xJmkSmOVB
hvXLjddTohiSSZcobC8NzJdABpkAqEoUIIXKDjIzskgRkhKepwbzrp33P0NX0SNN
erShBZ5xdlMbkfcbmc51/8o2vCoScv8FgJ53EuJ0Up2jQE2s2pj3B3mCNZC1VYrg
wpaVoux8aKvRmxq/S7FEK4d4Zte6coqYVLv3Xcfg9ZgqO9WCz8pioFFE+WOjtTCm
BJs4IxDVoEvgsdkFOuXKyFm8BKoCZyKzmzZgtn/1GV9CO8ysprAixSGb59+WIcbE
aD6rm7FD1QQXBpk1YcNhih9d2ddP1wjQpcwDbkPfYe90RFipbKcy8OiLf2E3pzXT
2GUxvdi/CnJ26nc84HS4wPtrAO6DNphjjdwetgz/sAN4CKGgyzIDAo/ixiFR36p0
jL6kAMI81Bc=
=mGFx
-END PGP SIGNATURE-

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



doc question

2007-08-30 Thread Sheriff26

hi all

Where can I find all Admin class stuff  like list_display,
list_filter, ordering, search_fields ?
I have readed the documentation, ... but i don't find only a few. I
suppose there are mor options.

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: count() causes QuerySet re-evaluation?

2007-08-30 Thread SmileyChris



On Aug 30, 8:19 pm, Bjorn Ruud <[EMAIL PROTECTED]> wrote:
> > > On 8/29/07, Bjorn Ruud <[EMAIL PROTECTED]> wrote:
>
> > > The pool QuerySet gets re-evaluated when the count() in the loop is
> > > run. Since one of the fields in the filter gets changed, the amount of
> > > objects in the QuerySet will be different. If pool.count() is replaced
> > > with len(pool) this does not happen. Is this intended behaviour? Can a
> > > QuerySet be made immutable?
> > On Aug 29, 3:03 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote:
>
> > This behaviour is by design.
>
> > queryset.count() actually constructs (and executes) a new 'SELECT
> > COUNT(*) FROM table' query. This means that it will always return the
> > current number of objects matching the query. In your case, the number
> > of objects is changing, so count() will return a different value each
> > time.
>
> > len(queryset) returns the length of the evaluated queryset. When the
> > queryset is evaluated for the first time, it will act as a cache, so
> > all calls to len(queryset) will return the same value.
>
> Ah, I misunderstood how the caching mechanism works. I thought that
> after the initial evaluation the QuerySet was static no matter what
> operation was performed since only the cache was being used.

Technically you are correct - the problem is you didn't evaluate the
QuerySet. If you had, say by using len(pool) the first time, then your
future pool.count()s wouldn't use a 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-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: @url tag - getting rid of urlpatterns

2007-08-30 Thread Ivan Sagalaev

Ilya Semenov wrote:
> Second, I think the use of generic views is over-estimated. Generic
> views do not even support access restrictions (@user_passes_test) and
> thus are most of the time proxied via custom one-line views.

Actually they support decoration perfectly well, right in urls.py:

 from django.views.generic.list_detail import object_detail
 from some_decorators import decorator

 urlpatterns = patterns('',
 (r'...', decorator(object_detail), { ... }),
 )

Though I agree that generic views require some time get used to...

--~--~-~--~~~---~--~~
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: @url tag - getting rid of urlpatterns

2007-08-30 Thread daev

On 30 авг, 12:08, Ilya Semenov <[EMAIL PROTECTED]> wrote:

> Second, I think the use of generic views is over-estimated. Generic
> views do not even support access restrictions (@user_passes_test) and
> thus are most of the time proxied via custom one-line views.
Look at this:
http://www.djangoproject.com/documentation/url_dispatch/#passing-callable-objects-instead-of-strings
You can wrap even generic views with decorator


--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-30 Thread Kenneth Gonsalves


On 30-Aug-07, at 1:29 PM, Michael Radziej wrote:

>>
>> True, that's why I call this behaviour "buggy".
>
> Ah! I thought that you advocated for gettext instead of  
> gettext_lazy in this
> specific situation.

well, i am using gettext until the bug is fixed - so far no problems

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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: @url tag - getting rid of urlpatterns

2007-08-30 Thread Ilya Semenov

Ivan,

Thanks for reviewing the snippet.

> While the decorator looks nice it creates in my opinion at least as many
> problems as it solves.
>
> 1. You can apply decorators only to custom views, not to generic views.
> And as generic views are commonly used one still should keep a separate
> urls.py for them.

First of all, the decorator is fully optional. It doesn't replace
urlpatterns, it gently appends to them. There's nothing wrong in
writing:

urlpatterns = urlpatterns('',
('^news/$', 'django.views.generic.object_list',
{'queryset':..})
)

@url('^edit_news/$')
def edit_news(request):


Second, I think the use of generic views is over-estimated. Generic
views do not even support access restrictions (@user_passes_test) and
thus are most of the time proxied via custom one-line views.

> 2. One of the best things (again, in my opinion) of urls.py is that it
> shows whole user interface of an app in one place. You loose this
> feature with decorators scattered all over views.

While I see the rationale in your words, that position is very
arguable.

Encapsulation is one of the greatest programming principles. From the
architectural point of view, the app-level urls.py shouldn't bother
what members area urls are there in members module, since it can
safely delegate the responsibility to manage the list of members urls
and just pull the data when needed.

> BTW, do you know that you can use function objects instead of their
> names in url definition? So this:
>
>  urlpatterns = patterns(__name__,
>  (r'^index/$', 'index'),
>
> becomes just:
>
>  urlpatterns = patterns('',
>  (r'^index/$', index),

Sure, that way it is more natural. Alas, that won't work, since index
function is defined later in the module code. Alternatively, one
should put urlpatterns to the very end of the module file, which just
doesn't feel right to me.


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



Re: Choices cannot be marked for translation?

2007-08-30 Thread Michael Radziej

On Thu, Aug 30, Jarek Zgoda wrote:

> 
> Michael Radziej napisał(a):
> 
>  The next testing option is to try with non-lazy version.
> >>> that works! import gettext as _
> >> And that's a real bug, I think.
> >>
> >> Anyway, for future reference, keep in mind that lazily translated
> >> "strings" become real strings at access time. Before that they are
> >> function objects. That is, you cann't, for example, pickle them - and in
> >> consequence put in session because session data is pickled before
> >> saving. Laziness isn't always good. ;)
> > 
> > If I haven't mistaken anything, we're talking about the choices setting in
> > model fields. The models are read in during initialization. But the choices
> > need to be translated for each request, and for different languages. I don't
> > see how this could work without lazy translation, and I'd be astonished if
> > the solution above really worked.
> 
> True, that's why I call this behaviour "buggy".

Ah! I thought that you advocated for gettext instead of gettext_lazy in this
specific situation.

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~-~--~~~---~--~~
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: Choices cannot be marked for translation?

2007-08-30 Thread Jarek Zgoda

Michael Radziej napisał(a):

 The next testing option is to try with non-lazy version.
>>> that works! import gettext as _
>> And that's a real bug, I think.
>>
>> Anyway, for future reference, keep in mind that lazily translated
>> "strings" become real strings at access time. Before that they are
>> function objects. That is, you cann't, for example, pickle them - and in
>> consequence put in session because session data is pickled before
>> saving. Laziness isn't always good. ;)
> 
> If I haven't mistaken anything, we're talking about the choices setting in
> model fields. The models are read in during initialization. But the choices
> need to be translated for each request, and for different languages. I don't
> see how this could work without lazy translation, and I'd be astonished if
> the solution above really worked.

True, that's why I call this behaviour "buggy".

-- 
Jarek Zgoda
Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

--~--~-~--~~~---~--~~
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: Django, CherryPy and threading

2007-08-30 Thread Eratothene

I am running CherryPy 3.0.1 with django + nginx for static content on
my production server for several months without any issues. It also
shows very well perfomance, even better than apache/mod_python and
very small memory usage. Ideal solution!

On Aug 28, 6:39 pm, Justin Johnson <[EMAIL PROTECTED]> wrote:
> I've managed to get Django working nicely with CherryPy using WSGI.  
> Previously I've deployed Django with Apache and ModPython where each
> requested is serviced by a separate Python instance.
>
> This isn't the case with CherryPy though as it's thread based which
> leads me to the following concern:  is it safe to serve Django with
> CherryPy?
>
> Cheers,
>
> Justin


--~--~-~--~~~---~--~~
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: Using SQL aggregates

2007-08-30 Thread Eratothene

I know two options for you:
1. First use django-simpleaggregation plugin, you canfind it on
googlecode.com
2. Or use raw sql to do it. This is example how I count entries in
each blogs

blogs = Blog.objects.all().extra(select={'article_count': "SELECT
COUNT(*) FROM blog_article a WHERE a.blog_id=blog_blog.id"})

You can easy extend by example to a custom manager, that can aggregate
anything


[EMAIL PROTECTED] wrote:
> I'm new to Django, so this may be answered elsewhere but I have not
> found it.
>
> If I want to display a summary view of some large datasets, in SQL I
> would use:
>
> select name, count(*) from MyTable group by name
>
> This SQL in practice would have several joins.  In past lives, I've
> used SQL VIEWS to hide the details of where this summary view of the
> data is constructed.
>
> How can I display a table of groups and counts, using the DB API?  Can
> this be wrapped around a model that is tied to a database view?
>
> -Dave


--~--~-~--~~~---~--~~
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: @url tag - getting rid of urlpatterns

2007-08-30 Thread Ivan Sagalaev

Ilya Semenov wrote:
> === apps/app1/views/__init__.py ===
> @url(r'^index/$')
> def index(request):
>   ...
> 
> @url(r'^news/$')
> def news(request):

While the decorator looks nice it creates in my opinion at least as many 
problems as it solves.

1. You can apply decorators only to custom views, not to generic views. 
And as generic views are commonly used one still should keep a separate 
urls.py for them.

2. One of the best things (again, in my opinion) of urls.py is that it 
shows whole user interface of an app in one place. You loose this 
feature with decorators scattered all over views.

BTW, do you know that you can use function objects instead of their 
names in url definition? So this:

 urlpatterns = patterns(__name__,
 (r'^index/$', 'index'),

becomes just:

 urlpatterns = patterns('',
 (r'^index/$', index),

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