Re: Unique Case Sensitivity

2008-07-16 Thread Peter Melvyn

On Wed, Jul 16, 2008 at 3:06 AM, Russell Keith-Magee
<[EMAIL PROTECTED]> wrote:

> I strongly suspect that the problem here is MySQL - in particular, the
> collation on your text field. There are certain default setups for
> MySQL which will result in all text fields being case insensitive.
> This doesn't just affect unique constraints - it affects case
> sensitive matching as well.

Not only default setups. See
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html
for available collations - all collations are case insensitive except
the xxx_bin one.

You can try in...


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: syncdb

2008-07-05 Thread Peter Melvyn

On 7/5/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>  Thanks a lot!!  I am used to rails.  Hopefully django will have some
>  sort of db migrate ability in the future.

Django has a separated project
http://code.google.com/p/django-evolution/ for such task

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

2008-07-03 Thread Peter Melvyn

On 7/3/08, Bobby Roberts <[EMAIL PROTECTED]> wrote:

> is there a way in Django to send an actual HTML email?  I can only get
> it to send as an attachment to a text email which is really pointless
> in my opinion.

Did you read paragraph "Sending alternative content types" in
http://www.djangoproject.com/documentation/email/

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: Some Django unit tests fail...

2008-06-24 Thread Peter Melvyn

>  On Fri, Jun 20, 2008 at 1:07 AM, Peter Melvyn <[EMAIL PROTECTED]> wrote:

> > Yes, it is the intention. If Django requires test database with
>  > charset UTF8, IMHO it should create it using related clause. as well
>  > as proper engine should be choosen if we care about reference
>  > integrity, e.g.
>  >
>  > SET storage_engine=InnoDB;
>  > CREATE DATABASE xxx
>  >  DEFAULT CHARACTER SET utf8
>  >  COLLATE utf8_xxx_ci;

I found that Django is awared for this already: in django.test.utils
is the function get_mysql_create_suffix() which reads values
TEST_DATABASE_CHARSET and COLLATION from settings...


> I won't ever say no to a ticket. Make a proposal, and we will see if
>  it floats :-)

I've added a note highlighting this in paragraph describing django
tests in contribution chapter and created ticket #7534

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: How best to delete one of multiple records?

2008-06-23 Thread Peter Melvyn

On 6/23/08, Emil Styrke <[EMAIL PROTECTED]> wrote:

> Having a GET request delete records is usually a bad idea - see for example
> http://www.w3.org/2001/tag/doc/whenToUseGet.html

Yes, this is a recommendation, not a dogma. IMHO GET method is
suitable for dense tables with dozens of operations.

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: How best to delete one of multiple records?

2008-06-23 Thread Peter Melvyn

>  I have a list of records, and I'd like the user to be able to delete
>  any given record by pressing a button.

IMHO there are two basic solutions:

1. each record has column with hyperlink to delete action (ID is part of URL)
   You can use plain text or image mapped links
2. each record has checkbox and there is a single DELETE button

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: Any suggestions on encryption methodology?

2008-06-23 Thread Peter Melvyn

On 6/23/08, Tye <[EMAIL PROTECTED]> wrote:

>  When the user hits submit, I want the SSN to be encrypted, stored in a
>  database (encrypted), read from a database (encrypted) by a secure,
>  authorized & authenticated connection, and decrypted somewhere along
>  the end of the line for appropriate viewing discretion.

This is exactly what Thales's solutions could do for you...

###

Time-to-time we had to implemented some encryption/decryption by
ourself, but each solution has at least one crucial point and it is
key management.

Typically, we use key compound of two independand keys generated from
passwords hold by two senior managers, which have to change their
password regularly (e.g. 4 weeks) and simultaneously -> data has to be
reencrypted once both password has been changed.

And to reencrypt huge amount of data under single transaction - it is
not an easy task - e.g. we fought with transaction log overflow etc...

And another potential problem are SQL expressions referring encrypted
data - to avoid full scan, you need encrypt a querying value before
SQL command is executed to be able use indeces.


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: Any suggestions on encryption methodology?

2008-06-23 Thread Peter Melvyn

On 6/23/08, Tye <[EMAIL PROTECTED]> wrote:

>  Say - for the sake of example - I'm accepting highly sensitive
>  financial data through a form over SSL.
>
>  Staff members need to retrieve that information at a later time.
>
>  Meanwhile, I want that data to be encrypted while it's sitting in the
>  database. What do you suggest?

