Re: Using a variable for a field name in a filter?

2010-05-16 Thread nvie
Wouldn't this work?

kwargs = { var_field: "found" }
Foo.objects.filter(**kwargs)

On May 14, 3:19 pm, derek  wrote:
> Given a model Foo, with a field bar:
> Foo.objects.filter(bar = "found")
> works just fine.
>
> But, in my case, different fields are needed at different times, so I
> would like to use:
> Foo.objects.filter(var_field = "found")
> where "var_field" is a variable which will be set to the name of a
> field (such as "bar").
>
> The above is incorrect - how do I accomplish this?
>
> 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 
> 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.



ValueError with multi-table inheritance in Django Admin

2010-05-16 Thread Jori
Hi,

I have a problem when using MIT in my models. I created two new
classes which inherit model Entry:

class Entry(models.Model):
LANGUAGE_CHOICES = settings.LANGUAGES

language = models.CharField(max_length=2,
verbose_name=_('Comment language'), choices=LANGUAGE_CHOICES)
user = models.ForeignKey(User)
country = models.ForeignKey(Country, null=True, blank=True)

created = models.DateTimeField(auto_now=True)

class Comment(Entry):
comment = models.CharField(max_length=2000, blank=True,
verbose_name=_('Comment in English'))

class Discount(Entry):
discount = models.CharField(max_length=2000, blank=True,
verbose_name=_('Comment in English'))
coupon = models.CharField(max_length=2000, blank=True,
verbose_name=_('Coupon code if needed'))

After adding these new models to admin via admin.site.register I'm
getting ValueError when trying to create a comment or a discount via
admin. Adding entries works fine thou.

Error msg:

ValueError at /admin/reviews/discount/add/
Cannot assign "''": "Discount.discount" must be a "Discount" instance.
Request Method: GET
Request URL:http://127.0.0.1:8000/admin/reviews/discount/add/
Exception Type: ValueError
Exception Value:
Cannot assign "''": "Discount.discount" must be a "Discount" instance.
Exception Location: /Library/Python/2.6/site-packages/django/db/models/
fields/related.py in __set__, line 211
Python Executable:  /usr/bin/python
Python Version: 2.6.1

I'm running Django 1.1 and South 0.7 with this. To me this seems like
a textbook example made using Django docs but I can't seem to get it
working.

-Jori

Ps. I tried to find a solution to this via StackOverflow but with no
luck. I'll post the solution there is someone knows what's wrong with
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.



One to One chat like Facebook?

2010-05-16 Thread Anand Agarwal
Hi All

Is there any chat application in django similar to facebook chat?


Regards
Anand
Got an Idea? BootStrap it Today!!

-- 
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: One to One chat like Facebook?

2010-05-16 Thread Dexter
I don't know, but I guess you could easily make your own.

Django and Comet would be a nice combination

Grtz, Dexter

On Sun, May 16, 2010 at 12:13 PM, Anand Agarwal  wrote:

> Hi All
>
> Is there any chat application in django similar to facebook chat?
>
>
> Regards
> Anand
> Got an Idea? BootStrap it Today!!
>
> --
> 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: ValueError with multi-table inheritance in Django Admin

2010-05-16 Thread Karen Tracey
On Sun, May 16, 2010 at 4:58 AM, Jori  wrote:

> Hi,
>
> I have a problem when using MIT in my models. I created two new
> classes which inherit model Entry:
>
>class Entry(models.Model):
>LANGUAGE_CHOICES = settings.LANGUAGES
>
>language = models.CharField(max_length=2,
> verbose_name=_('Comment language'), choices=LANGUAGE_CHOICES)
>user = models.ForeignKey(User)
>country = models.ForeignKey(Country, null=True, blank=True)
>
>created = models.DateTimeField(auto_now=True)
>
>class Comment(Entry):
>comment = models.CharField(max_length=2000, blank=True,
> verbose_name=_('Comment in English'))
> [remainder snipped]


