Re: Django3 runserver error

2020-07-30 Thread Thierry DECKER
The resolve() method dose not have the strict parameter anymore.

Regards

Le jeu. 30 juil. 2020 à 11:25, Mira  a écrit :

> Hi All,
> I recently upgraded Django from 2.2 to 3 on my MacOS10.13.
> I am using Python 3.6 and My Application was working fine with Django 2.2
> but now i am getting below error.
>
> Any help related with this topic would be greatly appreciated.
>
> $>python3 manage.py runserver
>
> Watching for file changes with StatReloader
>
> Performing system checks...
>
>
> Traceback (most recent call last):
>
>   File "manage.py", line 22, in 
>
> execute_from_command_line(sys.argv)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 401, in execute_from_command_line
>
> utility.execute()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 395, in execute
>
> self.fetch_command(subcommand).run_from_argv(self.argv)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 328, in run_from_argv
>
> self.execute(*args, **cmd_options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 60, in execute
>
> super().execute(*args, **options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 369, in execute
>
> output = self.handle(*args, **options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 95, in handle
>
> self.run(**options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 102, in run
>
> autoreload.run_with_reloader(self.inner_run, **options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 599, in run_with_reloader
>
> start_django(reloader, main_func, *args, **kwargs)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 584, in start_django
>
> reloader.run(django_main_thread)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 299, in run
>
> self.run_loop()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 305, in run_loop
>
> next(ticker)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 345, in tick
>
> for filepath, mtime in self.snapshot_files():
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 361, in snapshot_files
>
> for file in self.watched_files():
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 260, in watched_files
>
> yield from iter_all_python_module_files()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 105, in iter_all_python_module_files
>
> return iter_modules_and_files(modules, frozenset(_error_files))
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 141, in iter_modules_and_files
>
> resolved_path = path.resolve(strict=True).absolute()
>
> TypeError: resolve() got an unexpected keyword argument 'strict'
>
> udaysingh@udays-MacBook-Pro:~/Django/dreamProj>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAANDXNtvg9sP5OqLktcECco1MhpV0%3DcMgYCKvAF0TLXAH9bpog%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP0vuur1YSp4ptXz%2BnLYAR7adzKLT%2BDRgSXmvvoWa-7DcR2PuQ%40mail.gmail.com.


Model uniqueness constraint with date extraction

2020-02-18 Thread Thierry Backes
Hey,

 

I have a model which has a date and a foreign key field. I want a uniqueness 
constraint that each fk can only be used once per month, so Unique(date__year, 
date__month, fk). However, when I use this in my model’s metadata:

 

models.UniqueConstraint(fields=['date__year', 'date__month', 'category'], 
name='date_month_cat_unique')

 

I get an error that the date__year field doesn’t exist. This is a bit strange 
because I use this syntax throughout my app and I also know that such 
constraints are supported by Postgres:

 

create unique index year_month_uq 

  on foo 

  ( extract(year from mydate), 

extract(month from mydate)

  ) ;

 

As per 
https://dba.stackexchange.com/questions/210736/postgresql-enforcing-unique-constraint-on-date-column-parts

 

What am I doing wrong here? I’m using Django 3 and Postgres.

 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5359FB6C-7EC4-4E37-938B-8C346188FFE9%40contoso.com.


Using Django as dependency in an API

2015-09-17 Thread Thierry
Hi everybody,

Django has got many features really interesting to reuse in APIs like its 
builtin ORM or template engine.

Maybe I'm wrong but it seems required to initalize Django with the 
configure() and setup() functions to register models and databases and make 
the glue between several independent modules. All seems based on the 
concept of application and it makes really difficult to distribute APIs 
separately.

How is it possible to avoid this global Django configuration and make this 
configuration at a module level ? For example, to register models in a 
database at module import or define the database backend for a module. 

Cheers,

Thierry.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e150aa1-b39f-497d-86d8-8fea34fe52b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: use apache instead of server by default

2015-02-10 Thread Thierry Granier
peraps but i have no choice and i must use apache.
I don't understand the different docs tu use apache.

Help please
Thanks

Le dimanche 8 février 2015 23:20:31 UTC+1, Thierry Granier a écrit :
>
> Hello
>
> i have installed python3.4 and django1.7 on debian jessie.
>
> runserver works with mysql-connector and mysql databases.
>
> I'd like to use apache instead of this server.
> So i have installed via sysaptic the module libapache2-mod-wsgi
>
> why can't i install my website root in the document/root of apache?
> i don't understand the virtualhost and the directives associated.
>
> Thanks for your help
>
> T.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/031aeba6-99e0-48a4-a74c-cc5d05f08052%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


use apache instead of server by default

2015-02-08 Thread Thierry Granier
Hello

i have installed python3.4 and django1.7 on debian jessie.

runserver works with mysql-connector and mysql databases.

I'd like to use apache instead of this server.
So i have installed via sysaptic the module libapache2-mod-wsgi

why can't i install my website root in the document/root of apache?
i don't understand the virtualhost and the directives associated.

Thanks for your help

T.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a38d1534-93e9-4870-be96-acff9a46b56f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple TaggableManager() on model [django-taggit]

2013-06-27 Thread Thierry Ballzac
This solution did the business for me nicely!

https://neutron-drive.appspot.com/blog/multiple-tags


On Tuesday, July 17, 2012 12:52:55 PM UTC+1, Alir3z4 wrote:
>
> Hi
> This question is about having more than one 
> taggit
> .managers
> .TaggableManageron
>  model.
> I guess many people have faced with this issue before, But i couldn't find 
> any *complete* correct solution for it.
> And also there is #50 
> issue/ticket opened since 
> one year ago on the taggit's github repo, and 
> couple of solution provided which none of them is the correct solution.
> So how you implement a model with more than 1 TaggableManager ?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Transifex - django 1.3

2010-12-20 Thread Thierry
Whats the best way to currently setup transifex with django 1.3

The announcement says that people are working on this.
Dont want to duplicate their efforts, where can i find information on
this?

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



Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread Thierry
I noticed you are importing your project name, are you invoking your
"python manage.py shell" from within your project folder?  If you are,
try the following:

project_folder/python manage.py shell
>>> from polls.models import Poll
>>> dir(Poll)

The above should show you that "was_published_today" method in a
list.  Try to call the method again:

>>> Poll.objects.get(pk=1).was_published_today()


On Jun 16, 8:08 am, "!...@!!!"  wrote:
> Hello,
> I am a Python newbie and this is my first time I use Django and
> Python.
> I was reading the Django App tutorial Part 1 and got stuck in a place.
>
> I execute these statements in the Python Shell:
>
> >>> from mysite.polls.models import Poll, Choice
> >>> import datetime
> >>> p = Poll(question="What's up?", pub_date=datetime.datetime.now())
> >>> p.save()
> >>> p = Poll.objects.get(pk=1)
> >>> p.was_published_today()
>
> For the last statement I get an error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
> AttributeError: 'Poll' object has no attribute 'was_published_today'
>
> This is my "models.py" file:
>
> from django.db import models
> import datetime
>
> class Poll(models.Model):
>     question = models.CharField(max_length=200)
>     pub_date = models.DateTimeField('date published')
>     def __unicode__(self):
>         return self.question
>     def was_published_today(self):
>         return self.pub_date.date() == datetime.date.today()
>
> class Choice(models.Model):
>     poll = models.ForeignKey(Poll)
>     choice = models.CharField(max_length=200)
>     votes = models.IntegerField()
>     def __unicode__(self):
>         return self.question
>
> I wrote it with IDLE.
> I thought it was an indentation and whitespace problem, but I followed
> strictly the identation rules and used only tabs.
> Also I tried other editors and nothing changed. the error message
> still shows up.
> Please help me, what am I doing wrong?

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



testing the comment framework using the test client

2010-05-25 Thread Thierry
How do you guys test implementations of the django comment framework?
A regular post doesnt seem to work because it depends on data from a
previous get.
An thoughts?

def test_comment(self):
item_url = reverse('item', args=['4558'])
self.client.login(username=self.username,
password=self.password)
import datetime
test_message = 'test at %s' % datetime.datetime.today()
item_view = self.client.get(item_url)
comment_submit = self.client.post(item_url, {'comment':
test_message})
test = open('test.html', 'w')
import os
print dir(test)
print test.name
print os.path.abspath(test.name)

test.write(unicode(comment_submit))
item_view = self.client.get(item_url)
self.assertContains(item_view, test_message)

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



Ordering a QuerySet by a Python property ?

2010-05-19 Thread thierry
Hi all,

The order_by method makes possible to sort objects relatively to a
specified field. But how can I sort a QuerySet relatively to a Python
property ?

Thanks,

Thierry.

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



Re: Specifying an order_with_respect_to for a self referential one to many relationship (still) fails

2010-05-11 Thread thierry
This bug is 4 years old. Weird that It was not corrected yet because
it seems to be a core functionality of the ORM. Do django developpers
have planned something before 1.2 stable release ?

Regards,

Thierry.

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



Re: Subclassing models.Model to extend base functionalities and attributes

2010-05-11 Thread thierry
No, I don't talk about model inheritance. Mainly because base class
fields are propagated to subclasses. I'd like to overload some base
methods of the "models.Model" class to making them available from all
classes of a model.
But a metaclass mechanism makes overloading impossible because it
forces directly to a database model inheritance.

Consequently, I will abadon this way and focus on signal dispatcher
because it seems possible to trigger homemade functions happening
before or after models.Model methods execution. But I stay tuned if
somebody has got a solution.

Regards,

Thierry.



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



Subclassing models.Model to extend base functionalities and attributes

2010-05-07 Thread thierry
Hi everybody,

Is there a way to subclass the 'models.Model' class behavior to
extend
base functionnalities and attributes to all classes contained in an
application model ? It seems that the metaclass mechanism force the
Python inheritance notation to a Database model inheritance.

Thanks,

Thierry.

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



Django ORM and multidimensional data

2010-05-07 Thread thierry
Hi all,

Have django developers planned the integration of new model fields
capable to store multidimensional data ? If it's not the case, how
can
I submit this implementation request ?

By implementing this kind of basic types, I think it could be a way
for the Django project to reach the scientific community where Python
and databases are more and more popular to store experimental and
analyses data.

Thanks,

Thierry.

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



Specifying an order_with_respect_to for a self referential one to many relationship (still) fails

2010-05-07 Thread thierry
Hi all,

I'd like to know if this problem, described in this post
http://www.google.com/url?sa=D=http://groups.google.com/group/django-updates/browse_thread/thread/e247ff8079eda192=AFQjCNHKyZDdY0P7z3TnSKg92GnTnlNz0Q,
will be solved in the next stable release of Django.

Thanks.

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



Re: code repetition in views

2010-04-18 Thread Thierry Chich



Le 16 avr. 2010 à 20:32, Carl Zmola <czm...@woti.com> a écrit :



2) Rewriting your views as classes is the modular way and probably  
the most flexible.


A nice trick with the use of inheritance is to make the class a  
callable


  def __call__(self, request, **kwargs):
  This method provides the view


Then you can instantiate the class and call it as if it were a method.


MyView=MyViewClass()


I didn't even know I could do it ! I have intensively use the  
@classmethod decorator.



and MyView can be used in your urls.py as if it were a normal view.


3) If you want to perform an action before every page is served, you  
can define middleware to do some processing.  For instance you can  
make a whole site password protected very easily and not need a  
@login_required decorator.  You just have to let the login and  
logout screens pass through the middleware.


This works if you really want to do the same thing for EVERY page.

Carl






On Apr 10, 11:38 pm, Thierry Chich<thierry.ch...@gmail.com>  wrote:

I have written my functions as méthods of classes. Then it allow 
 to  use inheritance.


Le 11 avr. 2010 à 05:58, ydjango<neerash...@gmail.com>  a écrit :



I find all my view method have identical code in start and in end:




anyway to avoid repetition...?




Example:




def typical_view_method(request):




  Check if user is authenticated.
  Get user and group
  Get some session variables




  try:
Method specific logic
  except Exception, e:
view_logger.error('error in typical_view_method:%s', e)



   response = HttpResponse(json_data, mimetype = 'application/ 
json')

   response.__setitem__('Cache-Control', 'no-store,no-cache')
   response.__setitem__('Pragma', 'no-cache')
   response.__setitem__('Expires', '-1')
   return response




--
You received this message because you are subscribed to the  
Google  Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group athttp://groups.google.com/ 
group/django-users?hl=en

.





--
Carl Zmola
301-562-1900 x315
czm...@woti.com


--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: how to install django in ubuntu .........

2010-04-18 Thread Thierry Chich

What is the point ? Why aren't you using the apt-get ?



Le 16 avr. 2010 à 23:38, ChrisR  a écrit :


Download this: http://www.djangoproject.com/download/1.1.1/tarball/
or
wget http://www.djangoproject.com/download/1.1.1/tarball/

tar xzvf Django-1.1.1.tar.gz
cd Django-1.1.1
sudo python setup.py install

--  
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Request to the list owner

2010-04-12 Thread Thierry CHICH

> On Mon, Apr 12, 2010 at 1:58 PM, Omer Barlas  wrote:
> > Can you please add a prefix to the email subject? I am reading my mail
> > mostly from my BB Bold, but I cannot filter mail like Thunderbird
> > does, it would be much simpler if there was a prefix like [django] or
> > such.
> 


It is true that mobile email client are not doing a very good job with 
filtering. Some of them don't do any job at all.

> No.
> 
> This has been proposed and rejected *many* times in the past. For example:
> 
> http://groups.google.com/group/django-users/browse_thread/thread/685617964e
> fab5f4
>  http://groups.google.com/group/django-users/browse_thread/thread/6207286aa
> 908f9b5
>  http://groups.google.com/group/django-users/browse_thread/thread/d8cc4b2f2
> 324d91b
>  http://groups.google.com/group/django-users/browse_thread/thread/6614ad241
> b3921f1
>  http://groups.google.com/group/django-users/browse_thread/thread/42a92e48c
> ec5c7c2
> 
> No offense, but if your mail client can't filter mail, then you need
> to get a better mail client.
> 
> Yours,
> Russ Magee %-)
> 

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



Re: code repetition in views

2010-04-11 Thread Thierry Chich
I have written my functions as méthods of classes. Then it allow to  
use inheritance.




Le 11 avr. 2010 à 05:58, ydjango  a écrit :


I find all my view method have identical code in start and in end:

anyway to avoid repetition...?

Example:

def typical_view_method(request):

  Check if user is authenticated.
  Get user and group
  Get some session variables

  try:
Method specific logic
  except Exception, e:
view_logger.error('error in typical_view_method:%s', e)

   response = HttpResponse(json_data, mimetype = 'application/json')
   response.__setitem__('Cache-Control', 'no-store,no-cache')
   response.__setitem__('Pragma', 'no-cache')
   response.__setitem__('Expires', '-1')
   return response

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: set up database engine

2010-04-08 Thread Thierry Chich
Some of the lines you are writing are not intended to be written in  
the Shell monitor. You must write them in the file  settings.py ! You  
have no alert message because variable='foo' is a correct syntax in a  
bourne Shell, but it is doing absolutely nothing.





Le 9 avr. 2010 à 05:58, yangyang <juz...@gmail.com> a écrit :


Hi Thierry,

Thanks for the reply. I understand what SQLight is but I don't know
how to write the code in my Mac shell... This is what I wrote:


yang-wangs-computer:~/applications/mysite yangwang$
database_engine='sqlite3'
yang-wangs-computer:~/applications/mysite yangwang$
database_name='trydb'
yang-wangs-computer:~/applications/mysite yangwang$ python manage.py
syncdb


It returns message like the database engine isn't installed. what's
missing here?

Thank you again!

Yang

On Apr 8, 3:50 am, Thierry CHICH <thierry.ch...@gmail.com> wrote:
Perhaps are you confused because of SQLlite. You need to know that  
SQLite is
not a classicaldatabasewith a server that you need to install. An  
sqlitedatabaseis only a file stored  where do you want.


Thierry




I mean the tutorial only tells you "edit settings" but doesn't tell
you how. Excuse me if this is obvious to most of people.



On Apr 7, 11:17 pm, yangyang <juz...@gmail.com> wrote:

how exactly set up thedatabaseengineas SQLight? The tutorial
doesn't seem to tell us...



Thanks!


--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: set up database engine

2010-04-08 Thread Thierry CHICH
Perhaps are you confused because of SQLlite. You need to know that SQLite is 
not a classical database with a server that you need to install. An sqlite 
database is only a file stored  where do you want.


Thierry  
> I mean the tutorial only tells you "edit settings" but doesn't tell
> you how. Excuse me if this is obvious to most of people.
> 
> On Apr 7, 11:17 pm, yangyang <juz...@gmail.com> wrote:
> > how exactly set up the database engine as SQLight? The tutorial
> > doesn't seem to tell us...
> >
> > Thanks!
> 

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



Middlewares disable for specific views

2010-04-06 Thread Thierry
Is it possible to disable a middleware such as the authentication one
for specific views where they are not needed?
The constant querying for messages annoys me a bit :)

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



Re: Tricky problem: database tables are not created

2010-04-05 Thread Thierry Chich

Is manage.py sqlall working ?



Le 5 avr. 2010 à 14:03, Torsten Bronger  a écrit :



Hallöchen!

Torsten Bronger writes:


[...]

But it gets even more strange: The models module of "chantal_ipv"
imports models from "samples".  I think this is the problem.  If I
comment out all calls to admin.site.register in the models of
"samples", it works!  WTF?


I tracked the problem down to the file django/db/models/loading.py.
"import_module" in the method load_app fails.  Apparently it tries
to load chantal_ipv.models which in turn loads samples.models which
in turn calls admin.site.register, which starts the loop again.

The whole thing belongs to model validation which doesn't take place
if "DEBUG=False".

By the way, how can I get proper tracebacks from "manage.py --sync"?
"--traceback" doesn't do it.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
  Jabber ID: torsten.bron...@jabber.rwth-aachen.de
 or http://bronger-jmp.appspot.com

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Model inheritance foreign key user

2010-04-04 Thread Thierry Chich
You are right but it would not change his problem. If 2 or more  
classes inherit from a class with a foreignkey or a manytomany, there  
will be a conflict in the related name




Le 4 avr. 2010 à 14:11, Daniel Roseman  a  
écrit :



On Apr 3, 10:37 pm, Fredrik  wrote:

What I want is to "automatic" add an owner to every object..

Is there another way to accomplish the same?

Fredrik



Do you need the PersistentModel field to exist in a separate table? It
sounds to me as if that would be better off as an abstract model.
--
DR.

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Model inheritance foreign key user

2010-04-04 Thread Thierry Chich





Le 3 avr. 2010 à 23:37, Fredrik <frecarl...@gmail.com> a écrit :


What I want is to "automatic" add an owner to every object..

Is there another way to accomplish the same?


I see. I have had a similar problem. I have tried a similar solution  
with exactly the same effect.
 I could have add manualy a foreignkey to each class with a proper  
related_name. At this point, i realised that it will be an huge load  
for the database and I have simplified my authorization design. I have  
deeply look to an app called 'namespace' but it don't fit to my need  
(but perhaps it could fit yours ?).
Now it work with a simple authorization function applied on the  
queryset when i populate my forms.


Thierry


Fredrik


On Apr 3, 10:48 pm, Thierry Chich <thierry.ch...@gmail.com> wrote:

I think that if you want make inheritance it is because you want to
have others subclasses. But then, your related name will be same for
all the subclasses.
There is no solution with the stable version. In the dev version, it
is possible to add the origin class name in the related_name. It is
documented, but i don't remember where exactly.

Thierry

Le 3 avr. 2010 à 20:38, Fredrik <frecarl...@gmail.com> a écrit :


Hi,
I want to use it like this:



"""
class PersistentModel(models.Model):
   deleted = models.BooleanField(default = False)
   date_created = models.DateTimeField(default=datetime.now)
   date_edited = models.DateTimeField(default=datetime.now)
   owner = models.ForeignKey(User)



class Contacts(PersistentModel):
   full_name = models.CharField("Fullt navn", max_length=20)
   address = models.CharField("Adresse", max_length=50)
   phone = models.CharField("Telefon", max_length=20)
   email = models.EmailField("Epost", max_length=50)



   def __unicode__ (self):
   return self.full_name
"""



But it creates errors,
" Reverse query name for field 'owner' clashes with field
'User.email'. Add a related_name argument to the definition for
'owner'.


But if I try to add related_name to owner, then I get a lot of  
errors

like this:



"""
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition  
for

'owner'.
contacts.contacts: Reverse query name for field 'owner' clashes with
related field 'User.Owner'. Add a related_name argument to the
definition for 'owner'.
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition  
for

'owner'.
contacts.contacts: Reverse query name for field 'owner' clashes with
related field 'User.Owner'. Add a related_name argument to the
definition for 'owner'.
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition  
for

'owner'.
contacts.contacts: Reverse query name for field 'owner' clashes with
related field 'User.Owner'. Add a related_name argument to the
definition for 'owner'.
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition  
for

'owner'.
"""



Hopefully, someone can help me out :)



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

.


--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Model inheritance foreign key user

2010-04-03 Thread Thierry Chich
I think that if you want make inheritance it is because you want to  
have others subclasses. But then, your related name will be same for  
all the subclasses.
There is no solution with the stable version. In the dev version, it  
is possible to add the origin class name in the related_name. It is  
documented, but i don't remember where exactly.


Thierry



Le 3 avr. 2010 à 20:38, Fredrik <frecarl...@gmail.com> a écrit :


Hi,
I want to use it like this:

"""
class PersistentModel(models.Model):
   deleted = models.BooleanField(default = False)
   date_created = models.DateTimeField(default=datetime.now)
   date_edited = models.DateTimeField(default=datetime.now)
   owner = models.ForeignKey(User)

class Contacts(PersistentModel):
   full_name = models.CharField("Fullt navn", max_length=20)
   address = models.CharField("Adresse", max_length=50)
   phone = models.CharField("Telefon", max_length=20)
   email = models.EmailField("Epost", max_length=50)

   def __unicode__ (self):
   return self.full_name
"""

But it creates errors,
" Reverse query name for field 'owner' clashes with field
'User.email'. Add a related_name argument to the definition for
'owner'.

But if I try to add related_name to owner, then I get a lot of errors
like this:

"""
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition for
'owner'.
contacts.contacts: Reverse query name for field 'owner' clashes with
related field 'User.Owner'. Add a related_name argument to the
definition for 'owner'.
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition for
'owner'.
contacts.contacts: Reverse query name for field 'owner' clashes with
related field 'User.Owner'. Add a related_name argument to the
definition for 'owner'.
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition for
'owner'.
contacts.contacts: Reverse query name for field 'owner' clashes with
related field 'User.Owner'. Add a related_name argument to the
definition for 'owner'.
contacts.contacts: Accessor for field 'owner' clashes with related
field 'User.Owner'. Add a related_name argument to the definition for
'owner'.
"""



Hopefully, someone can help me out :)