I don't know what kind of application you implement and how sensitive
data actually are, but FYI, there are countries having strict enacts
of point-to-point encryption e.g. in banking e.g. between SIM in your
mobile phone as a client and AS400 as a banking host. No
decryption/reencryption in the middle.

AFAIK, *reliable* solution is *always* built on specialized HW, e.g.
http://www.thales-esecurity.com/solutions/Database_protection.shtml

HTH, 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: flatpage for 404

2008-06-21 Thread Peter Melvyn

On 6/21/08, mark <[EMAIL PROTECTED]> wrote:

>  I do not like the django default behaviour for 404 pages since I do
>  not want to create a 404.html template. I like my flatpages a lot
>  especially the default.html template I created earlier. Therefore I
>  would like django to use my default.html template to display the 404
>  and use the '/404/' flatpage which I created. Unfortunately I did not
>  find out how to configure this behaviour.

Lookup django.conf.urls.defaults module how handler404 is defined and
override it by assigning  your view function in your application

HTH, 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: email this page

2008-06-21 Thread Peter Melvyn

On 6/20/08, Support Desk <[EMAIL PROTECTED]> wrote:

> submit button. That will send an email containing all the rendered
> information.

If *all* should mean that you want to send HTML in-line message
including related media (images), you have to:

1. compose MIME message having subparts as follows:

mixed
related
my_cid_1:  as attachement
my_cid_2:  as attachement
...
alternative
text
html

2. render HTML part using dedicated template replacing URL of all
referred media by URL having CID schema, e.g.


###

I am not sure if implementation
http://www.djangoproject.com/documentation/email/
is generic enough to compose such message and I am not skilled
Pythoneer to know whether there is another library suitable for this
task.


HTH, 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: Some Django unit tests fail...

2008-06-19 Thread Peter Melvyn

On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:

> The only obvious thing I can glean from your stack traces is a
>  possible language problem - the last stack trace is complaining of a
>  collation mix, which suggests that your MySQL install isn't using utf8
>  all the time.

Yes, it is the intention. If Django requires test database with
charset UTF8, IMHO it should create it using related clause. as well
as proper engine should be choosen if we care about reference
integrity, e.g.

SET storage_engine=InnoDB;
CREATE DATABASE xxx
  DEFAULT CHARACTER SET utf8
  COLLATE utf8_xxx_ci;


Should I create a ticket ;-)

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



Some Django unit tests fail...

2008-06-19 Thread Peter Melvyn

Hi all,

I wanted to make sure that all unit tests will pass after #3030 fix
and run Django unit tests on trunk updated to r7703 on Windows, Python
2.4 and MySQL 5.0.37.

But I found that some test failes:

1. If I've run all tests, I get error:

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\django-trunk\tests\runtests.py",
line 183, in ?
django_tests(int(options.verbosity), options.interactive, args)
  File "C:\Python24\Lib\site-packages\django-trunk\tests\runtests.py",
line 153, in django_tests
failures = run_tests(test_labels, verbosity=verbosity,
interactive=interactive, extra_tests=extra_tests)
  File "C:\Python24\Lib\site-packages\django-trunk\django\test\simple.py",
line 136, in run_tests
suite.addTest(build_suite(app))
  File "C:\Python24\Lib\site-packages\django-trunk\django\test\simple.py",
line 59, in build_suite
test_module = get_tests(app_module)
  File "C:\Python24\Lib\site-packages\django-trunk\django\test\simple.py",
line 17, in get_tests
test_module = __import__('.'.join(app_path + [TEST_MODULE]), {},
{}, TEST_MODULE)
  File 
"C:\Python24\Lib\site-packages\django-trunk\tests\regressiontests\templates\tests.py",
line 23, in ?
from loaders import *
  File 
"C:\Python24\Lib\site-packages\django-trunk\tests\regressiontests\templates\loaders.py",
line 13, in ?
import pkg_resources
ImportError: No module named pkg_resources


2. If I've run single tests, I get error in some particular tests as well, e.g.

FAIL: Doctest: modeltests.basic.models.__test__.API_TESTS
--
...
Failed example:
Article.objects.get(pk=a.id).headline
Expected:
u'\u6797\u539f \u3081\u3050\u307f'
Got:
u'Article 12'

###

FAIL: Doctest: modeltests.custom_pk.models.__test__.API_TESTS
--

File 
"C:\Python24\Lib\site-packages\django-trunk\tests\modeltests\custom_pk\models.py",
line ?, in modeltests.custom_pk.models.__test__.API_TESTS
Failed example:
emp.save()
Exception raised:
Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\django-trunk\django\test\_doctest.py",
line 1267, in __run
compileflags, 1) in test.globs
  File "", line 1, in ?