The problem seems to be that you have named a field in your Comment model
with the same name, only lower case. Comment inherits from Entry, using
multi-table-inheritance. This adds a OneToOneField in Comment back to Entry,
which has a side-effect of adding a 'comment' attribute to Entry. This is
the attribute that lets you access the Comment associated with the Entry as
a result of the OneToOneField in Comment, and by default it is given the
name of the related model, all-lowercase.

The problem then occurs when the Comment model "inherits' all the
fields/attributes of Entry: the inherited 'comment' attribute from Entry is
apparently over-riding the specified comment field. That's probably a bug,
but it appears to have been there since 1.0. I have not done any research to
see if it's been reported.

As a workaround you can name your fields something other than the model name
all lowercased, or you can explicitly specify the OneToOneField in the child
models, specifying parent_link=True and something other than the model name
all lowercased for related_name.

Karen
-- 
http://tracey.org/kmt/

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



MOD_PYTHON ERROR

2010-05-16 Thread asraful
my httpd.conf  seetings as:



SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['C:/Python25/Lib/site-packages/django','C:/Program
Files/Apache2.2/htdocs/mysite','c:/Program Files/Apache Software
Foundation/Apache2.2/htdocs', '/django']"






I found error in browser like:


MOD_PYTHON ERROR

ProcessId:  3000
Interpreter:'asraful.brotecs.com'

ServerName: 'asraful.brotecs.com'
DocumentRoot:   'C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs'

URI:'/mysite/'
Location:   '/mysite/'
Directory:  None
Filename:   'C:/Program Files/Apache Software Foundation/Apache2.2/
htdocs/mysite/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1202, in _process_target
module = import_module(module_name, path=path)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
304, in import_module
return __import__(module_name, {}, {}, ['*'])

ImportError: No module named django.core.handlers.modpython



And how can i create settings.py file for my project.


Is any one there to help me on these.






-- 
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: ValueError with multi-table inheritance in Django Admin

2010-05-16 Thread Jori
Thanks a lot! It didn't cross my mind to check the "hidden" relations
as this was the first time for me with multi-table inheritance.

-Jori

On May 16, 2:26 pm, Karen Tracey  wrote:
> On Sun, May 16, 2010 at 4:58 AM, Jori  wrote:
>
> The problem seems to be that you have named a field in your Comment model
> with the same name, only lower case. Comment inherits from Entry, using
> multi-table-inheritance. This adds a OneToOneField in Comment back to Entry,
> which has a side-effect of adding a 'comment' attribute to Entry. This is
> the attribute that lets you access the Comment associated with the Entry as
> a result of the OneToOneField in Comment, and by default it is given the
> name of the related model, all-lowercase.
>
> The problem then occurs when the Comment model "inherits' all the
> fields/attributes of Entry: the inherited 'comment' attribute from Entry is
> apparently over-riding the specified comment field. That's probably a bug,
> but it appears to have been there since 1.0. I have not done any research to
> see if it's been reported.
>
> As a workaround you can name your fields something other than the model name
> all lowercased, or you can explicitly specify the OneToOneField in the child
> models, specifying parent_link=True and something other than the model name
> all lowercased for related_name.
>
> Karen
> --http://tracey.org/kmt/
>
> --
> 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.



Change Default Permissions

2010-05-16 Thread Thomas Neumeier

Hi,

i've got an app with one model. this model is filled with some data from
a fixture.
now i want to remove the add and delete permission for all present and
future users for this specific model. the change perm should stay.
how can i do this?

Thanks

PS: using django 1.1.1

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-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: One to One chat like Facebook?

2010-05-16 Thread Allen Machary
you can try looking-up on pinax apps.. and put it on ur project..
check out (might give you some light )
http://groups.google.com/group/pinax-users/browse_thread/thread/6ea6b0d5f79a69ac/ee84295138dc3e58?lnk=gst&q=wsgi#ee84295138dc3e58

Allen M.,

On 5/16/10, Dexter  wrote:
> I don't know, but I guess you could easily make your own.
>
> Django and Comet would be a nice combination
>
> Grtz, Dexter
>
> On Sun, May 16, 2010 at 12:13 PM, Anand Agarwal  wrote:
>
>> Hi All
>>
>> Is there any chat application in django similar to facebook chat?
>>
>>
>> Regards
>> Anand
>> Got an Idea? BootStrap it Today!!
>>
>> --
>> 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.
>
>

-- 
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 model save() and foreign key

2010-05-16 Thread Lukáš
Hey,

I would like to save a modified model, but I get Programming error -
language_id field is specified twice.

class ProductInfo(models.Model):
product_info_id = models.AutoField(primary_key=True)
language_id = models.IntegerField()
product_id = models.IntegerField()
description = models.TextField(blank=True)
status = models.IntegerField()
model = models.CharField(max_length=255, blank=True)
label = models.ForeignKey(Category_info, verbose_name =
'Category_info', db_column = 'language_id', to_field = 'node_id', null
= True)

I get this error because the foreign key uses as db_column
language_id. If I will delete it, my object will be saved properly.

I dont quite understand whats going on and since I have defined almost
all of my models this way, I fear its totally wrong or maybe I just
missunderstood it...

Any ideas?

Regards

-- 
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 a variable for a field name in a filter?

2010-05-16 Thread nvie
Try this:

kwargs = { var_field: "found" }
Foo.objects.filter(**kwargs)

On May 14, 3:19 pm, derek  wrote:
> Given a model Foo, with a field bar:
> Foo.objects.filter(bar = "found")
> works just fine.
>
> But, in my case, different fields are needed at different times, so I
> would like to use:
> Foo.objects.filter(var_field = "found")
> where "var_field" is a variable which will be set to the name of a
> field (such as "bar").
>
> The above is incorrect - how do I accomplish this?
>
> 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 
> 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.



Re: Django model save() and foreign key

2010-05-16 Thread Karen Tracey
On Sun, May 16, 2010 at 10:35 AM, Lukáš  wrote:

>
> I would like to save a modified model, but I get Programming error -
> language_id field is specified twice.
>
> class ProductInfo(models.Model):
>product_info_id = models.AutoField(primary_key=True)
>language_id = models.IntegerField()
>product_id = models.IntegerField()
>description = models.TextField(blank=True)
>status = models.IntegerField()
>model = models.CharField(max_length=255, blank=True)
>label = models.ForeignKey(Category_info, verbose_name =
> 'Category_info', db_column = 'language_id', to_field = 'node_id', null
> = True)
>
> I get this error because the foreign key uses as db_column
> language_id. If I will delete it, my object will be saved properly.
>
> I dont quite understand whats going on and since I have defined almost
> all of my models this way, I fear its totally wrong or maybe I just
> missunderstood it...
>
> Any ideas?
>

Since you have not specified db_column on the language_id field, the name of
the column for that field in the database table will be 'language_id'. But
then you also ask, by specifying 'language_id' as the db_column value for
the label field, for a 2nd column to have the exact same name. You can't
have two columns with the same name in a table, so you get an error.

Why are you specify db_column='language_id' for the label field? Why not
just let this field be given its default column name in the table?

Karen
-- 
http://tracey.org/kmt/

-- 
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: Django model save() and foreign key

2010-05-16 Thread Lukáš
"Why are you specify db_column='language_id' for the label field? Why
not
just let this field be given its default column name in the table?"

Isnt it the same thing? The only difference is, that django will add
"_id" to it now and in the end result is the same, I still get the
error.

If my model looks like this:

class ProductInfo(models.Model):
product_info_id = models.AutoField(primary_key=True)
language_id = models.IntegerField()
product_id = models.IntegerField()
description = models.TextField(blank=True)
status = models.IntegerField()
model = models.CharField(max_length=255, blank=True)

It will get saved properly. If I add the foreign key, with or without
db_column, I will get that naaasty error...

-- 
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: Django model save() and foreign key

2010-05-16 Thread Karen Tracey
On Sun, May 16, 2010 at 11:12 AM, Lukáš  wrote:

> "Why are you specify db_column='language_id' for the label field? Why
> not
> just let this field be given its default column name in the table?"
>
> Isnt it the same thing? The only difference is, that django will add
> "_id" to it now and in the end result is the same, I still get the
> error.
>
> If my model looks like this:
>
> class ProductInfo(models.Model):
>product_info_id = models.AutoField(primary_key=True)
>language_id = models.IntegerField()
>product_id = models.IntegerField()
>description = models.TextField(blank=True)
>status = models.IntegerField()
>model = models.CharField(max_length=255, blank=True)
>
> It will get saved properly. If I add the foreign key, with or without
> db_column, I will get that naaasty error...
>
>
I'm confused. The model you showed in your original post had a field named
language_id and a ForeignKey field named label. The default column name for
the field named label would be label_id, so it would not conflict with a
field named language_id. The only reason it conflicted was because
db_column='language_id' had been specified on it.

It sounds like you are talking about a model that looks something like this:

class P(models.Model):
language_id = models.IntegerField()
language = models.ForeignKey(SomeOtherModel)

In that case, yes, you would get duplicate column names because the default
name for the ForeignKey column would be 'language_id', which is already in
use. The fix for that would be to specify another name for one of the
columns, by specifying db_column on one or the other of the fields, and
choosing a value for it that is not already in use for one of the other
fields in the model.

Karen
-- 
http://tracey.org/kmt/

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



Server on diffferent machine

2010-05-16 Thread bax...@gretschpages.com
I know this is something stupid I'm missing, but I'm not getting it.

I'm trying to run my Django from one cloud instance and the DB from
another, to (hopefully) optimize each server for task and balance the
load a bit.

On the DB server, I have mysql installed and have a working database
running on the default port 3306. I do not have a domain assigned to
this server, only a raw IP.

On the django side, I'm not sure what my settings should be to connect
to it. So far, everything I've tried has resulted in
_mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host
'< THE IP >' (1)")

Settings.py looks like:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django',
'USER': '',
'PASSWORD': 'XXX',
'HOST': '< THE IP >',
'PORT': '3306',
}
}