--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



User and additionnal fields

2010-04-02 Thread Thierry Chich
Hello,

I have add some additionnal fields in a class "Utilisateur" to my Users using 
the classical method: a OneToOne relation field from Utilisateur to User  and 
the AUTH_PROFILE_MODULE in the setting.py

This is well working, and I want now manage my "Utilisateur" using a single 
Form. 

I have try to use multi inheritance, but it don't work: 

class UserModelForm(forms.ModelForm):
class Meta:
model= User
class UtilisateurOnlyModelForm(DroitModelForm):
class Meta:
model = Utilisateur 
exclude = ('domaine','user')
class UtilisateurModelForm(UserModelForm,UtilisateurOnlyModelForm):
pass

This a little bit boring because it will avoid me to rewrite some of my 
generic model view if I could have all the data I need in just one Form. Is it 
a simple way to do that ?

Thierry,

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



Re: Chained select boxes--what's my best strategy?

2010-04-02 Thread Thierry Chich
If your selectbox are corresponding to foreignkey in yours models, it  
coult be very simple. It could be a sucession of urls , generic views  
and simple templates.


Other thing: there is a lot of jquery plugins that don't need Ajax to  
work. Lot of them could use elements already in the DOM. For instance,  
i use the powerfull plugin datatables in order to have sortable,  
paginable, themable and filterable tables. I never have to use Ajax  
for that. I just to put some configurations, give an id to my table,  
and it's enough.


Thierry


Le 2 avr. 2010 à 07:22, Daniel <unagimiy...@gmail.com> a écrit :


Hi,

I'm basically trying to implement a series of chained select boxes,
i.e.  If you select a vehicle = car, then it'll popup another select
box of brands.  Select Honda and then it'll pop up another select box
of prices, for example.

The thing is, these select boxes should be populated dynamically from
a database.

Would my best option to be to use jquery, which I understand would
automatically mean I'm using javascript + ajax?  Or would it be easier
to somehow do this without javascript?

I'm a bit unclear as to what complexity filling in the select boxes
from the database introduces into this.  If I could hard code the
chained select boxes, then I could use javascript all the way.  But I
think that using ajax, I can fetch the next select box's data from the
server, right?