emp.save()
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\base.py",
line 272, in save
self.save_base()
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\base.py",
line 313, in save_base
if manager.filter(pk=pk_val).extra(select={'a':
1}).values('a').order_by():
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\query.py",
line 84, in __nonzero__
iter(self).next()
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\query.py",
line 78, in _result_iter
self._fill_cache()
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\query.py",
line 494, in _fill_cache
self._result_cache.append(self._iter.next())
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\query.py",
line 520, in iterator
for row in self.query.results_iter():
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\sql\query.py",
line 200, in results_iter
for rows in self.execute_sql(MULTI):
  File 
"C:\Python24\Lib\site-packages\django-trunk\django\db\models\sql\query.py",
line 1474, in execute_sql
cursor.execute(sql, params)
  File "C:\Python24\Lib\site-packages\MySQLdb\cursors.py", line
166, in execute
self.errorhandler(self, exc, value)
  File "C:\Python24\Lib\site-packages\MySQLdb\connections.py",
line 35, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1267, "Illegal mix of collations
(latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for
operation '='")

etc...

###

Is there anything I've missed that Django unit tests do not pass on my
installation?


Thx, 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: Why PostgreSQL?

2008-06-19 Thread Peter Melvyn

On 6/19/08, AmanKow <[EMAIL PROTECTED]> wrote:


> Absolutely.  I am not pointing fingers, but throwing my two cents into
>  the answer to "Why PostgresSQL?"  I think, given the current state of
>  MySQL, the problems I outlined are very strong arguments for using
>  postgres instead of mysql when choosing Django.

I have exactly the same experience.

IMHO, if you don't have a *very* good reason to choose MySQL, do *not*
choose it, otherwise you will run into problems, especially if a
schema evolution/migration is a significant task for you...


>  when I first made the Django choice, that I had made the jump to
>  postgres then.

Unfortunatelly, we use Django application as a configuring/monitoring
web based tool for large back-office application using MySQL as shared
database, hence we cannot move PostgreSQL easily...

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: redirect with post parameters

2008-06-17 Thread Peter Melvyn

On 6/17/08, MarcoX <[EMAIL PROTECTED]> wrote:

>  I tried with httplib e urllib but with no results

Technically, a redirection represents to return result code 301 or 302
and set field Location in the HTTP response header to absolute URL.
HTTP Client then issue a new HTTP request to this URL.

Hence you cannot "forward" any post parameter without client side cooperation.

You could pass some parameters in query part of URL and/or perhaps via
cookie thoroughly built for particular URL.

HTH, 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: Django HTML Editor

2008-06-14 Thread Peter Melvyn

>  I want a free HTML editor that is compatible with Django template's
>  syntax. I just want to edit my Django power application's HTML faster.
>  When I say compatible, I mean that the editor shouldn't screw up all
>  the Django template's tags and variables.

If you are on Windows, you can try www.pspad.com (it is not WYSIWYG)

HTH, 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: truncate in mysql database

2008-06-11 Thread Peter Melvyn

On 6/11/08, Frédéric Degraeve <[EMAIL PROTECTED]> wrote:

>  I use often 'delete' on my tables. I would like to reset everytime the
>  auto_increment field. Is it possible to use 'truncate' with django
>  orm?

AFAIK not. But you can run custom SQL
http://www.djangoproject.com/documentation/model-api/#executing-custom-sql

BTW, did you read dox describing different behaveour of TRUNCATE
command between different MySQL versions?

HTH, 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: undetermined behaviour of manage.py

2008-05-11 Thread Peter Melvyn

On 5/11/08, phactor <[EMAIL PROTECTED]> wrote:

>  no keyword REFERENCES. Where is it?

AFAIK, SQLite engine 'per se' does not support reference integrity, see:

- http://www.sqlite.org/lang_createtable.html
- http://www.sqlite.org/omitted.html


HTH, 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: Javascript GUI Editor that works with Django templates

2008-04-22 Thread Peter Melvyn

> Since Opera  is used by a very very small percentage of web users,
> I don't think it  would be a major problem in most use cases.

My experience says the well behaved applications runs on IS6+, FF2+,
Safari3+ and Opera9+

--~--~-~--~~~---~--~~
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: Paginator Help

2008-04-22 Thread Peter Melvyn

On 4/21/08, DuncanM <[EMAIL PROTECTED]> wrote:

>  Please could someone have a look through and see what I'm missing?

I'm not a Django skilled user, but I use the similiar pagination and
what I see at glance is, that you mix paginator's template with view's
template.

###

Paginator is inclusion tag - it requires some HTML code to be rendered
by - this is the  fragment, hence you should change your
inclusion tag definition to something like
register.inclusion_tag("tag_paginator.html",
takes_context=True)(paginator) and save this fragment into it
tag_paginator.html

And in your page (main_menu.html), you should "call" it like this:

{% if is_paginated %}
   {% load paginator %}{% paginator 4 %}
{% endif %}

HTH, 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: DateField widget, ModelForm and javascript

2008-04-22 Thread Peter Melvyn

On 4/21/08, Rishabh Manocha <[EMAIL PROTECTED]> wrote:

>  I'd be interested in knowing how to get it to show up too (what JS/CSS
>  files need to be added, whether there is some setting we can use in
>  the python code itself or do we have to print out each field
>  independently and insert the appropriate code for the picker etc.).