What am I 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-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: Pluggable Q&A app?

2010-05-16 Thread bax...@gretschpages.com
Thanks. In the end I wrote my own. Wasn't that hard, actually. CNPROG
had the same problem the other ones I looked at: more of a site than a
pluggable app. That Django-Voices is definitely interesting, though.

-- 
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: I need help

2010-05-16 Thread Baurzhan Ismagulov
On Fri, May 14, 2010 at 10:51:09AM +0200, Hussain Deikna wrote:
>  2- user login and it will display special information to every to group of
> users
...
> I need help in part 2 which django application I have to use?

I'm not aware of a ready-to-use solution; however, implementing one is
not much effort, take a look at
http://docs.djangoproject.com/en/1.1/topics/auth/#topics-auth .

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

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

2010-05-16 Thread Daniel Hilton
On 16 May 2010 19:25, bax...@gretschpages.com  wrote:
> I know this is something stupid I'm missing, but I'm not getting it.
>
> I'm trying to run my Django from one cloud instance and the DB from
> another, to (hopefully) optimize each server for task and balance the
> load a bit.
>
> On the DB server, I have mysql installed and have a working database
> running on the default port 3306. I do not have a domain assigned to
> this server, only a raw IP.
>
> On the django side, I'm not sure what my settings should be to connect
> to it. So far, everything I've tried has resulted in
> _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host
> '< THE IP >' (1)")
>
> Settings.py looks like:
>
> DATABASES = {
>    'default': {
>        'ENGINE': 'django.db.backends.mysql',
>        'NAME': 'django',
>        'USER': '',
>        'PASSWORD': 'XXX',
>        'HOST': '< THE IP >',
>        'PORT': '3306',
>    }
> }
>
> What am I missing?