I'm going for the easiest possible way, rather than giving the best
user experience b/c I'm new to django.

Thank you

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: How do I properly unit test a Django session?

2010-03-31 Thread Thierry Chich
Le mercredi 31 mars 2010 05:40:43, adambossy a écrit :
> The behavior of Django sessions changes between "standard" views code
> and test code, making it unclear how test code is written for
> sessions. Googling this yields two relevant discussions about this
> issue:
> 
> 1. "Easier manipulation of sessions by test client" [http://
> code.djangoproject.com/ticket/10899]
> 2. "test.Client.session.save() raises error for anonymous
> users" [http://code.djangoproject.com/ticket/11475]
> 
> I'm confused because both tickets have different ways of dealing with
> this problem and they were both Accepted. I assume this means they
> were patched and the behavior is now different. I also don't know to
> which versions these patches would pertain.
> 
> If I'm writing a unit test in Django 1.0, how would I set up my
> session store for sessions to work as they do in the browser?
> 
Hi, 
Perhaps, you should be more explicit with your problem. I am using the client 
and there is no problem at all.

For instance;
class GeneriqueTestCases(TestCase):   
def test_login_admin(self):

self.failUnlessEqual(self.client.login(username='admin',password='admin'),True)
self.client.logout()
response=self.client.get("/accounts/accueil/")

self.assertRedirects(response,'/accounts/login/?login=/accounts/accueil/')

def test_login_domaine(self):
self.client.login(username='admin', password='admin')
response=self.client.get('/accounts/accueil/')
self.assertEqual(response.context['user'].username, 'admin')
d=Domaine.objects.get(nom='DomaineAdmin')
self.assertEqual(self.client.session.get('domaine'),d)

In the last test, I am explicitely using informations stored in a session. 
(However, I have searched a long time before I understand that some variables 
was set in the accounts/accueil/ page :-( )

Thierry

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



Re: Initializing a ModelForm don't work - BUG ?

2010-03-29 Thread Thierry Chich
Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit :
> > OK. I can also put an hidden field in my form. I will evaluate what is
> > the better option for me.
> 
> Bear in mind if you exclude it from your form altogether there is
> nothing to stop a malicious user setting it by modifying the post
> data.
> 
> Peter
> 
You would say : if i use an hidden form. If I exclude the field from my 
ModelFrom, a corrupted POST can not have an effect. I just have to set the 
field 
value in the model, and it is done, isn't it ?

Thierry

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



Re: Using ModelForm to edit ManyToMany in both directions?

2010-03-29 Thread Thierry Chich


Nice idea ! It will simplify my work.
Thanks to share it !


Le 28 mars 2010 à 22:29, "pjrhar...@gmail.com"  a  
écrit :



See this snippet:

http://www.djangosnippets.org/snippets/1295/

Peter

On Mar 27, 6:02 am, jwils2...@gmail.com wrote:
I believe the answer is to append a regular Form to the ModelForm)  
with a
single ModelMultipleChoice field and use its queryset member to  
manage the

selected volunteers manually.

I've found Django to be so good at just having everything I need, I  
was

hoping there would be something out of the box for this as well.

Wilb


--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Probably a very basic data modeling question

2010-03-28 Thread Thierry Chich

Hi

For what i understand of your problem,  you are calling tag the fields  
of a Model called Sample. From, what you say, it is not possible to  
say a lot of things, but it appear that you will have others models,  
such as Diseases, Country, 


You will need to relate the models with foreignkey fields (one to  
Many ).


However, it seems to me that you need to work a little bit on the  
formalisation of your problem. In fact, you should be able to build  
the relationship diagram of your application before any programming  
step.
Once you learn how to ask to yourself the good questions, you'll see  
that the conception of the django models is easy.



Thierry


Le 28 mars 2010 à 03:28, Daniel <unagimiy...@gmail.com> a écrit :


Hi all,

I'd appreciate it if you could help me out with something.

I am trying to build a way to use faceted browsing through a database
of biological samples.

what I want to model is this:

Sample 1
race = white
age = adult
gene = XCFR2
disease = cancer
Sample 2
race = white
age = child
gene = 343GS
disease = stroke
date = 2010
country = Netherlands

So each sample could contain many tags.  And each tag should have one
value at a time.  A tag is a category (like race, age, gene, disease),
and a value is for lack of a better word, the choice or free text that
is entered to the right of the ='s sign.  TAG = race, then value =
white

So  does each sample have a many to many relationship with tags?  And
then tags have a many to many relationship with values?

Each sample can have many tags (race, age, gene, disease, ...etc).
Each tag can have many diff values (race could be white, black,
hispanic, asian, etc...) BUT only one at a time
Each value should be mapped to one tag at a time.  But I guess a value
could be reused, like the value XCFR2 could be a valid in gene = XCFR2
and discovered_information = XCFR2.

I think I'm making it too hard, but if someone can help, I would be
happy

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Thierry Chich
Le samedi 27 mars 2010 19:23:04, Daniel Roseman a écrit :
> On Mar 27, 4:34 pm, Thierry Chich <thierry.ch...@gmail.com> wrote:
> > I think I get the point.
> >
> > If I write
> > obj=MyModel()
> > obj.domaine=request.session.get("domaine")
> > form=MyModelForm(instance=obj)
> > if form.is_valid():
> > form.save()
> >
> > It works (but I didn't populate my form)
> > So it seems that the data provided in data=request.POST are overwriting
> > my domaine field.
> > It is really curious, because request.POST doesn't contain any reference
> > to my field domaine
> >
> > It's look like a bug, isn't it ?
> 
> No, this is expected and documented behaviour. If the POST doesn't
> contain a value for a particular model field, that field is set to
> blank. This is because an empty HTML field is not included in an POST,
> exactly as if the field wasn't on the form at all.
> 
This make sense. It is obvously a good reason.

> If you don't want this to happen, exclude the domaine field from the
> form altogether via the modelform Meta 'fields' or 'exclude' tuples.
OK. I can also put an hidden field in my form. I will evaluate what is the 
better option for me.

Thanks very much. 

Thierry

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



Re: Initializing a ModelForm don't work - BUG ?

2010-03-27 Thread Thierry Chich
I think I get the point.

If I write
obj=MyModel()
obj.domaine=request.session.get("domaine")
form=MyModelForm(instance=obj)
if form.is_valid():
form.save()

It works (but I didn't populate my form)
So it seems that the data provided in data=request.POST are overwriting my 
domaine field.
It is really curious, because request.POST doesn't contain any reference to my 
field domaine

It's look like a bug, isn't it ?

Le samedi 27 mars 2010 15:54:53, Thierry Chich a écrit :
> Le samedi 27 mars 2010 14:39:40, Thierry Chich a écrit :
> > Hello all
> >
> > I have a problem to understand something. I could find some workaround
> >  easily, but I don't want it. I want to understand.
> >
> > So this if the situation. I have a modelForm (MyModelForm) that is build
> > on a model (MyModel) with one field mandatory (domaine - and it is a
> > Foreignkey). I don't want to show it to the user. I want it set in the
> > program
> >
> > I wrote this code in my view:
> >
> > if request.method == 'POST'
> > obj=MyModel()
> > obj.domaine=request.session.get("domaine")
> > form=MyModelForm(request.POST,instance=obj)
> > if form.is_valid():
> >obj.save()
> 
> Smal mistake: it is form.save(), but it doesn't change nothing about the
> problem. It never enter in this cond. form is not valid.
> 
> > I was thinking that since obj already contain a 'domaine', it will not
> > complaining, but it is not the case. the form is considered as no valid
> > because of the domaine field. It is really disturbing for two reason:
> >
> > 1) with the debugger, I clearly see the domaine object in obj. I also see
> > a form.fieds.domaine that looks great.
> >
> > 2) In an other part, that work this time, I have something pretty
> > similar. I modified an obj already existant
> 
> Forget this point. It doesn't work. i don't know why. A regression, I
> believe  So the idea doesn't seems work at all. If somebody know why
>  ...
> 
> > if request.method == 'POST':
> >     obj=get_object_or_404(MyModel,id=id)
> > form=MyModelForm(request.POST,instance=obj)
> > if form.is_valid():
> > form.save()
> >
> > If some of you have an idea, I would be thanksfull.
> >
> > Thierry
> 

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



Re: Initializing a ModelForm don't work

2010-03-27 Thread Thierry Chich
Le samedi 27 mars 2010 14:39:40, Thierry Chich a écrit :
> Hello all
> 
> I have a problem to understand something. I could find some workaround
>  easily, but I don't want it. I want to understand.
> 
> So this if the situation. I have a modelForm (MyModelForm) that is build on
>  a model (MyModel) with one field mandatory (domaine - and it is a
>  Foreignkey). I don't want to show it to the user. I want it set in the
>  program
> 
> I wrote this code in my view:
> 
> if request.method == 'POST'
> obj=MyModel()
> obj.domaine=request.session.get("domaine")
> form=MyModelForm(request.POST,instance=obj)
>   if form.is_valid():
>obj.save()
Smal mistake: it is form.save(), but it doesn't change nothing about the 
problem. It never enter in this cond. form is not valid.
> 
> I was thinking that since obj already contain a 'domaine', it will not
> complaining, but it is not the case. the form is considered as no valid
> because of the domaine field. It is really disturbing for two reason:
> 
> 1) with the debugger, I clearly see the domaine object in obj. I also see a
> form.fieds.domaine that looks great.
> 
> 2) In an other part, that work this time, I have something pretty similar.
>  I modified an obj already existant
> 

Forget this point. It doesn't work. i don't know why. A regression, I 
believe  So the idea doesn't seems work at all. If somebody know why ...

> if request.method == 'POST':
> obj=get_object_or_404(MyModel,id=id)
> form=MyModelForm(request.POST,instance=obj)
> if form.is_valid():
> form.save()
> 
> If some of you have an idea, I would be thanksfull.
> 
> Thierry
> 

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



Initializing a ModelForm don't work

2010-03-27 Thread Thierry Chich
Hello all

I have a problem to understand something. I could find some workaround easily, 
but I don't want it. I want to understand.

So this if the situation. I have a modelForm (MyModelForm) that is build on a 
model (MyModel) with one field mandatory (domaine - and it is a Foreignkey). I 
don't want to show it to the user. I want it set in the program

I wrote this code in my view:

if request.method == 'POST'
obj=MyModel()
obj.domaine=request.session.get("domaine")
form=MyModelForm(request.POST,instance=obj)
if form.is_valid():
   obj.save()

I was thinking that since obj already contain a 'domaine', it will not 
complaining, but it is not the case. the form is considered as no valid 
because of the domaine field. It is really disturbing for two reason:

1) with the debugger, I clearly see the domaine object in obj. I also see a 
form.fieds.domaine that looks great. 

2) In an other part, that work this time, I have something pretty similar. I 
modified an obj already existant 

if request.method == 'POST':
obj=get_object_or_404(MyModel,id=id) 
form=MyModelForm(request.POST,instance=obj)
if form.is_valid():
form.save()

If some of you have an idea, I would be thanksfull. 

Thierry

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



Re: New User - Writing your first Django app part 1 crashed

2010-03-27 Thread Thierry Chich

Are you sure that the postgres driver of your jython is installed ?



Le 27 mars 2010 à 01:52, Paul Harouff  a écrit :

On Fri, Mar 26, 2010 at 6:26 PM, Karen Tracey   
wrote:
On Fri, Mar 26, 2010 at 5:58 PM, Paul Harouff   
wrote:


I uninstalled Django development trunk and installed Django-1.1.1.  
Now
when I run "jython manage.py runserver" I get "Error: No module  
named

messages"



I've no idea bout your earlier problem but this one sounds like you  
are
using a settings file created by trunk-level manage.py startproject  
against
1.1.1 code. If you previously ran startproject using trunk-level  
code you
need to start over and re-run it with the older code you have  
installed now:
an 'uplevel' settings file may contain a number of new things that  
are not

going to be understood by 'backlevel' Django.



Thank you. That was the problem. The settings.py file has two extra
lines. I was able to get Django-1.1.1 to run and connect to it with a
browser.

BUT, now when I move on to the next step in the tutorial it crashes  
again.


/CSDB/projects/mysite> jython manage.py syncdb
Traceback (most recent call last):
 File "manage.py", line 11, in 
   execute_manager(settings)
 File "/CSDB/jython/Lib/site-packages/django/core/management/ 
__init__.py",

line 362, in execute_manager
   utility.execute()
 File "/CSDB/jython/Lib/site-packages/django/core/management/ 
__init__.py",