Date/Time pickers are bound via widget's class names vDateField and
vTimeField, hence you need to define them in your form definition.

Then you have to include JavaScript files in your template:
- core.js
- calendar.js
- datetimeshortcuts.js

The last one looks for widgets having related class names in rendered
HTML code and inserts required elements into DOM in run-time.

--~--~-~--~~~---~--~~
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: Javascript GUI Editor that works with Django templates

2008-04-21 Thread Peter Melvyn

>  My favorite is FCKeditor. Its formatting of source code is really
>  clean and semantic. I have come to hate TinyMCE because it jumbles
>  source code and uses too many tags at times. Try it out, you may like
>  it a lot.

I've tried it and it seems it does not work with Opera...

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



Troubles with JavaScript localization

2008-04-11 Thread Peter Melvyn

Hi all,

perhaps I've missed something important in my very-beginning with
Django, because I encouter a problems with JavaScript localization.

1. I serve .js as a static files directly by Apache, so they reside on
MEDIA_ROOT out of project/apps folder tree

-> I cannot build message files. I need to move .js files among
remaining source files and do manual deployment of those files
into proper location on MEDIA_ROOT

2.  Once .js moved, I can build them into myproject/locale/ folders,
 by I cannot refer them from templates - if I enter 'myproject', it does
 not work. I have to move locale folder into next level, eg.
 'myproject.myapp' to be found.

###

ad 1. What is a recommended way to manage .JS files in Django projects?
ad 2. Is there a way how to refer project level locales or they can reside
  just on application level only?


Thanks, 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: Error with database encoding in UTF8

2008-03-27 Thread Peter Melvyn

On 3/26/08, Karen Tracey <[EMAIL PROTECTED]> wrote:

> you have told MySQL that the data is utf8-encoded.  I believe there is a way
> (described in the MySQL doc page I cited above) to globally change your
> MySQL config so it will expect/supply utf8 instead of latin1, so you might
> want to look into that.

We use this:

DROP DATABASE xx;
SET storage_engine=INNODB;
CREATE DATABASE xx DEFAULT CHARACTER SET utf8 COLLATE utf8_xx_ci;

--~--~-~--~~~---~--~~
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: Troubles with exceptions having localized text in debug.technical_500_response exception

2008-01-09 Thread Peter Melvyn

On 1/10/08, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:

> It's a bug. Please open a ticket about it, so we don't forget.

Thank you for your help. Done.
http://code.djangoproject.com/ticket/6353


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



Troubles with exceptions having localized text in debug.technical_500_response exception

2008-01-09 Thread Peter Melvyn

Hi all,

I raise an exception with localized text, e.g.

raise XXXInternalException, ugettext('_XXX_ERROR_...') % (...)

If I catch such exception and handle it in my view, everything is OK.

But if I do not catch such exception and it continues until caught in
base.get_response() function, then (probably)
debug.technical_500_response()
instead of reporting localized exception's message complains with error:

UnicodeEncodeError: 'ascii' codec can't encode character u'\u0161'
in position 2: ordinal not in range(128)

Is it a bug or did I miss anything. I use release 6693



Thanks, 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: Populating a form

2007-09-13 Thread Peter Melvyn

On 9/13/07, MikeHowarth <[EMAIL PROTECTED]> wrote:

> Look at form_for_instance in newforms:

I am not sure if it could help me. I try to demostrate my problem on
the view fragment handling post request:

form = MyHTMLForm(request.POST)
if not form.is_valid():
  # will render bound form
else:
  try:
 # posted data processing
  except:
 # will render bound form
  else:
 # Here I need to clear some form's fields without generating
 # error in bound form.
 # I suppose it could be done by creating a new unbound instance
 # of MyHTMLForm and passing values I need to retain as initial values
 # from old form instance.
 # But it seems to be ugly solution