Can you ping the db machine from the webserver?
Can you access the db machine from the webserver using a mysql client
such as Navicat or such like?

My 2p is on the db machine not having the right port open or denying
non-local connections.

HTH
Dan



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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


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



conditional list_filter in django admin

2010-05-16 Thread bowlby
Is it possible to add a condition to a list_filter in the django
admin? In the the example below I'd like to see only those
organisations in the filter, that have a certain attribute checked
(the boolean 'participates_in_program').

class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'first_name', 'last_name',
'is_staff')
list_filter = ('is_staff', 'is_superuser', 'organisation')

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: Server on diffferent machine

2010-05-16 Thread CLIFFORD ILKAY

On 05/16/2010 02:25 PM, bax...@gretschpages.com wrote:

I know this is something stupid I'm missing, but I'm not getting it.

I'm trying to run my Django from one cloud instance and the DB from
another, to (hopefully) optimize each server for task and balance the
load a bit.

On the DB server, I have mysql installed and have a working database
running on the default port 3306. I do not have a domain assigned to
this server, only a raw IP.


Can you connect to the server using "python manage.py dbshell"? If not, 
and assuming you have the correct authentication credentials, then it's 
not a Django issue at all.


MySQL can be configured to listen only to sockets or to TCP/IP 
connections. To connect remotely, it must allow for TCP/IP connections 
and your firewall must allow connections to the port on which MySQL 
listens, which is typically 3306. I don't know if the connection is 
encrypted so your authentication credentials and data might be 
transported in the clear. PostgreSQL is much more flexible in terms of 
authentication. You can specify that any TCP/IP connections be over SSL, 
for example. If you must use MySQL, then you should probably set up a 
VPN between the two machines and configure the firewall on your MySQL 
server to not allow connections to port 3306 unless it comes across the 
VPN tunnel.