line 303, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 195, in run_from_argv
   self.execute(*args, **options.__dict__)
 File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 222, in execute
   output = self.handle(*args, **options)
 File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 222, in execute
   output = self.handle(*args, **options)
 File "/CSDB/jython/Lib/site-packages/django/core/management/base.py",
line 351, in handle
   return self.handle_noargs(**options)
 File "/CSDB/jython/Lib/site-packages/django/core/management/ 
commands/syncdb.py",

line 49, in handle_noargs
   cursor = connection.cursor()
 File "/CSDB/jython/Lib/site-packages/django/db/backends/__init__.py",
line 81, in cursor
   cursor = self._cursor()
 File "/CSDB/jython/Lib/site-packages/django_jython-1.1.1-py2.5.egg/ 
doj/backends/zxjdbc/postgresql/base.py",

line 78, in _cursor
   self.connection = self.new_connection()
 File "/CSDB/jython/Lib/site-packages/django_jython-1.1.1-py2.5.egg/ 
doj/backends/zxjdbc/common.py",

line 39, in new_connection
   connection = zxJDBC.connect(self.jdbc_url(),
zxJDBC.DatabaseError: driver [org.postgresql.Driver] not found


All of my searches say the solution is to use the --verify flag with
jython. But, the --verify flag was removed from jython-2.5, because
that is now the default classpath behavior. So, I have no idea how to
fix this.

Paul

--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.




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



Re: Let Django form render field's with custom attributes (e.g CSS)?

2010-03-26 Thread Thierry
Thanks for the feedbacks.
And yes unfortunately I am bound to support our "official corporate
browser" IE6, otherwise I would have happily gone to a more CSS-only
direction.
What puzzles me most is that method BoundField.label_tag() has an
attr(ibute)s argument and some code to support it, but there is no
easy way to call it (unable to pass arguments to methods in
templates).

For the time being, I will go with my initial idea (subclassing my own
Widget/Renderer classes to provide  rendering with custom css),
leaving Field's  HTML definition as is.

I would however appreciate easy/lazy ways to customize attributes on a
Field's , e.g for common CSS patterns where the 
automatically gets "required" or "error" CSS classes depending on the
Field's validation options.

On 26 mar, 15:28, David De La Harpe Golden
<david.delaharpe.gol...@ichec.ie> wrote:
> On 26/03/10 13:18, Thierry wrote:
>
> > Hi,
>
> > I want to differentiate CSS style of fields  from the style of
> > RadioSelects  elements (as rendered through
> > RadioFieldRenderer).
> > Immediate action: I could create my RadioFieldRenderer/RadioInput
> > classes to display inner labels as.
>
> > Any direction you could give me? Thanks in advance.
>
> Well, not a general solution for element attributes, but do bear in mind
> that css selectors (and jquery's selectors for that matter) can be a bit
> more than just the basic "element" ".class" and "#id" that you always see.
>
> See e.g.http://www.w3.org/TR/css3-selectors/(or css2)
>
> So, you can style django's simple builtin form outputs somewhat more
> aggressively than you might realise if you're not up on css, without
> having to subclass to override outputs, if you _wrap_ the output in
> something for css to match.  [If your requirements include "support
> ancient versions of MSIE" you might find said ancient versions' css
> handling a bit annoying though]
>
> Vague example:
>
> 
>    
>      
>        div.form_wrapper > label { background-color: #ff }
>        div.form_wrapper label { color: #ff }
>        div.form_wrapper > label:first-child { color: #00ff00 }
>        div.form_wrapper > label:nth-child(3) { color: #00 }
>      
>    
>    
>    
>      FOO
>      
>        BAR
>      
>      BAZ
>      MOO
>    
>    
> 

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



Let Django form render field's with custom attributes (e.g CSS)?

2010-03-26 Thread Thierry
Hi,

I want to differentiate CSS style of fields  from the style of
RadioSelects  elements (as rendered through
RadioFieldRenderer).
Immediate action: I could create my RadioFieldRenderer/RadioInput
classes to display inner labels as .

But (and this is mostly my point of raising the issue), I was also
looking at a way to provide attributes (CSS classes, inline style, id,
etc) to the  element rendered directly by Django (though
{{form.as_ul}} or {{field.label_tag}} for instance).

Digging the code, I found the BoundField class with its method
label_tag. Problems:
- this method is either called from form.as_ul() (or as_p(), etc)
without passing attrs parameters
- or it can be called directly from a template
({{myfield.label_tag}}), but without the ability to pass extra
arguments.

Basically I am stuck wondering how to set attributes on a Field's
rendered label, without having to hardcode it in every form template,
or subclassing the whole Form/BoundField classes...

Any direction you could give me? Thanks in advance.

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



Re: ForeignKeyField

2010-03-26 Thread Thierry Chich
Le vendredi 26 mars 2010 04:14:51, Asim Yuksel a écrit :
> I have a question about model.ForeignKey field.Foreign key fields are
> shown as object in admin page. How can I show them in other types like
> integer type
> for example I have a Model like this:
> 
> class Advisor(models.Model):
> 
> advisorid = models.IntegerField(primary_key=True,
> db_column='advisorId')
> maphdid = models.ForeignKey(Tblmaphds, db_column='maPhDId')
> def __str__(self):
> return smart_str('%s' % (self.maphdid))
> def __unicode__(self):
> return smart_str('%s' % (self.maphdid))
> class Meta:
> db_table = 'Advisor'
> 
> The problem is I see the maphdid value as "Tblmaphds object" instead
> of a normal integer value.
> 
> What should I do to see a integer value?
> 
I am not sure of what I say because I just begin with django, but it seems to 
me that you are confusing foreignkey in models and foreignkey in SQL database.
For me, a foreignkey in django is an object, not an id.

So, it seems to me that maphdid is an object Tblmaphds. If you want to print 
the Tblmaphds.id value, you shoud have 
to write 
 return smart_str('%s' % (self.maphdid.id))

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



Re: Altering the auth_user model?

2010-03-24 Thread Thierry Chich
Le mercredi 24 mars 2010 16:53:12, Sandman a écrit :
> Hi Derek,
> 
> One way to do this would be to create a proxy model that can be used
> throughout your project.
> 
> Check out
> http://docs.djangoproject.com/en/dev/topics/db/models/#proxy-models for
> more info.

Hi,

This is what is said in one page, but in an other, it is suggested that you 
just create your class with yours fields and put  foreignkey on User.

It work very well, indeed.

http://docs.djangoproject.com/en/1.1/topics/auth/#topics-auth
see "Storing additional information about users"¶



> 
> Take care,
> Rajiv.
> 
> On 3/24/10 7:44 AM, Derek wrote:
> > I am currently using UserProfile to create additional fields that are
> > needed for my users.
> >
> > I would like to be able to alter the existing User model to use the same
> > fields, but make some of them "required" (show up as bold on the form)
> > e,g, the first name and last name.� How would I do that?
> >
> > Thanks
> > Derek
> 

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



Re: Forms with read only fields

2010-03-20 Thread Thierry Chich
Le samedi 20 mars 2010 16:05:20, Peter Reimer a écrit :
> Hi Folks,
> 
> I'm looking for a way to get the following done:
> Depending on different things (user, groups, rights, etc.) I want to
> show a form with fields that can either be changed or not. For
> example, a form with two fields for name and hobby, an admin can
> change both fields, a normal user can only change hobby.
> 
> One solution that came to mind: Create a form for both groups and
> exclude in the user's form the fields, he mustn't change. But I want
> two things:
> 1. Show the read-only values at the position where the admin sees the
> writeable fields because a user can be an admin (at another place) and
> it would be confusing to have different positions here and there.
> 2. Have something reusable: E.g. form = MySpecialForm(deactivated =
> [name]).
> 
> I checked to docu and googled around, not only some minutes... and
> found nothing.
> Has somebody here a hint for me? I don't want a solution, I'm thankful
> for some little hints.
> 

I am not sure, but for me, you should have something like
 
If you want it appear only when you give rights, you could put a condition in 
the template 


I don't know if it answer to your question or if you think at something more 
complex.

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



Django javascript includes

2009-11-17 Thread Thierry
Other frameworks (Symfony) offer simple hooks for managing js
includes.
In Django its simply a line of template code.

This is annoying for managing JS dependencies.

Did anyone write a nice little framework for managing js?

--

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




Re: Please help: {% url ... %} path resolve issue

2009-10-17 Thread Thierry

Hi,

Could it be that you are missing trailing slashes in customer add/edit/
delete url patterns?
E.g try:
(r'^customer/(?P\d+)/edit/$', 'customer_edit'),
instead of:
(r'^customer/(?P\d+)/edit$', 'customer_edit'),

Thierry.


On 17 oct, 14:12, Gerard <lijss...@gp-net.nl> wrote:
> Hi Boyombo,
>
> The error I get when using {% url customer_edit customer.id %} is:
>
> NoReverseMatch at /customer/2
> Reverse for 'customer_edit' with arguments '(2L,)' and keyword arguments
> '{}' not found.
>
> # The project url.py:
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('',
>      (r'^', include('djapp.myapp.urls')),
>
> # The app url.py:
> from django.conf.urls.defaults import *
> from django.conf import settings
> from django.contrib import admin
>
> admin.autodiscover()
>
> urlpatterns = patterns('djapp.myapp.views',
>      (r'^$', 'main'),
>      (r'^test/$', 'test'),
>      (r'^docs/$', 'documentation'),
>      (r'^mgmt/$', 'management'),
>
>      # Customers
>      (r'^customer/$', 'customer_list'),
>      (r'^customer/(?P\d+)$', 'customer_detail'),
>      (r'^customer/add$', 'customer_add'),
>      (r'^customer/(?P\d+)/edit$', 'customer_edit'),
>      (r'^customer/(?P\d+)/delete$', 'customer_delete'),
>
> -- snip --
>
>      (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>      (r'^admin/', include(admin.site.urls)),
> )
>
> Thanx a lot.
>
> Regards,
>
> Gerard.
>
>
>
> boyombo wrote:
> > Hi Gerard,
>
> > can you what is your url conf like and the error message you get?
>
> > On Oct 17, 10:10 am, Gerard <lijss...@gp-net.nl> wrote:
> >> Hi All,
>
> >> I've been trying to figure out why this works:
>
> >> {% url project.myapp.views.customer_edit customer.id %}
>
> >> And this does not:
>
> >> {% url customer_edit customer.id %}
>
> >> I could go for url() in my patterns and decouple view and pattern name, but
> >> is it not possible to tell the template loader (?) where to look for views?
>
> >> Feels like it just needs an import statement on the right place.
>
> >> NB: I tried passing views in patterns as strings and methods.
>
> >> Please advice.
>
> >> Kind regards,
>
> >> Gerard.
>
> >> --
> >> self.url =www.gerardjp.com
>
> --
> self.url =www.gerardjp.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to attach managers to models (outside model definition)?

2009-10-17 Thread Thierry

Hi,

I did not see any section of Django documentation related to attaching
managers to models outside of model definition.

My current case is a manager defined in a separate module (long story
short: to avoid circular imports), that I expected to attach to a
model with a naive statement:
MyModel.foo_objects = MyManager()
Unfortunately this manager returns nothing.
Its 'model' attribute is empty, and digging in the source code, I
noticed methods 'contribute_to_class / add_to_class';  but I did not
play with any of these yet.

So my questions are:
1) Is it possible to attach managers outside of model definition (as
far as I recall it was possible in versions < 1.0) ?
2) Did I miss the section in Django's documentation (or is it well-
hidden?)
3) Provided answer to question 1 is 'yes', what is the way to attach a
custom manager to a model?

Thanks in advance,
I could not see any similar message request or any ticket filled in
against documentation.

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



Re: Complex annotated/aggregated QuerySet ?

2009-10-17 Thread Thierry

Thanks Javier,

This is the perfect translation of the SQL I came up with.
I was almost there, but just afraid of having to play with 'extra' and
raw SQL.

Thierry.

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



Complex annotated/aggregated QuerySet ?

2009-10-16 Thread Thierry

Hi,

Considering the following models (simplified time-tracking app):
-
class Objective(models.Model):
  pass

class Task(models.Model):
  status = models.IntegerField()
  objective = models.ForeignKey(Objective, related_name='tasks')
-

I can retrieve Objective objects, each with a count of associated
tasks, using annotation/aggregation:
Objective.objects.annotate(count_tasks=Count('objective__tasks'))

What I would like to do, however, is the following:
Retrieving Objective objects, each with a count of completed tasks and
remaining tasks (i.e grouping by their status).

Can this be done 'natively' using Django querysets?
Thanks for any hint (sorry, my SQL skills are not even sharp enough to
translate this requirement with raw SQL).

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



Re: QuerySet cache

2009-09-06 Thread Thierry

Awesome


Right now im looping through the items as follows


chunk_size = 1
start = 0
while True:
end = start + chunk_size
items= items_queryset[start:end]; start += chunk_size


etc.

Is there an option to specify the chunk size (actual value retrieval,
not just object creation)?
Cause from the docs it appears to read all data in memory and iterate
the objects...
http://docs.djangoproject.com/en/dev/ref/models/querysets/#iterator








On Sep 6, 4:17 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Sun, Sep 6, 2009 at 10:14 AM, Thierry<thierryschellenb...@gmail.com> wrote:
>
> > QuerySet cache is usually quite great.
> > However when you are looping through a very large result set it would
> > be great if I could turn it off.
> > So here the question, how do I turn off the queryset cache?
>
> Just call .iterator() on the QuerySet and it will hvae it's cache disabled.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you
> want" -- Me
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



QuerySet cache

2009-09-06 Thread Thierry

QuerySet cache is usually quite great.
However when you are looping through a very large result set it would
be great if I could turn it off.
So here the question, how do I turn off the queryset cache?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Seamless integration of customized forms in my project

2009-08-18 Thread Thierry

You sold me on "this construction is unclear" and the "happy
debugging" is scaringly convincing.
I will stick with different classnames approach, with maintenance and
portability (reusing apps) in mind.
Thank you for your 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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Seamless integration of customized forms in my project

2009-08-18 Thread Thierry

(Please excuse my meaningless title as English is not my natural
language).

I would like some advice on how pythonic/heretic my approach is.

What I am trying to do is:
- subclass standard Form class (e.g to add new rendering methods)
- subclass some fields and widgets (e.g to add custom CSS attributes)
- replace all import statements "from django import forms" with "from
my_project import forms"
And that's all! Class names referred in my project (Form, RadioSelect,
DateField...) should not change.

I came up with the following module excerpt (myproject/forms.py):
from django.forms import *
class Form(Form):
  def my_rendering_method(self):
(...)

See my issue? To guarantee transparency between my own custom 'forms'
module and the standard one, I am subclassing but keeping the same
name, though I am not sure whether this is sane or not in Python...

Should I stick with custom class names and refer to them throughout my
project instead?
Thanks for any feedback,
Thierry.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do I sort a ManyToManyField in Django admin?

2009-08-10 Thread Thierry

I currently have the following models:

class Image(models.Model):
alt_name = models.CharField(max_length=200)

def __unicode__(self):
return self.alt_name

class Album(models.Model):
images = models.ManyToManyField(Image, blank=True)

class AlbumAdmin(admin.ModelAdmin):
model = Album
filter_horizontal = ('images',)

admin.site.register(Album, AlbumAdmin)

The above work fine in the admin where I can see a list of images.
However, I want to sort this list by the Image.alt_name. How do I do
that?

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



Re: Django documentation site is SLOW

2009-08-08 Thread Thierry

Hi,

Just wanted to add my own testimony: I too, noticed serious
performance issues with Firefox when consulting Django documentation.
So far it is the only website where I experience this.
I am home, using Firefox 3.5.2 on Ubuntu 9.04 (officially installed
package 'firefox-3.5'), and have Adblock too.

As far as I remember, I did not notice any performance hog when
browsing Django documentation from work (Windows XP, Firefox 3.5.2,
Adblock activated too).
Just tried at home with Epiphany browser, and still no lack of
responsiveness from Django website.

So I guess the culprit would be the current Firefox 3.5.x package from
Ubuntu's universe repos?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model field option "max_length" is not respected (Sqlite backend)?

2009-08-07 Thread Thierry

Indeed, I had been confused by this documentation excerpt ([1]):
"CharField.max_length: The maximum length (in characters) of the
field. The max_length is enforced at the database level and in
Django's validation."

Now your clear and quick explanation makes sense.
Fortunately most of my data is validated through forms, so I only have
to be cautious about my own manipulations of models.

Thanks a lot.

[1]: http://docs.djangoproject.com/en/dev/ref/models/fields/#charfield
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model field option "max_length" is not respected (Sqlite backend)?

2009-08-07 Thread Thierry

Hi,

I have a model roughly defined as such (FK fields do not appear for
simplicity):

class FieldChange(models.Model):
old_value = models.CharField(max_length=50)
new_value = models.CharField(max_length=50)

Using SQLite, the table definition roughly translates to:

CREATE TABLE "fieldchange" (
"id" integer NOT NULL PRIMARY KEY,
"old_value" varchar(50) NOT NULL,
"new_value" varchar(50) NOT NULL,
)

However, it seems that the "max_length" condition is not respected,
neither at Django level (when saving) nor at database level:
For instance, I managed to create a model instance with fields longer
than 50 characters and save it.
Worse, I managed to retrieve that instance with fields unchanged, i.e
their size still exceeding 50 characters (in a separate "django shell"
session).

I expected the operation to fail at validation or DB backend level, or
at least that the fields would be truncated to comply with condition
"max_length=50". Is there some kind of bad magic here? Or only related
to SQLite?

Now what had me spot the error is that I wanted to manually truncate
'old_value' and 'new_value' fields when data exceeds the 50 characters
limit (adding trailing '...' characters when necessary). Where is the
best location to do that? The model 'save()' method, I suppose?

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



Improve the django-contrib webdesign helpers ... for developers?

2009-07-09 Thread Thierry

Hi,

The "webdesign" django.contrib add-on [1] currently implements only 1
templatetag, supposed to help web designers. I think Django could
benefit from built-in elements that could be useful to web developpers
too, out of the box.

Some disorganized ideas that lead me to write this message:
* When developping, I always include code in my base template to
display the list of queries executed during the request ('sql_queries'
populated by the Debug context processor [2]). I'd love to simply have
a middleware appending that list (as a table) automatically to my HTML
response during development phase.
* Profiling. I have never done any yet, for the reason I do not know
how to hook profiling in Django (Google might help I confess). Again,
would it be feasible to have profiling available from a Django-contrib
app? Well, maybe profiling is not that important for regular
development, I do not know.
* A recurrent question that comes to mind when developing complex
pages: what are the objects available to me in a template (and what
are their attributes)? Some PHP frameworks have simple methods to
display all the variables passed to their templates ('views' in their
true MVC terminology) [3]. At some point during my development
process, I'd love to have a simple templatetag exposing the list of
variables available in my template, and their attributes (in the way
of the debug page that is fired up when something goes wrong and which
provides valuable debug/traceback data).
* Knowing the time it takes to render a page requested (e.g 'Page
loaded in 0.053s'). I remember someone suggesting a middleware for
that on the mailing list. Probably not the best measurement, I agree.

What do you think?
Do you have repetitive template code blocks that you add at the start
of a project to help you during development phase? Would it be useful
(and in line with the framework's philosophy) to ship them with core
Django (as contrib) and advocate them in the documentation?

Note: I link my thought to the webdesign contrib app, but it could as
well be shipped (and documented) as a separate "webdev" contrib app.

[1] 
http://docs.djangoproject.com/en/dev/ref/contrib/webdesign/#ref-contrib-webdesign
[2] 
http://docs.djangoproject.com/en/dev/ref/templates/api/?#django-core-context-processors-debug
[3] http://book.cakephp.org/view/458/Basic-Debugging

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



Will future Django releases support multiple databases?

2009-06-25 Thread Thierry

Right now, Django doesn't seem to support the multiple databases on
the same server or different servers.  Will that feature be available
out of the box for future releases?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing Django on Windows XP

2009-05-29 Thread Thierry

Try to unpack django from a directory with no white space in the name,
for instance:

C:\downloads\Django-1.0.2-final

Make sure that you use a suitable unzip package.  There is an issue
with some version of winzip where empty __init__.py files are not
extracted.

On May 29, 12:54 pm, athick2  wrote:
> I am trying to install Django on Windows XP.
>
> I have python in C:\Python25
>
> I have extracted django into C:\Program Files\Google\google_appengine
> \izonyu\Django-1.0.2-final
>
> when i try to install django, i run into problems
>
> Goto C:\Program Files\Google\google_appengine\izonyu\Django-1.0.2-
> final from Cmd Prompt
>
> python setup.py install.
>
> when i execute the above command i get
>
> running install
> running build
> running build_py
> copying django\bin\ filename.py - > build\lib\django\bin
> error: path\filename.py: Access denied.
>
> Is there any direction you can provide me on this ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MultiValueField with required=True problem

2009-05-18 Thread Thierry
Isn't required the default behaviour of Field:

http://docs.djangoproject.com/en/dev/ref/forms/fields/

From the above code, TextInput is required:

forms.TextInput(),


On May 18, 1:15 pm, "[CPR]-AL.exe"  wrote:
> class CheckboxSelectWithTextInputWidget(forms.MultiWidget):
>
>     def __init__(self,choices, attrs=None):
>
>         widgets = (
>             forms.CheckboxSelectMultiple(choices = choices),
>             forms.TextInput(),
>         )
>         super(CheckboxSelectWithTextInputWidget,self).__init__
> (widgets,attrs)
>
>     def decompress(self,value):
>         print "widget value in decompress for checkbox-with-textinput:
> %s" % str(value)
>         if value:
>             return value.split(',')
>         return [None,None]
>
>     def format_output(self, rendered_widgets):
>
>         rendered_widgets[0] = u"выберите: " + rendered_widgets[0]
>         rendered_widgets[1] = u"и (или) впишите свои значения через
> запятую: " + rendered_widgets[1]
>
>         return u''.join(rendered_widgets)
>
> class CheckboxSelectWithTextInput(forms.MultiValueField):
>
>     widget = CheckboxSelectWithTextInputWidget
>
>     def __init__(self, choices, *args, **kwargs):
>         print 'CheckboxSelectWithTextInput initialised'
>         self.choices = choices
>
>         widgets = CheckboxSelectWithTextInputWidget(choices)
>         fields=(forms.MultipleChoiceField(choices = self.choices,
> label = u"выберите", required = False), forms.CharField(label =
> u"впишите свои значения", required = False))
>         super(CheckboxSelectWithTextInput, self).__init__(fields,
> widget=widgets, *args, **kwargs)
>
>     def compress(self, data_list):
>         print "data list for from-to-range: %s" % data_list
>         try:
>             result = data_list[0]       #добавим в вывод значения из
> чекбоксов
>
>             #заберем из поля ввода и разделим запятыми введенные
> дополнительные варианты:
>             additional_result = data_list[1].split(",")
>
>             #порежем лишние пробелы и пустые значения и добавим к
> результирующему массиву элементы из текстового поля:
>             for word in additional_result:
>                 if word.strip():
>                     result.append(word.strip())
>
>         except IndexError:
>             result = u""
>
>         return result
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to save the data from a form to my db.

2009-05-18 Thread Thierry

Check this example, but they are using a customized form for models:

http://www.djangobook.com/en/2.0/chapter14/#cn176

If your form is not derived from your model, you'll want to explicitly
create the model object:

def yourview(request):
if request.method == 'POST':
form = YourForm(request.POST)

if form.is_valid():
cd = form.cleaned_data

# assuming your html widgets have the same name as the
fields in your model and your pk increments automatically
your_model = YourModel(cr=cd['cr'], description=cd
['description'], file=cd['file'])

# the following line will save the data to the db
your_model.save()


On May 18, 6:08 pm, jon michaels  wrote:
> Hi all,
>
> I have the a from with the following validated data posted to itself
> (copied from the POST section on the error page):
>
> cr    u'008'
> description   u'asdfs'
> file   u'suus'
>
> I am trying to save it to the database. The variable names are the
> same as the column names in the database. How can i go about this? I
> tried various things with .save(), but that didn't work yet.
> I also tried doing it using cursor.execute (with only one value for a
> start) but that resulted in the error ''unicode' object has no
> attribute 'items''. I used this statement:
>
> cursor.execute("insert cr into editor.conffile values('%s')", cd['cr'])
>
> The following failed with "global name 'cr' is not defined"
> cursor.execute("insert cr into editor.conffile values('%s')", cr)
>
> Thanks in advance for your help!
>
> Jon.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



What's the recommended way to use ForeignKey?

2009-05-17 Thread Thierry

In the Django doc at 
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey,
it mentions explicitly specifying the application label in 1.0:

class Car(models.Model):
manufacturer = models.ForeignKey('production.Manufacturer')

The above is using a string for the ForeignKey, is that the preferred
way over explicitly specifying Manufacturer, like the following:

# assuming class Manufacturer is in the same file as class Car
class Car(models.Model):
manufacturer = models.ForeignKey(Manufacturer)

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



How do I override __unicode__ for User?

2009-05-17 Thread Thierry

I currently have a blog model:

class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
author = models.ForeignKey(User)
timestamp = models.DateTimeField()

Right now, author is returning the default User.username.  I have
other models who has a ForeignKey to User, I want them to keep
defaulting to username while for Blogpost, I want it to return
"first_name last_name".  How can I customize the above so that author
returns me "first_name last_name" if they are present?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do I override the __unicode__ of User?

2009-05-17 Thread Thierry

I currently have a blog model:

class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
author = models.ForeignKey(User)
timestamp = models.DateTimeField()

Right now, author is returning the default User.username.  How can I
customize the above so that author returns me "first_name last_name"
if they are present?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Form errors manipulation - autofill values in case of error

2009-05-13 Thread Thierry

I was able to get the user input back if there are errors but I have a
customized form class which extends the UserCreationForm.  I was
following the example at:

http://www.djangobook.com/en/2.0/chapter14/#cn176

You will notice that if the user inputs are not valid, the view re-
initialize the form object to:

form = UserCreationForm(request.POST)

The above is sent back to the template.  My template looks like the
following and it carries over the user inputs:

Username:
{{ form.username }}

The form documentation is http://docs.djangoproject.com/en/dev/topics/forms/
I am not sure if you have a customized form class yet but that's how I
would have done it for validation of many input fields.

On May 13, 7:47 am, Miguel  wrote:
> the problem I have is that the fields are dynamic so I can not do any model
> from a form django object...
>
> Miguel
> Sent from Madrid, Spain
>
> On Wed, May 13, 2009 at 1:27 PM, Miguel  wrote:
> > ignorance, I guess. Django is a really huge framework and I am new using
> > it.:-s
>
> > Where can I find documentation about how python handle this?
>
> > Miguel
> > Sent from Madrid, Spain
>
> > On Wed, May 13, 2009 at 1:24 PM, Daniel Roseman <
> > roseman.dan...@googlemail.com> wrote:
>
> >> On May 13, 11:59 am, Miguel  wrote:
> >> > I want to generate the following info in my html:
>
> >> >  >>  value='dynamic
> >> > value' >
>
> >> > To do that I proccess the info as follows:
>
> >> >                                         Peso (kg)
> >> >                                         {% ifequal fila.__str__
> >> > metodo.get_unidad_series %}
> >> >                                             {% for serie in
> >> > metodo.get_rango_series_mod_10 %}
> >> >                                                 
>
> >> >                                                      >> > class='celda_activa'
> >> > name='peso_{{embebido.id}}_{{ciclo}}_{{fila|get_numero_serie:serie}}'
>
> >> >                                                     {% for evaluacion in
> >> > embebido.get_evaluaciones %}
> >> >                                                         {% ifequal
> >> > serie.__str__ evaluacion.serie.__str__ %}
> >> >                                                             {% ifequal
> >> > ciclo.__str__ evaluacion.ciclo.__str__ %}
>
> >> > value="{{evaluacion.peso}}"
> >> >                                                             {%
> >> endifequal %}
> >> >                                                         {% endifequal%}
> >> >                                                     {% endfor %}
> >> >                                                     {% ifequal accion
> >> "ver"
> >> > %} readonly='readonly'{% endifequal %}
>
> >> >                                                 
> >> >                                             {% endfor %}
>
> >> > when errors occur, the users is sent to the same page but, I want to
> >> fill
> >> > the values the user has already filled. I have these variables names and
> >> > values in the context but how can I replace them if the html inputs are
> >> > dynamic names?
>
> >> > could anybody help me with these? I am a little lost.
>
> >> > Thank you in advance,
>
> >> > Miguel
> >> > Sent from Madrid, Spain
>
> >> As I said on the original thread, the Django forms framework handles
> >> this for you automatically. Is there a reason why you have chosen not
> >> to use it?
> >> --
> >> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Does the objects.get method automatically escape single quote?

2009-05-13 Thread Thierry

Thanks for the tip on the raw sql, I'll read the faq in more details.

On May 13, 5:53 am, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On May 13, 2:25 am, Thierry <lamthie...@gmail.com> wrote:
>
> > My table has the following entry:
>
> > id      name
> > 1       foo's
>
> > I'm currently trying the following:
>
> > value = "foo's"
>
> > MyModel.objects.get(name = value)
>
> > The above is raising the exception DoesNotExist.  Doesn't the get
> > function automatically escape the single quote?  Is there also a way
> > to output the generated SQL of the above method?
>
> No, there's no 'escaping' for database lookups. Are you sure the
> element actually exists in the DB?
>
> You can see the code (as long as DEBUG=True) by doing:
> from django.db import connection
> connection.queries
> This is a FAQ, by the way.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Does the objects.get method automatically escape single quote?

2009-05-12 Thread Thierry

My table has the following entry:

id  name
1   foo's

I'm currently trying the following:

value = "foo's"

MyModel.objects.get(name = value)

The above is raising the exception DoesNotExist.  Doesn't the get
function automatically escape the single quote?  Is there also a way
to output the generated SQL of the above method?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do you handle apostrophe and spaces in dynamic url?

2009-05-12 Thread Thierry

I have a table with the following names:

id  name
1   Foo
2   Foo goo
3   Foo's goo

I want to use the name to construct my url.  I don't have a problem
constructing Foo:

localhost/foo

But how am I supposed to handle "Foo goo" and "Foo's goo"?  Will I
need to create a 3rd column just to hold the url like the following:

id  name   url
1   Foo foo
2   Foo goo   foo-goo
3   Foo's goo foos-goo

I will also need that url to retrieve information on that entry from
the table.  Can someone with a lot of experience in web dev confirm
that the above is the best way to handle this situation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How do I handle urls with different names?

2009-05-12 Thread Thierry

I really like the idea of how to create those urls.  Once I have
extracted the name and type from the url, do I retrieve my Pet object
like the following:

current_pet = Pet.objects.get(name__iexact=name, type__iexact=type)

If my table has 1000s of pets, isn't the above a bit slow when
compared to the retrieving a pet by id?  How is this kind of situation
handle in some of the Django web application out there?

On May 11, 11:00 pm, Mike Ramirez <gufym...@gmail.com> wrote:
> On Monday 11 May 2009 07:35:37 pm Alex Gaynor wrote:
>
>
>
> > On Mon, May 11, 2009 at 10:22 PM, Thierry <lamthie...@gmail.com> wrote:
> > > Let's say I have a pet table:
>
> > > TABLE: Pet
> > > id     name        type
> > > --
> > > 1      Pluto        dog
> > > 2      Foo          cat
> > > 3      Goo          fish
>
> > > I can access the pet page of each of the above by the following url:
>
> > > Pluto: localhost/pets/1/
> > > Foo:   localhost/pets/2/
> > > Goo:  localhost/pets/3/
>
> > > I want the url for the pet page to look like the following:
>
> > > Pluto: localhost/pets/pluto-dog/
> > > Foo:   localhost/pets/foo-cat/
> > > Goo:  localhost/pets/goo-fish/
>
> > > In a PHP web application that I have been working on before, there is
> > > an additional field in the Pet table which holds the url for each
> > > pet.  Is that how it should be done in Django too?
>
> > Since the urls just contain 2 fields that are both on the model I'd just
> > hook up the view at
>
> > r'^(?P\w+)-(?P\w+)/$'
>
> After adding this to my patterns in urls.py
>
> url(r'^(?P\w+)-(?P\w+)/$', 'myproj.myview.myfun',
> name="pet_detail"),
>
> Then I would use the permalink decorator  by adding get_absolute_url() to your
> model for the pets.  
>
> http://docs.djangoproject.com/en/dev/ref/models/instances/#get-absolu...http://docs.djangoproject.com/en/dev/ref/models/instances/#the-permal...
>
> @models.permalink
> def get_absolute_url(self):
>         return ('pet_detail', (), {'type': self.type, 'name':self.name})
>
> Then when using the model, I can do something like:
>
> pet = Pets.object.get(pk=1)
>
> pet.get_absolute_url()
>
> or in a template {{ pet.get_absolute_url }}  
>
> To retrieve the url for the corresponding row.
>
> use the string method lower() to make the type and name lower case.  i.e.
> self.type.lower(), self.name.lower() in get_absolute_url.
>
> > and then in the view you can filter by type and name individually.
> > Alex
>
> Mike
>
> --
> "I say we take off; nuke the site from orbit.  It's the only way to be sure."
> - Corporal Hicks, in "Aliens"
>
>  signature.asc
> < 1KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do I handle urls with different names?

2009-05-11 Thread Thierry

Let's say I have a pet table:

TABLE: Pet
id nametype
--
1  Plutodog
2  Foo  cat
3  Goo  fish

I can access the pet page of each of the above by the following url:

Pluto: localhost/pets/1/
Foo:   localhost/pets/2/
Goo:  localhost/pets/3/

I want the url for the pet page to look like the following:

Pluto: localhost/pets/pluto-dog/
Foo:   localhost/pets/foo-cat/
Goo:  localhost/pets/goo-fish/

In a PHP web application that I have been working on before, there is
an additional field in the Pet table which holds the url for each
pet.  Is that how it should be done in Django too?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding save method in model

2009-05-06 Thread Thierry

I don't exactly want to save the full path of the image in the
database, just the image extension.  I am trying to convert the
current implementation of a PHP web page to Django.  Here's how the
table looks like, I'll be more explicit with the img ext this time:

idname  img_ext
-
1Pluto   jpg
2Scooby   gif

I know in advance that all my pet images will be stored at the
location /usr/django/images/.  So, I can locate the Pluto image with
its unique id.
Pluto: /usr/django/images/1.jpg
Scooby: /usr/django/images/2.gif

I was thinking the best way to do the above is by overriding the save
method.  What I have in mind is:
- Upload the image using ImageField
- Update the column img_ext to the image extension of the above image

The original image upload mechanism might look strange to some but
that's how it is and I am just doing a simple conversion to Django.

On May 6, 2:59 am, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On May 5, 10:15 pm, Thierry <lamthie...@gmail.com> wrote:
>
> > How can I set picture to the image extension?  I don't think
> > "instance.picture = ext" works:
>
> >  def pet_picture_upload(instance, filename):
> >      name, ext = os.path.splitext(filename)
> >      instance.picture = ext
> >      return '/usr/django/images/%s%s' % (instance.pk, ext)
>
> I don't understand what you mean. The value stored in the database for
> 'picture' is the return value of the pet_picture_upload function,
> which is where the picture is stored. It doesn't make sense to set
> 'picture' to just the extension, since there will be no way for Django
> to identify the actual image file. The original code I gave sets
> 'picture' to the value of /usr/django/images/.ext, which appears
> to be what you want.
>
> If you really want to store the extension separately, you can do that
> - probably also in the pet_picture_upload function, by having a
> separate field for 'ext' and assigning it there, but I don't see why
> you would want to.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding save method in model

2009-05-05 Thread Thierry

How can I set picture to the image extension?  I don't think
"instance.picture = ext" works:

 def pet_picture_upload(instance, filename):
 name, ext = os.path.splitext(filename)
 instance.picture = ext
 return '/usr/django/images/%s%s' % (instance.pk, ext)

On May 5, 3:48 pm, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On May 5, 8:00 pm, Thierry <lamthie...@gmail.com> wrote:
>
>
>
> > I have the following model:
>
> > class Pet(models.Model):
> >     name = models.CharField(max_length=64)
> >     picture = models.ImageField(upload_to='/usr/django/images/')
>
> >     def save(self, force_insert=False, force_update=False):
> >         // override the picture values
> >         super(Pet, self).save(force_insert, force_update) # Call the
> > "real" save() method.
>
> > I want to achieve the following:
> > - Any uploaded pet image will have the following name on the file
> > system ., for example
> >     /usr/django/images/1.jpg, /usr/django/images/2.gif
> > - How can can I retrieve the image extension, override the save method
> > and store it in the column picture?
>
> > The Pet table will look something like:
> > id       name            picture
> > 1        Pluto             jpg
> > 2        Scooby         gif
>
> > All the above is done on the admin side.
>
> Don't do this in the save method. Instead, define a custom upload
> handler for the picture element.
>
> import os.path
>
> def pet_picture_upload(instance, filename):
>     name, ext = os.path.splitext(filename)
>     return '/usr/django/images/%s%s' % (instance.pk, ext)
>
> class Pet(models.Model):
>     name = models.CharField(max_length=64)
>     picture = models.ImageField(upload_to=pet_picture_upload)
>
> See the documentation for FileField, 
> here:http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Overriding save method in model

2009-05-05 Thread Thierry

I have the following model:

class Pet(models.Model):
name = models.CharField(max_length=64)
picture = models.ImageField(upload_to='/usr/django/images/')

def save(self, force_insert=False, force_update=False):
// override the picture values
super(Pet, self).save(force_insert, force_update) # Call the
"real" save() method.

I want to achieve the following:
- Any uploaded pet image will have the following name on the file
system ., for example
/usr/django/images/1.jpg, /usr/django/images/2.gif
- How can can I retrieve the image extension, override the save method
and store it in the column picture?

The Pet table will look something like:
id   namepicture
1Pluto jpg
2Scooby gif

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



How do I set a foreign key as a primary key?

2009-05-03 Thread Thierry

I have the following model:

class Person(models.Model):
person = models.ForeignKey(User)
age = models.IntegerField()

How can I set the above foreign key to be my primary key so that my
Person table only contains two columns (person, age)?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



urlconf {{ app }}/{{ view }}

2009-04-24 Thread Thierry

what if u want to have an urlconf as such
/{{ app }}/{{ view }}/

so without specifying the view, it will dynamically load the app with
the variable input and the view...?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do I exclude a list from my search?

2009-04-17 Thread Thierry

Can someone tell me the equivalent QuerySet for the following sql:

select city_name
from city
where city_name not in ('Toronto', 'Richmond', 'Montreal')

>From the python code, I will like to store the above 3 cities in a
list.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Query exclude in and selective sort questions

2009-04-16 Thread Thierry

Let's say I have a list of words in my database:

['bbb', 'aaa', 'zzz', 'ddd']

How can I retrieve a list of the above excluding the following words
['aaa', 'zzz'] by using __in?  I can do the above with:

   words_list = Words.objects.exclude(
Q(word_name = 'aaa') | Q(word_name = 'zzz')
)

The following type of syntax doesn't seem to work with exclude but
works with filter:

exclude_list = ['aaa', 'zzz']
country _list = Countries.objects.exclude(word_name__in =
exclude_list)

The other operation I want to do is to construct a list where I hand
pick two items and place it at the beginning of a list while the rest
is sorted.  For example, if I want 'zzz' and 'ddd' to be at the
beginning of the list while the rest is sorted, my desired output will
look like:

   ['zzz', 'ddd', 'aaa', 'bbb']

I could do the above in 2 steps but I end up with two QuerySet objects
which I cannot join together.  Any help on the above?


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



Re: Target WSGI script cannot be loaded as Python module

2009-04-14 Thread Thierry

Hello world with import socket gave me the same issue.  I just re-
installed Python 2.6, more specifically 2.6.2 and everything is
working fine, thanks for your help.

On Apr 14, 10:25 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Apr 15, 12:07 pm, Thierry <lamthie...@gmail.com> wrote:
>
>
>
> > I'm currently running Apache 2.2 on Windows and I can get the hello
> > world of modwsgi to run.  However, when I configure my Django project,
> > Apache has the following errors from the error.log file:
>
> > mod_wsgi (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
> > mysite.wsgi' cannot be loaded as Python module.
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
> > mysite/apache/mysite.wsgi'.
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:/
> > django_proj/mysite/apache/mysite.wsgi", line 7, in 
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     import
> > django.core.handlers.wsgi
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> > 8, in 
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     from django
> > import http
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
> > 
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     from urllib
> > import urlencode
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\urllib.py", line 26, in 
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     import
> > socket
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\socket.py", line 46, in 
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]     import
> > _socket
> > [Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] ImportError: DLL
> > load failed: The specified module could not be found.
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
> > mysite.wsgi' cannot be loaded as Python module.
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
> > mysite/apache/myite.wsgi'.
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:/
> > django_proj/mysite/apache/mysite.wsgi", line 7, in 
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     import
> > django.core.handlers.wsgi
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> > 8, in 
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     from django
> > import http
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
> > 
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     from urllib
> > import urlencode
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\urllib.py", line 26, in 
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     import
> > socket
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\socket.py", line 46, in 
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]     import
> > _socket
> > [Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] ImportError: DLL
> > load failed: The specified module could not be found.
>
> > My 'C:/django_proj/mysite/apache/mysite.wsgi' is the following:
> > import os, sys
> > sys.path.append('C:/django_proj')
> > sys.path.append('C:/django_proj/mysite')
>
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > The apache conf is:
> > Alias /media/ "C:/django_proj/mysite/media/"
>
> > 
> >     Order allow,deny
> >     Options Indexes
> >     Allow from all
> >     IndexOptions FancyIndex

Target WSGI script cannot be loaded as Python module

2009-04-14 Thread Thierry

I'm currently running Apache 2.2 on Windows and I can get the hello
world of modwsgi to run.  However, when I configure my Django project,
Apache has the following errors from the error.log file:

mod_wsgi (pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
mysite.wsgi' cannot be loaded as Python module.
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
mysite/apache/mysite.wsgi'.
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:/
django_proj/mysite/apache/mysite.wsgi", line 7, in 
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] import
django.core.handlers.wsgi
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
8, in 
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] from django
import http
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in

[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] from urllib
import urlencode
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\urllib.py", line 26, in 
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] import
socket
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\socket.py", line 46, in 
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] import
_socket
[Tue Apr 14 21:59:21 2009] [error] [client 127.0.0.1] ImportError: DLL
load failed: The specified module could not be found.
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=5956): Target WSGI script 'C:/django_proj/mysite/apache/
mysite.wsgi' cannot be loaded as Python module.
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=5956): Exception occurred processing WSGI script 'C:/django_proj/
mysite/apache/myite.wsgi'.
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:/
django_proj/mysite/apache/mysite.wsgi", line 7, in 
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] import
django.core.handlers.wsgi
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
8, in 
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] from django
import http
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in