...
  response = (,form,)

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

2007-09-13 Thread Peter Melvyn

On 9/11/07, Ole Laursen <[EMAIL PROTECTED]> wrote:

> You can also use the initial parameter when instantiating the form:

And how to solve situation when you've processed posted data and in
the next step you need to redisplay the same form with some values
reset to initial values?


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: When 1.0 ?

2007-09-11 Thread Peter Melvyn

On 9/10/07, est <[EMAIL PROTECTED]> wrote:

> Hi I am a new web developer in django. Could anyone tell me when will
> django go to 1.0? Will django support py3k? Is django worth learning
> compared with other web frameworks like turbogears, RoR?

At the end of thread bellow are opinions I tend to:

http://groups.google.com/group/turbogears/browse_thread/thread/d3998a4e750c39c9/4d7710c0297e36c3

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: newforms and DateField

2007-09-01 Thread Peter Melvyn

On 8/31/07, picky <[EMAIL PROTECTED]> wrote:

> I try to create a form with forms.form_for_model but I just get a text
> widget for my DateField object.

I did not try it yet, but in principle, you should set class attribute
of corresponding widget to vDateField and include related JavaScripts
from
contrib.admin.media.js.admin folder.

To set attribute, you can do it this way:

MyForm = forms.form_for_model(...)
MyForm.base_field['my_field'].widget.attrs.update({'class':'vDateField'})

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



Max. size of User.email is 75 chars

2007-08-29 Thread Peter Melvyn

Hi all,

I've a question, why max. size of User.email field is set to 75 characters,
if RFC 2821 limits local part to 64 characters and domain to 255.
With '@' it is together 320 chars.

Should not be this field extended?


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: Django 1 debugging in pydev with breakpoints

2007-08-29 Thread Peter Melvyn

On 8/29/07, Rufman <[EMAIL PROTECTED]> wrote:

> does anyone have an idea how i can set breakpoint while debugging in
> pydev. i got the dev server to work from inside eclipse but breakpoint
> don't seem to work.

You need to configure and run dev server first (F9), then break its
execution using red box in Console window. Now you can issue command
'Debug last launched' (F11).

see http://www.fabioz.com/pydev/manual_101_run.html

HTH, 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: Validation problem with newforms and initial value for URLField

2007-08-26 Thread Peter Melvyn

On 8/26/07, Shev <[EMAIL PROTECTED]> wrote:

> But neither should an initial field value raise an error when
> the POSTed data is exactly the same as the starting value;
> it should just be ignored and the value discarded.

Even if you supply a valid inital value? It does not sound well for me...

If you need such behaveour, should not you sublass a field and
override the clean() method?


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: Injecting validation errors into newforms

2007-08-25 Thread Peter Melvyn

On 8/24/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:

> problem I'm running into is that I'd really, really like to be able to
> associate errors from the form.clean() stage of validation with the fields
> that are actually having problems.

To assign a single message, I use following assignment:

self.errors['my_field_name'] = ErrorList(['My error message'])

For details see class ValidationError in django.newforms.util

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



Is there a way how to modify value of particular field in bound new form

2007-08-23 Thread Peter Melvyn

Hi all,

I'd like to clear values of some fields in the bound form before I'll
render a page again, by I'm not able achieve this.

Please, could anybody advice how to do it?


Thank in advance

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: insert or update

2007-08-21 Thread Peter Melvyn

On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote:

> or in the mailing list saying that you would use this
> functionality for such and such a reason.

OK, I'll specify the reason

We use web as administrative/configuration tool for non-web based
back-office server and we need to synchronize its DB with Django
database.
We use post signals to maintain change log containing all records
which has to be replicated. We'd appreciate if we could distinct
between insert and update operations

Thanks, 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: insert or update

2007-08-21 Thread Peter Melvyn

On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote:

> http://code.djangoproject.com/ticket/4879
> If you need that functionality, add a vote for it. :)

Yes, I need such functionality :)

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: Apache does not serve static files from document root

2007-08-20 Thread Peter Melvyn

On 8/20/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:

> Have you read the mod_python documentation on Django site? It gives an
> example, which modified for your case would be:
>
> 
> SetHandler None
> 
>
> The important bit is the SetHandler directive. Have you done that?

Yes, I did. Setting  handler to default-handler has the same effect as
setting it to None. I tried both values.


> Post what your Apache configuration snippet for setting up Django
> looks like.