In the interim, if you find that MySQL is configured to listen for 
TCP/IP connections on port 3306 but your firewall rules block that port, 
you can always use ssh port-forwarding to test. Get a shell on your 
MySQL server from your local machine like so:


ssh -L 3306:localhost:3306 your-mysql-server.com

Assuming you don't have anything listening on port 3306 on localhost, 
this will forward any requests to that port across the SSH tunnel to 
port 3306 of your-mysql-server.com. If you're running MySQL on localhost 
and it's configured to listen on 3306, just pick some other port above 
1024 that isn't used, e.g. , in which case, you'd do:


ssh -L :localhost:3306 your-mysql-server.com
--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

--
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: Server on diffferent machine

2010-05-16 Thread bax...@gretschpages.com


On May 16, 1:55 pm, Daniel Hilton  wrote:

> Can you ping the db machine from the webserver?
> Can you access the db machine from the webserver using a mysql client
> such as Navicat or such like?

I can go to the DB machine via phpmyadmin.
However, when I try to ping the IP, it fails. Strange.
>
> My 2p is on the db machine not having the right port open or denying
> non-local connections.

It's definitely port 3306 (double-checked). Not sure about non-local
connections. And the ping thing is weird to me.

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

2010-05-16 Thread Daniel Hilton
On 16 May 2010 20:22, bax...@gretschpages.com  wrote:
>
>
> On May 16, 1:55 pm, Daniel Hilton  wrote:
>
>> Can you ping the db machine from the webserver?
>> Can you access the db machine from the webserver using a mysql client
>> such as Navicat or such like?
>
> I can go to the DB machine via phpmyadmin.
Is the phpmyadmin on the dbmachine? If so that doesn't prove that the
machine is accepting non-local mysql requests.

> However, when I try to ping the IP, it fails. Strange.
>>
>> My 2p is on the db machine not having the right port open or denying
>> non-local connections.
>
> It's definitely port 3306 (double-checked). Not sure about non-local
> connections. And the ping thing is weird to me.

If you can't ping the dbserver from the webserver can you ssh from the
webserver to the dbserver?