[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] from urllib
import urlencode
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\urllib.py", line 26, in 
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] import
socket
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\socket.py", line 46, in 
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] import
_socket
[Tue Apr 14 21:59:24 2009] [error] [client 127.0.0.1] ImportError: DLL
load failed: The specified module could not be found.

My 'C:/django_proj/mysite/apache/mysite.wsgi' is the following:
import os, sys
sys.path.append('C:/django_proj')
sys.path.append('C:/django_proj/mysite')

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

The apache conf is:
Alias /media/ "C:/django_proj/mysite/media/"


Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing


WSGIScriptAlias /blah "C:/django_proj/mysite/apache/mysite.wsgi"


Order allow,deny
Allow from all


I'm trying to run the above locally by accessing: http://localhost/blah,
I get the 500 Internal Server Error.  Can anyone tell me what I'm
missing?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Clarifications for apps and models

2009-04-07 Thread Thierry

I'll be referring to the example in the Django documentation here.  I
will extend on the "books" application in the "mysite" project by
creating a new app called "music" so that the structure looks like the
following:

mysite/
books/
models.py - Contains Publisher, Author, Book
music/
models.py - Contains Artist, Album

Let's also assume that the Publisher model from books also publish
music.  How can I can refer to Publisher from music/models.py?   Is
there a place under mysite where I can have a common models.py used by
all my apps?  For example, is mysite/models.py a viable option?

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



