Language code prefix in url
Hi all, I'm new to Django, and trying to port my old site to Django for practice purpose. Different from Django multilingual implementation by using cookie, I want to add lang code to every url, i.e: /en/my_app/something_here/1/2/3/4/ /de/my_app/something_here/1/2/3/4/ /fr/my_app/something_here/1/2/3/4/ The main reason I do this if for Google to index more pages from my site. I don't want Google to index just the English version (default language), but I think that what will happen if I use cookies. I hope this approcae can be integrated with pre-existing Django apps without much hassles. I currently in fond of flatpages :) Do anyone have any idea on how to do this? TIA. --Tirta --~--~-~--~~~---~--~~ 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: Language code prefix in url
Wow, this is exactly what I'm looking for. I'm gonna try this app soon. Thanks! --Tirta -Original Message- From: Malcolm Tredinnick Date: Mon, 22 Dec 2008 15:26:42 To: Subject: Re: Language code prefix in url On Sun, 2008-12-21 at 19:52 -0800, Tirta K. Untario wrote: > Hi all, I'm new to Django, and trying to port my old site to Django for > practice purpose. > > Different from Django multilingual implementation by using cookie, I want to > add lang code to every url, i.e: > > /en/my_app/something_here/1/2/3/4/ > /de/my_app/something_here/1/2/3/4/ > /fr/my_app/something_here/1/2/3/4/ > > The main reason I do this if for Google to index more pages from my site. I > don't want Google to index just the English version (default language), but I > think that what will happen if I use cookies. > > I hope this approcae can be integrated with pre-existing Django apps without > much hassles. I currently in fond of flatpages :) > > Do anyone have any idea on how to do this? TIA. Joost Cassee's localeurl project (http://code.google.com/p/django-localeurl/ ) is one approach to this problem that seems fairly well thought out. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Model with 2 foreignkey to User
Hi all, I'm developing a simple todo list. I use Django Auth for handling authentication. This is my models.py from django.contrib.auth.models import User class Item(models.Model): project = models.ForeignKey(Project) category= models.ForeignKey(Category) title = models.CharField(max_length=250, unique=True) priority= models.IntegerField(choices=PRIORITY_CHOICES, default=2) completed = models.BooleanField(default=False) created_at = models.DateTimeField(default=datetime.datetime.now) created_by = models.ForeignKey(User) assigned_to = models.ForeignKey(User) I have 2 fields from Item model that I want to relate with User model: 'created_by' and 'assigned_to'. This is the error message when I try to syncdb: Error: One or more models did not validate: todo.item: Accessor for field 'created_by' clashes with related field 'User.item_set'. Add a related_name argument to the definition for 'created_by'. todo.item: Accessor for field 'assigned_to' clashes with related field 'User.item_set'. Add a related_name argument to the definition for 'assigned_to'. If I use only 1 foreignkey, it works without error, i.e: created_by = models.ForeignKey(User) without assigned_to = models.ForeignKey(User) Can anyone help me to solve this problem? TIA. --Tirta --~--~-~--~~~---~--~~ 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 with 2 foreignkey to User
Understood, thanks Paul. I missed this section from documentation :) --Tirta -Original Message- From: Paul van der Linden Date: Wed, 24 Dec 2008 11:09:25 To: Subject: Re: Model with 2 foreignkey to User Hi, just do as the error is telling you. created_by = models.ForeignKey(User, related_name='createdBy') assigned_to = models.ForeignKey(User, related_name='assignedBy') or something like that. That works. Tirta K. Untario wrote: > Hi all, > > I'm developing a simple todo list. I use Django Auth for handling > authentication. This is my models.py > > from django.contrib.auth.models import User > class Item(models.Model): > project = models.ForeignKey(Project) > category= models.ForeignKey(Category) > title = models.CharField(max_length=250, unique=True) > priority= models.IntegerField(choices=PRIORITY_CHOICES, default=2) > completed = models.BooleanField(default=False) > created_at = models.DateTimeField(default=datetime.datetime.now) > created_by = models.ForeignKey(User) > assigned_to = models.ForeignKey(User) > > I have 2 fields from Item model that I want to relate with User model: > 'created_by' and 'assigned_to'. This is the error message when I try to > syncdb: > > Error: One or more models did not validate: > todo.item: Accessor for field 'created_by' clashes with related field > 'User.item_set'. Add a related_name argument to the definition for > 'created_by'. > todo.item: Accessor for field 'assigned_to' clashes with related field > 'User.item_set'. Add a related_name argument to the definition for > 'assigned_to'. > > If I use only 1 foreignkey, it works without error, i.e: created_by = > models.ForeignKey(User) without assigned_to = models.ForeignKey(User) > > Can anyone help me to solve this problem? TIA. > > --Tirta > > > > > --~--~-~--~~~---~--~~ 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 with 2 foreignkey to User
This is a continuation from my last question. created_by = models.ForeignKey(User) I want to automatically use current logged in user as value. Can I put the code inside def save(self) for this model? I can't find anything about getting current user value from model. Thanks in advance. --Tirta -Original Message- From: "Tirta K. Untario" Date: Wed, 24 Dec 2008 01:39:20 To: Subject: Model with 2 foreignkey to User Hi all, I'm developing a simple todo list. I use Django Auth for handling authentication. This is my models.py from django.contrib.auth.models import User class Item(models.Model): project = models.ForeignKey(Project) category= models.ForeignKey(Category) title = models.CharField(max_length=250, unique=True) priority= models.IntegerField(choices=PRIORITY_CHOICES, default=2) completed = models.BooleanField(default=False) created_at = models.DateTimeField(default=datetime.datetime.now) created_by = models.ForeignKey(User) assigned_to = models.ForeignKey(User) I have 2 fields from Item model that I want to relate with User model: 'created_by' and 'assigned_to'. This is the error message when I try to syncdb: Error: One or more models did not validate: todo.item: Accessor for field 'created_by' clashes with related field 'User.item_set'. Add a related_name argument to the definition for 'created_by'. todo.item: Accessor for field 'assigned_to' clashes with related field 'User.item_set'. Add a related_name argument to the definition for 'assigned_to'. If I use only 1 foreignkey, it works without error, i.e: created_by = models.ForeignKey(User) without assigned_to = models.ForeignKey(User) Can anyone help me to solve this problem? TIA. --Tirta --~--~-~--~~~---~--~~ 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 with 2 foreignkey to User
Very useful post, thank you :) --Tirta --- On Wed, 24/12/08, Matias Surdi wrote: > From: Matias Surdi > Subject: Re: Model with 2 foreignkey to User > To: django-users@googlegroups.com > Date: Wednesday, 24 December, 2008, 7:26 PM > Maybe this helps: > > http://www.b-list.org/weblog/2008/dec/24/admin/ > > > > Tirta K. Untario wrote: > > This is a continuation from my last question. > > > > created_by = models.ForeignKey(User) > > > > I want to automatically use current logged in user as > value. Can I put the code inside def save(self) for this > model? I can't find anything about getting current user > value from model. > > > > Thanks in advance. > > > > --Tirta > > -Original Message- > > From: "Tirta K. Untario" > > > > > Date: Wed, 24 Dec 2008 01:39:20 > > To: > > Subject: Model with 2 foreignkey to User > > > > > > > > Hi all, > > > > I'm developing a simple todo list. I use Django > Auth for handling authentication. This is my models.py > > > > from django.contrib.auth.models import User > > class Item(models.Model): > > project = models.ForeignKey(Project) > > category= models.ForeignKey(Category) > > title = models.CharField(max_length=250, > unique=True) > > priority= > models.IntegerField(choices=PRIORITY_CHOICES, default=2) > > completed = models.BooleanField(default=False) > > created_at = > models.DateTimeField(default=datetime.datetime.now) > > created_by = models.ForeignKey(User) > > assigned_to = models.ForeignKey(User) > > > > I have 2 fields from Item model that I want to relate > with User model: 'created_by' and > 'assigned_to'. This is the error message when I try > to syncdb: > > > > Error: One or more models did not validate: > > todo.item: Accessor for field 'created_by' > clashes with related field 'User.item_set'. Add a > related_name argument to the definition for > 'created_by'. > > todo.item: Accessor for field 'assigned_to' > clashes with related field 'User.item_set'. Add a > related_name argument to the definition for > 'assigned_to'. > > > > If I use only 1 foreignkey, it works without error, > i.e: created_by = models.ForeignKey(User) without > assigned_to = models.ForeignKey(User) > > > > Can anyone help me to solve this problem? TIA. > > > > --Tirta > > > > > > > > > > > > > > --~--~-~--~~~---~--~~ 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-like PHP framework?
I haven't found an MTV framework like Django on PHP and Django has a very unique concept behind it. But if you want and MVC framework like Rails or Pylons, I recommend you Kohana framework - http://www.kohanaphp.com. Originally based on CodeIgniter, it has evolved a lot, and I vote it as the best framework for PHP :D --Tirta -Original Message- From: HB Date: Mon, 5 Jan 2009 06:16:25 To: Django users Subject: Re: Django-like PHP framework? My PHP friend is really happy with CodeIgnite but I know nothing about it... On Jan 5, 4:11 pm, Peter Bailey wrote: > You might want to have a look at CakePHP. It follows the MCV pattern I > believe, although I have not looked closely because it is PHP not > Python. > > http://cakephp.org/ > > Peter > > On Jan 5, 8:31 am, "thi.l...@gmail.com" wrote: > > > Hi, > > > I have a hard time getting Django adopted as web framework in the > > office. > > Mostly because the boss paid for PHP-based trainings, and our current > > infrastructure leaves little room for mod_python/wsgi/fastcgi... > > > I was wondering if some fo you know about competitor PHP frameworks > > that "look like" Django, or at least try to reach that level of > > purity. > > > Thanks for any comment (and sorry about this unfair request :-P) --~--~-~--~~~---~--~~ 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: syncdb error
You don't have mysqldb module on your system. Install it by using this: 'easy_install MySQLdb' --Tirta -Original Message- From: joti chand Date: Sun, 18 Jan 2009 20:21:45 To: Subject: syncdb error hi all iam getting this error when i try to do syncdb please can anyone help c:\py_projects\mysite>python manage.py syncdb Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "C:\Python25\Lib\site-packages\django\core\management\__init__.py", line 340, in execute_manager utility.execute() File "C:\Python25\Lib\site-packages\django\core\management\__init__.py", line 295, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python25\Lib\site-packages\django\core\management\base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "C:\Python25\Lib\site-packages\django\core\management\base.py", line 221, in execute self.validate() File "C:\Python25\Lib\site-packages\django\core\management\base.py", line 249, in validate num_errors = get_validation_errors(s, app) File "C:\Python25\lib\site-packages\django\core\management\validation.py", lin e 22, in get_validation_errors from django.db import models, connection File "C:\Python25\lib\site-packages\django\db\__init__.py", line 16, in backend = __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {}, {}, ['']) File "C:\Python25\Lib\site-packages\django\db\backends\mysql\base.py", line 13 , in raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No mo dule named MySQLdb --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---