What distro are you using?

Cheers,
Dan

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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


-- 
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: Server on diffferent machine

2010-05-16 Thread CLIFFORD ILKAY

On 05/16/2010 03:22 PM, bax...@gretschpages.com wrote:



On May 16, 1:55 pm, Daniel Hilton  wrote:


Can you ping the db machine from the webserver?
Can you access the db machine from the webserver using a mysql client
such as Navicat or such like?


I can go to the DB machine via phpmyadmin.
However, when I try to ping the IP, it fails. Strange.


Not really. Some sysadmins configure their servers to not reply to pings.
--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

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



Error: App with label forum could not be found. Are you sure your INSTALLED_APPS setting is correct?

2010-05-16 Thread Pankaj Singh
Error: App with label forum could not be found. Are you sure your
INSTALLED_APPS setting is correct?

how to get out of this ?


-- 
-- 
--
Thanking You,

Pankaj Kumar Singh,
2nd Year Undergraduate Student,
Department of Agricultural and Food Engineering,
Indian Institute of Technology,
Kharagpur

Mobile - (+91) 8001231685

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



Restarting the server while working on dreamhost.

2010-05-16 Thread Pietro Speroni
I am slowly learning django, so my question might sound really easy.
Please let this not stop you from helping out.

I installed django 1.1.1 on dreamhost following the informatins here:
http://wiki.dreamhost.com/Django
It should be using Passenger WSGI, whatever that is ( :) )

I then went to learn django through the tutorial. I worked my way
through tutorial 1:
http://docs.djangoproject.com/en/dev/intro/tutorial01/
and I am now in tutorial 2
http://docs.djangoproject.com/en/dev/intro/tutorial02

One thing that should be noted is that I did not install django on my
computer but on dreamhost directly. I then went to
mysite/admin
where I found the admin part of django.

When I tried to

We are now on tutorial 2, where it says:
"You'll need to restart the development server to see your changes.
Normally, the server auto-reloads code every time you modify a file,
but the action of creating a new file doesn't trigger the auto-
reloading logic."

Which is here:
http://docs.djangoproject.com/en/dev/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin

But I am not running my own server, I am doing the changes directly on
site (on a personal part of the site).
So how do I tell the Apache server that he should consider the new
file or restart the server?

Many thanks,
Pietro

-- 
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: Python Database Framework

2010-05-16 Thread Ozgur Yılmaz
As I see there is no way to avoid this error. Django says that using
django.conf.settings.configure more than one causes that error and as far as
I understand it is a design issue.

I looked at Elixir and found it very useful and nice, but somehow I wanted
to stick to Django, I think it is because Django has some already written
features I like, like the User, Comment models, the admin interface, a very
comprehensive documentation  etc., so sticking with Django comes naturally.

Thus, I've changed my design. The previous design was build over using more
than one database for every project. I was going to use this, because I
wanted to have a more flexible design, that lets me backup and delete a
project with all its file and database at once.

Now I should use a central database, actually this will be more useful than
the previous one. The biggest improvement will be that I'll be able to see
all the projects at once... Anyway this is not the place to talk all of
these...

Thank you all... I'm appreciated your help, thank you again...

E.Ozgur Yilmaz
Lead Technical Director
www.ozgurfx.com


On Sat, May 15, 2010 at 4:11 AM, Joshua Partogi wrote:

> Thanks Nabil,
>
> I am also looking for something that is as simple as Django ORM but a
> standalone ORM that is not tightly coupled. I also like the
> ActiveRecord's syntax of Elixir.
>
> Kind regards,
> Joshua
>
> --
> http://twitter.com/scrum8
>
> On May 14, 7:51 am, Nabil Servais  wrote:
> > Hello
> > Le 14 mai 2010 à 16:47, Ozgur Yılmaz a écrit :
> >
> > > Hi everybody,
> >
> > > Do anyone knows a Python Database framework, which resembles Django's
> approach to database programming?
> >
> > Yes, Elixir :http://elixir.ematia.de/trac/wiki.
> >
> > > I need it to use outside of Django, for other Python scripts.
> >
> > > Best regards,
> >
> > > E.Ozgur Yilmaz
> > > Lead Technical Director
> > >www.ozgurfx.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: Server on diffferent machine