template include and for loop speed

2009-03-06 Thread Thierry

the following use case

{% for item in items %}
 {% with item.score as score %}
  {% include rating_small %}
 {% endwith %}
{% endfor %}

Using an include tag is very slow compared to pasting the included
template here.
My total template processing time goes up from 0.1 to 0.4 seconds.
Why is an include tag so much heavier on the template system?

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



MultipleChoiceField initial data

2009-01-13 Thread Thierry

This doesn't seem to work:
auto_open_choices = forms.MultipleChoiceField(choices=( ('google',
'Google'), ('msn', 'MSN'), ('yahoo', 'Yahoo')), required=False,
initial=['google'])

>From what i read in the discussions here it should...
What am i doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order_with_respect_to fail any workaround ?

2008-12-23 Thread Thierry Stiegler

I answer django developpers (http://groups.google.com/group/django-
developers/t/280bca5001faca07) so wait and see.

On 6 déc, 09:34, Thierry Stiegler <thierry.stieg...@gmail.com> wrote:
> Hello,
>
> I got some errors by using the Meta optionsorder_with_respect_to:
> 
> class Category(PublicationBase, LocalisationBase):
>     ITEM_PER_PAGE = 12
>     name = models.CharField(max_length=255)
>     pictogram = models.ImageField(upload_to="categories", blank=True)
>     old_id = models.PositiveIntegerField(blank=True)
>     parent = models.ForeignKey("Category", blank=True, null=True)
>
>     class Meta:
>         ordering = ['name']
>        order_with_respect_to= 'parent'
>
>     def __unicode__(self):
>         return self.name
> 
>
> An I got this error :
> 
> Validating models...
> Unhandled exception in thread started by  0x010ABBF0>
> Traceback (most recent call last):
>   File "C:\Python25\django-trunk\django\core\management\commands
> \runserver.py", line 48, in inner_run
>     self.validate(display_num_errors=True)
>   File "C:\Python25\django-trunk\django\core\management\base.py", line
> 249, in validate
>     num_errors = get_validation_errors(s, app)
>   File "C:\Python25\django-trunk\django\core\management
> \validation.py", line 28, in get_validation_errors
>     for (app_name, error) in get_app_errors().items():
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 128, in get_app_errors
>     self._populate()
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 57, in _populate
>     self.load_app(app_name, True)
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 72, in load_app
>     mod = __import__(app_name, {}, {}, ['models'])
>   File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\messages
> \models.py", line 113, in 
>     notification = get_app('notification')
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 111, in get_app
>     self._populate()
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 57, in _populate
>     self.load_app(app_name, True)
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 72, in load_app
>     mod = __import__(app_name, {}, {}, ['models'])
>   File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\portail
> \models.py", line 50, in 
>     class Category(PublicationBase, LocalisationBase):
>   File "C:\Python25\django-trunk\django\db\models\base.py", line 153,
> in __new__
>     new_class._prepare()
>   File "C:\Python25\django-trunk\django\db\models\base.py", line 178,
> in _prepare
>     setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' %
> cls.__name__.lower(), curry(method_get_order, cls))
> AttributeError: 'str' object has no attribute 'get_category_order'
> 
>
> I found this ticket (http://code.djangoproject.com/ticket/2740), but I
> don"t want to patch django.AnyIdea for aworkaround?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order_with_respect_to fail any workaround ?

2008-12-06 Thread Thierry Stiegler

Juste for precision I use the trunk.

On Dec 6, 9:34 am, Thierry Stiegler <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I got some errors by using the Meta options order_with_respect_to:
> 
> class Category(PublicationBase, LocalisationBase):
>     ITEM_PER_PAGE = 12
>     name = models.CharField(max_length=255)
>     pictogram = models.ImageField(upload_to="categories", blank=True)
>     old_id = models.PositiveIntegerField(blank=True)
>     parent = models.ForeignKey("Category", blank=True, null=True)
>
>     class Meta:
>         ordering = ['name']
>         order_with_respect_to = 'parent'
>
>     def __unicode__(self):
>         return self.name
> 
>
> An I got this error :
> 
> Validating models...
> Unhandled exception in thread started by  0x010ABBF0>
> Traceback (most recent call last):
>   File "C:\Python25\django-trunk\django\core\management\commands
> \runserver.py", line 48, in inner_run
>     self.validate(display_num_errors=True)
>   File "C:\Python25\django-trunk\django\core\management\base.py", line
> 249, in validate
>     num_errors = get_validation_errors(s, app)
>   File "C:\Python25\django-trunk\django\core\management
> \validation.py", line 28, in get_validation_errors
>     for (app_name, error) in get_app_errors().items():
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 128, in get_app_errors
>     self._populate()
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 57, in _populate
>     self.load_app(app_name, True)
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 72, in load_app
>     mod = __import__(app_name, {}, {}, ['models'])
>   File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\messages
> \models.py", line 113, in 
>     notification = get_app('notification')
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 111, in get_app
>     self._populate()
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 57, in _populate
>     self.load_app(app_name, True)
>   File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 72, in load_app
>     mod = __import__(app_name, {}, {}, ['models'])
>   File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\portail
> \models.py", line 50, in 
>     class Category(PublicationBase, LocalisationBase):
>   File "C:\Python25\django-trunk\django\db\models\base.py", line 153,
> in __new__
>     new_class._prepare()
>   File "C:\Python25\django-trunk\django\db\models\base.py", line 178,
> in _prepare
>     setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' %
> cls.__name__.lower(), curry(method_get_order, cls))
> AttributeError: 'str' object has no attribute 'get_category_order'
> 
>
> I found this ticket (http://code.djangoproject.com/ticket/2740), but I
> don"t want to patch django. Any Idea for a workaround ?

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



order_with_respect_to fail any workaround ?

2008-12-06 Thread Thierry Stiegler

Hello,

I got some errors by using the Meta options order_with_respect_to:

class Category(PublicationBase, LocalisationBase):
ITEM_PER_PAGE = 12
name = models.CharField(max_length=255)
pictogram = models.ImageField(upload_to="categories", blank=True)
old_id = models.PositiveIntegerField(blank=True)
parent = models.ForeignKey("Category", blank=True, null=True)

class Meta:
ordering = ['name']
order_with_respect_to = 'parent'


def __unicode__(self):
return self.name


An I got this error :

Validating models...
Unhandled exception in thread started by 
Traceback (most recent call last):
  File "C:\Python25\django-trunk\django\core\management\commands
\runserver.py", line 48, in inner_run
self.validate(display_num_errors=True)
  File "C:\Python25\django-trunk\django\core\management\base.py", line
249, in validate
num_errors = get_validation_errors(s, app)
  File "C:\Python25\django-trunk\django\core\management
\validation.py", line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "C:\Python25\django-trunk\django\db\models\loading.py", line
128, in get_app_errors
self._populate()
  File "C:\Python25\django-trunk\django\db\models\loading.py", line
57, in _populate
self.load_app(app_name, True)
  File "C:\Python25\django-trunk\django\db\models\loading.py", line
72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
  File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\messages
\models.py", line 113, in 
notification = get_app('notification')
  File "C:\Python25\django-trunk\django\db\models\loading.py", line
111, in get_app
self._populate()
  File "C:\Python25\django-trunk\django\db\models\loading.py", line
57, in _populate
self.load_app(app_name, True)
  File "C:\Python25\django-trunk\django\db\models\loading.py", line
72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
  File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\portail
\models.py", line 50, in 
class Category(PublicationBase, LocalisationBase):
  File "C:\Python25\django-trunk\django\db\models\base.py", line 153,
in __new__
new_class._prepare()
  File "C:\Python25\django-trunk\django\db\models\base.py", line 178,
in _prepare
setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' %
cls.__name__.lower(), curry(method_get_order, cls))
AttributeError: 'str' object has no attribute 'get_category_order'