SOLVED. My friend has localized a problem: The reason was
misinterpretation of Apache's manual sentence:  " directives
are processed in the order they appear in the configuration file"

It does not mean I should put a  *before*
mod_python's , but *behind* it, because first, "/" locations
 is evaluated as matched, next the "/wssmedia" is matched and
overrides first one.

Hence the working httpd.conf snippet looks like:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE bizweb.server_settings
PythonDebug On
PythonPath "[r'C:\\.WKS-PF\\PRJ\\ECLIPSE\\Django\\src'] + sys.path"



SetHandler default-handler



Thank you for your help and I hope this off-topic thread would be
usefull for somebody else who meets the similiar problems on Apache
side.


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: Apache does not serve static files from document root

2007-08-20 Thread Peter Melvyn

On 8/20/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:

> Not really Django related, so I'll do this briefly...

Yes, I know. I appreciate your prompt reply. Thanks.


> In this case you'll probably want to add another Location section before
> this one to handle things to WWW-ROOT/bizweb explicitly (whatever URL is
> meant to map to that filesystem location). Note (read the Apache docs)
> that Location sections are processed in order from top to bottom in the
> config file.

Yes, I would. I played with Apache httpd.conf almost all afternoon to
do achieve this, but with no success: once there is  or
 setting handler to mod_python, all requests
are routed to it and it seems that all precedent  are
ignored.

If I changed mod_python's , precedent  take
effect, but it break functionality of Django app.

###

Regardless of Apache config problem, how to handle following URLs by
Django application:
http://www.mysite.com
http://www.mysite.com/
http://www.mysite.com/index.htm
http://www.mysite.com/index.html
http://www.mysite.com/wss/.*$

Currently I route different url patterns of home page to the same view
- there is no problem. With development server as well.

But I don't know how to config Apache this way:
if URL starts with "/wssmedia/":
use default_handler
else:
use mod_python (Django)


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



unique_together and composite columns indexing