2010-05-16 Thread bax...@gretschpages.com
Yup, it was a sql configuration thing. Once that was sorted out,
Django worked exactly as expected, as usual.

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



One2One vs. Foreign Key unique

2010-05-16 Thread Odagi
Hello users, I cannot realize the difference between the different
ways of extending a model. Suppose we have Place and Restaurant Models
(a Restaurant is an extension of a Place). I know 3 different ways of
define the data model:

1. Multi-table inheritance:

class Place(models.Model): ...
class Restaurant(Place): ...


2. OneToOne relationship:

class Place(models.Model): ...
class Restaurant(models.Model):
place = models.OneToOneField(Place, primary_key=True)


3. ForeignKey unique:

class Place(models.Model): ...
class Restaurant(models.Model):
place = models.ForeignKey(Place, unique=True)


I can't realize the difference between them nor advantages/
disadvantages of each case. Is there a big difference? Can someone
clarify it please?
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.



override base translations in your project

2010-05-16 Thread lenz
The Django docs tell that it is possible to "override base
translations in your project path" but i have no idea how this works.

I tried to copy the some contents of an third party apps django.po to
the django.po file of the project but i see no change after compiling.

To me it seems obvious that it could not work because the path of the
entry is wrong if copied to the projects django.po

This is one of the statements i copied from APP/locale/LANG/django.po
th PROJECT/locale/LANG/django.po
#: content/application/models.py:127
msgid "application content"
msgstr "Applikation"

How to override translations of third party apps the right way?

Thanks
Lenz


-- 
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: Restarting the server while working on dreamhost.

2010-05-16 Thread bax...@gretschpages.com
It's been a while since I messed around on Dreamhost (finding them
utterly incapable of running a django site), but try touching the wsgi
file.

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



Is the Django book written in ReST/Sphinx?

2010-05-16 Thread cool-RR
I'm just working on a book for my own project, and I was wondering: Is
the Django book written in ReST/Sphinx? I am considering whether I
should write my book with that.

Thanks,
Ram.

-- 
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: Error: App with label forum could not be found. Are you sure your INSTALLED_APPS setting is correct?

2010-05-16 Thread Felippe Bueno
when are you getting this error ?

On Sun, May 16, 2010 at 5:38 PM, Pankaj Singh <
singh.pankaj.iitkg...@gmail.com> wrote:

> Error: App with label forum could not be found. Are you sure your
> INSTALLED_APPS setting is correct?
>
> how to get out of this ?
>
>
> --
> --
> --
> Thanking You,
>
> Pankaj Kumar Singh,
> 2nd Year Undergraduate Student,
> Department of Agricultural and Food Engineering,
> Indian Institute of Technology,
> Kharagpur
>
> Mobile - (+91) 8001231685
>
> --
> 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: Is the Django book written in ReST/Sphinx?

2010-05-16 Thread Russell Keith-Magee
On Mon, May 17, 2010 at 7:06 AM, cool-RR  wrote:
> I'm just working on a book for my own project, and I was wondering: Is
> the Django book written in ReST/Sphinx? I am considering whether I
> should write my book with that.

This is slightly off topic for this list, but I would advise that this
is something you need to take up with your publisher. Ultimately,
whatever your personal preferences, your publisher will control the
formats that you can use to submit a final manuscript.

As for the specific question; I can't speak specifically for the
Django Book, but I do know that Practical Django Projects was
originally drafted in ReST, but had to be converted to Word format for
final submission. Given that the Django Book published by the same
publisher, I'm going to guess the same rules applied.

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: One2One vs. Foreign Key unique