I found this ticket (http://code.djangoproject.com/ticket/2740), but I
don"t want to patch django. Any Idea for a workaround ?



--~--~-~--~~~---~--~~
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 & referential integrity

2008-12-05 Thread Thierry

I noticed that Django handles all the referential integrity issues for
delete statements at the Python/ORM level.
- Is this documented anywhere?

Furthermore I can't seem to find a switch to turn the whole ORM/python
level referential stuff off. Is there a setting for this somewhere? (I
prefer the database to handle it)

Also, there is no support for different actions upon a delete.
Basically like this ticket sais:
http://code.djangoproject.com/ticket/2288

I have a logging table with relations to my production tables. They
are relations but no action would be more appropriate. The only way to
do this seems to be a IntegerField, instead of a ForeignKey. Is there
any alternative.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



orm syntax

2008-06-26 Thread Thierry

Is this possible and or is there any way to simulate it?

objects.order_by('date').group_by('foreign_key').having('auto_done')
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



smart cache management

2008-06-17 Thread Thierry

Is there anything built into the cache system to manage the deletion/
invalidating of cache?
All the examples seem to be based on setting a 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
-~--~~~~--~~--~--~---



splitting up model definition, row level behaviour and table level behaviour

2008-06-15 Thread Thierry

Im looking to split the above mentioned in different files.
Is there any howto on this topic?
How have you implemented this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django admin - list edit in place

2008-06-15 Thread Thierry

Im a looking for an admin mode to allow the staff to edit multiple
items at once.
An edit in place for the standard list view would be great.
Or just a list of many forms would also do.
Before i start building, is there anything like this available?


Greetz,
Thierry
--~--~-~--~~~---~--~~
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 Patterns IE problem

2008-06-05 Thread Thierry Schork
I don't know if it's the correct way to deal with it, but adding a line ilke
that one:
('','djangoshots.root.index'),
into my urls.py allowed me to match an empty request to a specific
controller.
But, the drawback is that any invalid urls are matched by it too.
Oh, and it need to be the last one. Put it sooner in the urls list, and it
will match before the legitimate match.

On Thu, Jun 5, 2008 at 2:45 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Hallo Django Users,
>
> I'm experiencing some problems with the url pattern configuration for
> IE.
> When we wanted to put a django application into production one of our
> testers found a problem in IE which i couldn't found the answer to.
>
> My url patterns are the following
> (r'^$','services.serviceAuth.views.overview'),
> (r'^overview/$','services.serviceAuth.views.overview')
>
> when someone wants to enter the web application without specifying a
> path like
>
> http://bioinf-dev/
>
> it will give an error in IE. When i have debug mode on it just
> presents all the available urls saying that specific url doesn't
> exist. Is there something that i'm doing wrong here. I thought that
> the url pattern r'^$' should capture when someone doesn't specify a
> path.
>
> Can anyone help me with this problem.
>
> Any help is greatly appreciated.
>
> Regards,
>
> Richard Mendes
> >
>

--~--~-~--~~~---~--~~
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 change Apache port? do I need to?

2008-06-03 Thread Thierry Schork
The "it works" message is, I believe, the sandard default page.
Did you stopped/restarted apache after each modifications ?
Because of it's nature, I don't think you can send a reload signal to apache
on windows, so you need to stop/restart it after each modifications in the
config file.

The answer on the port 8000 though might indicate that you have the django
dev server running. If it's the case, stop it, as 2 programs cannot bind the
same port at the same time.
If you have the dev server running, apache will fail to start because the
port is already used.

On Mon, Jun 2, 2008 at 5:11 PM, <[EMAIL PROTECTED]> wrote:

>
> this is what i cant do:
> "Assuming there were no errors in any of the steps up to this point,
> you should now be able to browse to localhost/testproject and be
> greeted with this page:"
> Not Found
>
> The requested URL /testproject was not found on this server.
>
>
>
> i can however see that these works:
> http://localhost:8000/"it worked! ..."
> and
> http://localhost/"it works"
> >
>

--~--~-~--~~~---~--~~
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: psql to postgres, IA prompt, how to create database?

2008-06-02 Thread Thierry Schork

On Mon, 2008-06-02 at 10:15 -0700, [EMAIL PROTECTED] wrote:

> and how do i access or change password etc for this database later?
> is there a turorial somewhere?
> 

http://www.postgresql.org/docs/manuals/

http://www.postgresql.org/docs/8.0/interactive/sql-alteruser.html

>From that last page:

Change a user's password: 
ALTER USER davide WITH PASSWORD 'hu8jmn3';

Change the expiration date of the user's password: 
ALTER USER manuel VALID UNTIL 'Jan 31 2030';



--~--~-~--~~~---~--~~
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: psql to postgres, IA prompt, how to create database?

2008-06-02 Thread Thierry Schork
\h before any command gives you the help:

\h CREATE DATABASE 
Command: CREATE DATABASE
Description: create a new database
Syntax:
CREATE DATABASE name
[ [ WITH ] [ OWNER [=] dbowner ]
   [ TEMPLATE [=] template ]
   [ ENCODING [=] encoding ]
   [ TABLESPACE [=] tablespace ]
   [ CONNECTION LIMIT [=] connlimit ] ]

Or, from a shell, you can use createdatabase, createuser and
createlanguage to respectively create a new db, add a user to the
catalog, or add a language (pl/pgsq, pl/perl or even pl/python) to the
database

On Mon, 2008-06-02 at 09:25 -0700, [EMAIL PROTECTED] wrote:

> i started the psql to postgres interactive prompt and there supposedly
> is a command CREATE DATABASE but just writing that doesnt help.
> 
> i need to create a database.
> doing the django tutorial:
> http://www.djangoproject.com/documentation/tutorial01/
> 
> > 

--~--~-~--~~~---~--~~
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 change Apache port? do I need to?

2008-06-02 Thread Thierry Schork
Sorry, I'm a linux only user for the last 8 years.
Apache don't have official front-end as far as I know, so you have to check
with the package where your apache server came from.

On Mon, Jun 2, 2008 at 5:06 PM, <[EMAIL PROTECTED]> wrote:

>
> also, i have a problem with the apache GUI on windows. it doesnt allow
> me to stop or restart the server i have to do that from the command
> prompt.
> >
>

--~--~-~--~~~---~--~~
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 change Apache port? do I need to?

2008-06-02 Thread Thierry Schork
On Mon, Jun 2, 2008 at 5:03 PM, <[EMAIL PROTECTED]> wrote:

>
> so this:
> "Note that if you choose to run Apache on port 8000, it will conflict
> with the default port for the Django development/test server. Not
> cool. "
>
> is not a problem as it is?


No.
It would only be a problem if you launch the python built-in server AND the
apache server on the same computer at the same 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: How to change Apache port? do I need to?

2008-06-02 Thread Thierry Schork
put exactly what you want.
80 is the default HTTP port.
443 is the default HTTPS

8080 is often used for the proxy, but as long as it don't conflict with
another service on your server, you can put anything you want

On Mon, Jun 2, 2008 at 4:55 PM, <[EMAIL PROTECTED]> wrote:

>
> in httpf.conf :
>
> #Listen 12.34.56.78:80
> Listen 80
>
>
> #ServerName thedude-PC.Belkin:80
>
> what should i ahve here 80 or 00 or something else?
>
>
> >
>

--~--~-~--~~~---~--~~
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 file permission, wont let me edit file

2008-06-02 Thread Thierry Schork
You have to be the "root" user of the server to do that.
Use the "su" command (or "sudo bash" if sudo is intalled) into a terminal
and edit the file from the terminal.

You probably try to edit the file from a normal user account, which have
just a read permission to that file.

On Mon, Jun 2, 2008 at 2:16 PM, slix <[EMAIL PROTECTED]> wrote:

>
> i try to edit httpd.conf file by adding
> LoadModule python_module modules/mod_python.so
>
> but it wont let me. how do i change the file permissions to do this?
> also is there some security issues here i should consider?
> >
>

--~--~-~--~~~---~--~~
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: urls.py and adding an OR to the regexp

2008-05-28 Thread Thierry Schork
On Wed, May 28, 2008 at 3:06 PM, <[EMAIL PROTECTED]> wrote:

>
> Couldn't you also use something along the lines of
> ^price[s]/
>
> That way you are always matching at least price and will match the
> optional s on the end as well.
>
> Though I may have the syntax wrong.
>

Yes, it would be ok too in that case, because it's at the end of the word.
But if I want to check something like this:
^ex(?:a|e)mple

it would not work with your proposal.
I'm a French speaker, and the English and French syntax are close, and I
always find myself mixing them up...
Not that I will integrate an URL matching like that one, but for the sake of
the example (or is it exemple ?? I'm never sure...)

>
> On May 28, 3:15 am, "Thierry Schork" <[EMAIL PROTECTED]> wrote:
> > > > It's simply an OR done into the matching. Taking the simpliest, I
> > > > would like to implement this regexp:
> > > > ^pric(e|es)/
> > > > into urls.py, but the () are overlapping with the text capture, as it
> > > > seems.
> >
> > > If you want to use parentheses that don't capture use "?:" to flag it
> > > as non-grouping. So instead try:
> >
> > > ^pric(?:e|es)/
> >
> > Perfect !
> >
> > Thank you very much Matt.
> >
> > Regards.
> > Thierry.
> >
>

--~--~-~--~~~---~--~~
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: urls.py and adding an OR to the regexp

2008-05-28 Thread Thierry Schork
> > It's simply an OR done into the matching. Taking the simpliest, I
> > would like to implement this regexp:
> > ^pric(e|es)/
> > into urls.py, but the () are overlapping with the text capture, as it
> > seems.
>
> If you want to use parentheses that don't capture use "?:" to flag it
> as non-grouping. So instead try:
>
> ^pric(?:e|es)/


Perfect !

Thank you very much Matt.

Regards.
Thierry.

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



urls.py and adding an OR to the regexp

2008-05-28 Thread Thierry

Hello django users,

I'm new to django, and I was looking to implement a very simple url
scheme that I used for a PHP site.
It's simply an OR done into the matching. Taking the simpliest, I
would like to implement this regexp:
^pric(e|es)/
into urls.py, but the () are overlapping with the text capture, as it
seems.

I know that I still can go the dumb way
  ^price/
  ^prices/
but if I can avoid it, I would prefer.

Is there a way to get around this, or should I write one line per OR I
would like to match ?
Regards.

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



  1   2   >