2007-08-18 Thread Peter Melvyn

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`);


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: How to create model with dual primary key in Django?

2007-08-18 Thread Peter Melvyn

On 8/18/07, richard <[EMAIL PROTECTED]> wrote:

> I'm working on a database-backed Web site which requires a few tables
> to use dual primary keys (two columns acted together as primary key;
> each of them is not unique in itself). How to do that properly?

> (I'm aware of 'unique_together', however that is not really meant for
> primary key creation, is it?)

This week it has been discussed here, please see
http://mail.google.com/mail/?shva=1=DQAAAHEPDKjV_WZWyHG_nzwkmFPLgM4zBGeSs_lhf3rWQU9cQMc0kxcg880oaJfAoy3EuZZr_IG5XkcL_Kp48bEWlhNKQCC-p13QrDmrxbIiqzWY7ZhefLIUnAsH86RunSYSmyd434x7-5YSg2_IIapaGRgCMml6xOe411WDaBBJ3862zg

###

You could use artificial primary key and form a composite key using
unique_together constraint. It could work properly, if Django would
create a composite ordinary index, but it unfortunatelly does not.

OTOH, if syncdb utility leaves existing tables untouched, you could
add such composite index manually on SQL level.

--~--~-~--~~~---~--~~
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: Variable choices in ModelChoiceField

2007-08-17 Thread Peter Melvyn

On 8/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> But how do I pass the 'user' object to the Form so I can use it in
> filter() or run .groups.all() on it?

I do it this way:

self.fields['emails'].queryset =
BIZEmail.objects.filter(owner=oa_request.user.id)
self.fields['emails'].widget.choices = self.fields['emails'].choices

Choice assignment fixes ticket #4787

--~--~-~--~~~---~--~~
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: Clash of related_names among two tables

2007-08-16 Thread Peter Melvyn

On 8/16/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:

> So - you can use the same related name multiple times - BUT - the same
> related name can't be added to a single model more than once.

I see - each reference to the same model from different models has to
have an unique related_name which may not clash with any attribute's
name of referred model including self-reference if any.


> Hope this clarifies things a bit.

Yes, it does. Thank you very much for prompt and detail explanation.

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



Clash of related_names among two tables

2007-08-16 Thread Peter Melvyn

Hi all,

please, could anybody confirm my experience with related_names. I
tried to find-out some information about it and found invalid model
example.

If my understanding is correct, then it is not possible to have the
same related_names in two different models. Is it correct?

Thanks,


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: make-messages does not generate any message in .po except dummy header

2007-08-12 Thread Peter Melvyn

On 8/11/07, Ramiro Morales <[EMAIL PROTECTED]> wrote:

> You are using Windows and a checkout of Django from SVN at a revision
> between r5722 and r5842 right?.

Yes, you are right, I run r5830. Sorry, I forgot to mention this...


> Please update to a revision >= 5842. See ticket #4899.

Thanks you very much, Ramiro. It works now.


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



make-messages does not generate any message in .po except dummy header

2007-08-11 Thread Peter Melvyn

Hi all,

I'm trying to generate messages for transaltion in my project folder.

As recommened in Wiki/Localization, I installed gettext utility for
SourceForge and if I run make-messages command with verbose option, it
produces just a .po file containing dummy header :

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-08-11 22:23+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"


and no messages extracted from my python files or templates.

Please, does have anybody an idea what is wrong?


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



I am not able to run custom SQL commands

2007-08-08 Thread Peter Melvyn

Hi  all,

I am not able to run custom SQL commands and I cannot discover what is
the reason:

1.  My models reside in bizweb/wss/models/  package

2. bizweb.wss application is included in INSTALLED_APPS

3. I use customized settings files: local-settings referring
common-settings --> I run django-admin with command line
option --settings=bizweb.local_settings

4.  A model I want to run custom SQL command for is e.g.
 BIZPaymentKind

5.  I put SQL commands into file bizweb/wss/sql/bizpaymentkind.sql

6. I put backend (MySQL) specific SQL commands into file
bizweb/wss/sql/bizpaymentkind.mysql.sql

And those SQL commands are not executed and If I run sqlcustom command
for wss application, I just see:
BEGIN;
COMMIT;


(It resembles me my very beginnings with Django, if I reorganized
models into multiple files and I did not know it is neccessary to use
class Meta: app_label='wss'. But currently syncdb and similiar
commands like sqlall work perfectly)


Please, could anybody advice me what I'm doing badly?


Thanks, 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: value for choices arguments for newforms.MultipleSelectField

2007-08-08 Thread Peter Melvyn

On 8/7/07, Chris Brand <[EMAIL PROTECTED]> wrote:

>  self.fields[f].queryset = queryset
>  # Have to force the widget to update itself (bug 4787)
>  self.fields[f].widget.choices = self.fields[f].choices

Hi Chris,

thanks for your help - it solved my problem, but another one has arised:

What should I pass as a dummy queryset parameter: this is positional
mandatory argument and I cannot pass None. Is it correct if I pass

 queryset = _QuerySet()

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



How to specify engine type for particular table?

2007-08-06 Thread Peter Melvyn

Hi all,


I operate MySQL server with default-storage-engine set to InnoDB. But
I need full text search on some tables, which is unfortunatelly
supported by MyISAM engine only.

Is there a way to specify ENGINE=MyISAM option appended to CREATE
TABLE DDL command generated by manage.py?


Thanks, 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: value for choices arguments for newforms.MultipleSelectField

2007-08-05 Thread Peter Melvyn

On 2 Srp, 17:35, Nathan Ostgard <[EMAIL PROTECTED]> wrote:

> You can use ModelMultipleChoiceField for this:
>
> items =
> newforms.ModelMultipleChoiceField(queryset=Items.objects.all())

Hi Nathan,

I use it this way, but I need to reduce the queryset for current user
whom ID is contained in HTTP request. I'm a beginner, hence I
implemented it by nesting form's declaration into view function:

def my_view(request):

class MyForm(forms.Form)
 emails = forms.ModelMultipleChoiceField(queryset=
  MyDBModel.objects.filter(user=request.user.id)


But I'd like to have form declaration out of this view na pass user's
ID as an argument - is there any way how to supply queryset in
runtime? I tried to assign queryset later to form's instance having no
success.

Thanks, 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: Name of inclusion-tag template built in run-time

2007-07-31 Thread Peter Melvyn

On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:

> I'm not sure how you've got your code set up,

I'm looking for a way how to compose web page from the relativelly
independent 'tiles'. Tags, especially inclusion tags seem to be a
suitable tool for it. Its a pitty they cannot be used recursivelly
having the same features as regular template.


> So you might want to create a tag that isn't based on inclusion_tag,
> but rather inspects the requests locale and delivers the right content at
> rendering time.

OK. I'll supply content 'manually'.


Thanks for your help

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: How do I echo template variables?

2007-07-30 Thread Peter Melvyn

On 7/30/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:

> Try {% debug %}

If you mentioned this feature: is there an easy way to reformat {%
debug %} output the same/similiar way an exception error is reported?

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: Problems with i18n of field labels (newforms)

2007-07-25 Thread Peter Melvyn

On 7/25/07, Nathan Ostgard <[EMAIL PROTECTED]> wrote:

> What import are you aliasing as _?

Nothing, because I believed it is globally available and no import is
neccessary.

It was probably true before swap to UNICODE. And on the top of it, I
got somehow deranged and assumed that _() function is always lazy ->
this was a reason I was absolutely blind to this problem.

Thanks for your help, 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
-~--~~~~--~~--~--~---



Problems with i18n of field labels (newforms)

2007-07-25 Thread Peter Melvyn

Hi all,

I'm trying to embed login form into each page. I implemented it using
new forms as inclusion tag. Form model looks like:
  ...
  sf_name = forms.CharField(required=True, label=_('Username:'),
max_length=30,  widget=forms.TextInput(attrs={'class':'wsu-login-edit'}))
  ...

If I change language by setting session['django-language'], page is
re-rendered correctly using the new language, except labels defined in
 form model (texts translated in underlying inclusion template are
OK).
When re-rendering page, form is instantiated again, but texts in
labels does not correspond to current
request.session['django-language'] value. I tried to trace Django-code
down, but I was lost somewhere in copy.py

#

Having this written, I got an idea to test another new form instances
and it seems that those instances do not work as well i.e. instance
does not translate labels if language is session changed is changed.

#

Please, could anybody advise me, what I'm missing?


Thank, 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: Auth framework - initials et of users/groups ?

2007-07-24 Thread Peter Melvyn

On 7/25/07, Przemyslaw Wegrzyn <[EMAIL PROTECTED]> wrote:


> Thanks! I overlooked the 'fixtures' feature, I'll give it a try.

I don't know wjhat kind of SQL server do you use, but If  I'm not
mistaken, fixtures are not fully supported on MySQL with InnoDB
engine.

--~--~-~--~~~---~--~~
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: Insert vs. Update

2007-07-24 Thread Peter Melvyn

On 7/24/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:

> You're not the first to suggest insert() and update() methods that
> explicity do SQL INSERT and UPDATE calls.

FYI: both, SQLite and MySQL support REPLACE statement to do this automatically.

--~--~-~--~~~---~--~~
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: transaction commit

2007-07-24 Thread Peter Melvyn

> Your example is correct, and you aren't violating any 'Django principles'.

Really? Should not be there something like this?

enter_transaction_management()
try:
managed(True)
 try:
 ...
 except:
   transaction.rollback()
   raise ...
 else:
   transaction.commit()
finally:
leave_transaction_management()

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



Name of inclusion-tag template built in run-time

2007-07-23 Thread Peter Melvyn

Hi all,


I have a box containing some static texts in different languages and I
would like to plug-in into few pages as inclusion tag.

But I'm not able to find-out a way how to supply language code for its
template name containing thos static text. I need something like this:

register.inclusion_tag('%s/tag_cust_support.html' %
request.LANGUAGE_CODE, takes_context=True)(.)

Please, is it somehow possible to access language code of current session
or I should pass those static text via underlying Python function?


Thanks, 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: Usage of {% trans ....%} tag in templates related to inclusion tags

2007-07-20 Thread Peter Melvyn

On 7/20/07, eXt <[EMAIL PROTECTED]> wrote:

> Do you have: {% load i18n %} in your template?

Certainly not - I forgot it - now it works fine.

Thank you for help

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



Usage of {% trans ....%} tag in templates related to inclusion tags

2007-07-20 Thread Peter Melvyn

Hi all,

I'am embedding a piece of information into each page using inclusion
tag and it seems everything works fine except tag {% trans ... %}. Its
occurence in the inclusion template raises expcetion
TemplateSyntaxError saying "Invalid block tag: 'trans'".

Did I miss anything or it is neccessary to translate text out of the
template and pass it as an item in the dictionary returned by
underlying function?


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



Internationalization of templates

2007-06-29 Thread Peter Melvyn
Hi,

I'm beginner in Django and I have a question about internationalization
support.
If my understanding of i18n is correct, there are 3 basic approaches:
1. for  views  _() function
2.  for templates {% trans ... %} block
3. for static files URL containing language code

Templates containing more static texts I'd like organize in separated
folders e.g.
app/templates/de/tpt1.html
  en/tpt1.html
and pass their names e.g. to render_to_response() function. But I'm not
sure if I can do that, because  TEMPLATE_DIRS
contains absolute pathes to folders, where Django will
look for templates files
by name. Is it possible to pass something like 'de/tpt1.html'  as
'template_name' argument?

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