2010-05-16 Thread Rolando Espinoza La Fuente
On Sun, May 16, 2010 at 6:41 PM, Odagi  wrote:
> Hello users, I cannot realize the difference between the different
> ways of extending a model. Suppose we have Place and Restaurant Models
> (a Restaurant is an extension of a Place). I know 3 different ways of
> define the data model:
>
> 1. Multi-table inheritance:
>
> class Place(models.Model): ...
> class Restaurant(Place): ...

restaurant table gets all fields from place,
you can access all fields with single sql query

> 2. OneToOne relationship:
>
> class Place(models.Model): ...
> class Restaurant(models.Model):
>    place = models.OneToOneField(Place, primary_key=True)

You access "place" fields by using: restaurant.place
with extra db call unless you use select_related('place')

>
> 3. ForeignKey unique:
>
> class Place(models.Model): ...
> class Restaurant(models.Model):
>    place = models.ForeignKey(Place, unique=True)

In the old days there wasn't OneToOneField and people
used this method to have one-one relationship.
If you need to use ForeignKey+unique, better use OneToOneField.

One difference is the related name, with ForeignKey+unique
you would need to use place.restaurant_set[0] to access related
restaurant. Using OneToOneField just use place.restaurant.

~Rolando

-- 
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: Error: App with label forum could not be found. Are you sure your INSTALLED_APPS setting is correct?

2010-05-16 Thread Pankaj Singh
I am geetting thi error when using

./manage.py sqlall forum

On Sun, May 16, 2010 at 11:16 PM, Felippe Bueno wrote:

> when are you getting this error ?
>
> On Sun, May 16, 2010 at 5:38 PM, Pankaj Singh <
> singh.pankaj.iitkg...@gmail.com> wrote:
>
>> Error: App with label forum could not be found. Are you sure your
>> INSTALLED_APPS setting is correct?
>>
>> how to get out of this ?
>>
>>
>> --
>> --
>> --
>> Thanking You,
>>
>> Pankaj Kumar Singh,
>> 2nd Year Undergraduate Student,
>> Department of Agricultural and Food Engineering,
>> Indian Institute of Technology,
>> Kharagpur
>>
>> Mobile - (+91) 8001231685
>>
>> --
>> 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.
>



-- 
-- 
--
Thanking You,

Pankaj Kumar Singh,
2nd Year Undergraduate Student,
Department of Agricultural and Food Engineering,
Indian Institute of Technology,
Kharagpur

Mobile - (+91) 8001231685

-- 
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: One2One vs. Foreign Key unique

2010-05-16 Thread Odagi

Thanks a lot!

On May 16, 10:28 pm, Rolando Espinoza La Fuente 
wrote:
> On Sun, May 16, 2010 at 6:41 PM, Odagi  wrote:
> > Hello users, I cannot realize the difference between the different
> > ways of extending a model. Suppose we have Place and Restaurant Models
> > (a Restaurant is an extension of a Place). I know 3 different ways of
> > define the data model:
>
> > 1. Multi-table inheritance:
>
> > class Place(models.Model): ...
> > class Restaurant(Place): ...
>
> restaurant table gets all fields from place,
> you can access all fields with single sql query
>
> > 2. OneToOne relationship:
>
> > class Place(models.Model): ...
> > class Restaurant(models.Model):
> >    place = models.OneToOneField(Place, primary_key=True)
>
> You access "place" fields by using: restaurant.place
> with extra db call unless you use select_related('place')
>
>
>
> > 3. ForeignKey unique:
>
> > class Place(models.Model): ...
> > class Restaurant(models.Model):
> >    place = models.ForeignKey(Place, unique=True)
>
> In the old days there wasn't OneToOneField and people
> used this method to have one-one relationship.
> If you need to use ForeignKey+unique, better use OneToOneField.
>
> One difference is the related name, with ForeignKey+unique
> you would need to use place.restaurant_set[0] to access related
> restaurant. Using OneToOneField just use place.restaurant.
>
> ~Rolando
>
> --
> 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.