Re: Storing regex raw string literal in Django model?

2011-10-14 Thread Daniel Roseman
On Thursday, 13 October 2011 23:58:00 UTC+1, Victor Hooi wrote:
>
> Hi,
>
> I have Django model and in one of the fields I need to store a regex string 
> that I can later use.
>
> class Foo(models.Model):
> name = models.CharField(max_length=30, unique=True)
> regex_string = models.TextField()
>
>
> So for example, the regex_string field might be set to:
>
> r'\d{2}'
>
>
> I then try to retrieve this later, compile it as a regex expression and use 
> it - however, it doesn't seem to work as planned:
>
> >>> pattern = re.compile(ham.regex_string)
> >>> print(pattern.match("22"))
> None
>
>
> Obviously if I pass the raw string literal in directly, it works fine:
>
> >>> pattern = re.compile(r'\d{2}')
> >>> pattern.match("22")
> <_sre.SRE_Match object at 0x1505100>
>
>
> If I actually print ham.regex_string, it returns:
>
> u"r'\\d{2}'"
>
>
> So it's a unicode string, but for some reason the backslashes are 
> doubled-up?
>
> What I actually need is a way to store a regex raw string literal, so that 
> I can retrieve it later and use it in a regex.
>
> Is there a better way of doing this?
>
> Cheers,
> Victor
>

So how did you save it in the first place? You don't actually want the `r` 
and the single quotes, they're just for when you specify the literal in your 
code. If you did 

foo.regex_string = r'\d{2}'

it should come out the other side OK. When you print the string in your 
console, it'll give the doubled-backslash, but that's just the way Python 
displays them - it would do the same with the original raw string.
--
DR.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/qMNLMe601Y0J.
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.



a django question about "python manage.py syncdb"

2011-10-14 Thread Chen Xu
Hi,
I am new to Django.
I have installed Django and go t everything set up correctly, just started
some easy tutorials.

So when I do
Django-admin.py startapp  blog


it creates a /blog directory that looks like thsi
/blog
- __init__.py
- tests.py
- models.py
- views.py

I know in Django, when you run "python manage.py syncdb", it will look
through models.py, and create all the table it finds.
However, I dont want to create all my tables in models.py, becaue when my
proj get bigger, it is hard to maintain.
Therefore, I create a subdirectory "/Models" to store all my model

/blog
- __init__.py
- tests.py
- models.py
- views.py
/Models
- __init__.py
post.py

 so in my
models.py: (only 2 lines)
from django.db import models
from blog.Models import post

in my post.py: (only 3 lines)
from django.db import models
class post(models.Model):
  body = models.TextField()


and then when I run "python manage.py syncdb" , it doesn't create the table
"post" for me.

Could anyone please help?




Thanks very much
Best regards


-- 
⚡ Chen Xu ⚡

-- 
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: a django question about "python manage.py syncdb"

2011-10-14 Thread nicolas HERSOG
You can also type python manage.py sqlall  and copy paste sql
instructions in your bd

On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  wrote:

> Hi,
> I am new to Django.
> I have installed Django and go t everything set up correctly, just started
> some easy tutorials.
>
> So when I do
> Django-admin.py startapp  blog
>
>
> it creates a /blog directory that looks like thsi
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
>
> I know in Django, when you run "python manage.py syncdb", it will look
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when my
> proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
>
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> /Models
> - __init__.py
> post.py
>
>  so in my
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
>
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
>
>
> and then when I run "python manage.py syncdb" , it doesn't create the table
> "post" for me.
>
> Could anyone please help?
>
>
>
>
> Thanks very much
> Best regards
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>

-- 
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: a django question about "python manage.py syncdb"

2011-10-14 Thread Chen Xu
I know that will work, but what I can do to just make "python manage.py
syncdb" work?

Thanks very much

On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG  wrote:

> You can also type python manage.py sqlall  and copy paste sql
> instructions in your bd
>
> On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  wrote:
>
>> Hi,
>> I am new to Django.
>> I have installed Django and go t everything set up correctly, just started
>> some easy tutorials.
>>
>> So when I do
>> Django-admin.py startapp  blog
>>
>>
>> it creates a /blog directory that looks like thsi
>> /blog
>> - __init__.py
>> - tests.py
>> - models.py
>> - views.py
>>
>> I know in Django, when you run "python manage.py syncdb", it will look
>> through models.py, and create all the table it finds.
>> However, I dont want to create all my tables in models.py, becaue when my
>> proj get bigger, it is hard to maintain.
>> Therefore, I create a subdirectory "/Models" to store all my model
>>
>> /blog
>> - __init__.py
>> - tests.py
>> - models.py
>> - views.py
>> /Models
>> - __init__.py
>> post.py
>>
>>  so in my
>> models.py: (only 2 lines)
>> from django.db import models
>> from blog.Models import post
>>
>> in my post.py: (only 3 lines)
>> from django.db import models
>> class post(models.Model):
>>   body = models.TextField()
>>
>>
>> and then when I run "python manage.py syncdb" , it doesn't create the
>> table "post" for me.
>>
>> Could anyone please help?
>>
>>
>>
>>
>> Thanks very much
>> Best regards
>>
>>
>> --
>> ⚡ Chen Xu ⚡
>>
>> --
>> 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.
>>
>
>  --
> 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.
>



-- 
⚡ Chen Xu ⚡

-- 
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: a django question about "python manage.py syncdb"

2011-10-14 Thread Chen Xu
and when i tried "python manage.py sqlall  "  it gives empty.
I think is it because I am not importing  properly or something else is
going wrong.


Thanks





On Fri, Oct 14, 2011 at 2:46 AM, Chen Xu  wrote:

> I know that will work, but what I can do to just make "python manage.py
> syncdb" work?
>
> Thanks very much
>
>
> On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG wrote:
>
>> You can also type python manage.py sqlall  and copy paste sql
>> instructions in your bd
>>
>> On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  wrote:
>>
>>> Hi,
>>> I am new to Django.
>>> I have installed Django and go t everything set up correctly, just
>>> started some easy tutorials.
>>>
>>> So when I do
>>> Django-admin.py startapp  blog
>>>
>>>
>>> it creates a /blog directory that looks like thsi
>>> /blog
>>> - __init__.py
>>> - tests.py
>>> - models.py
>>> - views.py
>>>
>>> I know in Django, when you run "python manage.py syncdb", it will look
>>> through models.py, and create all the table it finds.
>>> However, I dont want to create all my tables in models.py, becaue when my
>>> proj get bigger, it is hard to maintain.
>>> Therefore, I create a subdirectory "/Models" to store all my model
>>>
>>> /blog
>>> - __init__.py
>>> - tests.py
>>> - models.py
>>> - views.py
>>> /Models
>>> - __init__.py
>>> post.py
>>>
>>>  so in my
>>> models.py: (only 2 lines)
>>> from django.db import models
>>> from blog.Models import post
>>>
>>> in my post.py: (only 3 lines)
>>> from django.db import models
>>> class post(models.Model):
>>>   body = models.TextField()
>>>
>>>
>>> and then when I run "python manage.py syncdb" , it doesn't create the
>>> table "post" for me.
>>>
>>> Could anyone please help?
>>>
>>>
>>>
>>>
>>> Thanks very much
>>> Best regards
>>>
>>>
>>> --
>>> ⚡ Chen Xu ⚡
>>>
>>> --
>>> 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.
>>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> ⚡ Chen Xu ⚡
>



-- 
⚡ Chen Xu ⚡

-- 
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 1.3: how to use get_abolute_url in class based generic views

2011-10-14 Thread Fabrizio Mancini
On 13 October 2011 23:57, Andriyko  wrote:

> urlpatterns = patterns('django.views.generic.dates',
> (r'^(?P\d{4})/v/(?P\d{2})/(?P[-\w]+)/
> $', DateDetailView.as_view(template_name='blog/article_detail.html',
> **entry_info_dict)),
> )
>
Hi,
You are using
(?P\w{3})
but in get_absolute_url you are using
self.pub_date.strftime("%m").lower(),
referring to http://docs.python.org/library/time.html#time.strftime
%m return Month as a decimal number [01,12].
this won't never work
You should use %b instead of %m
This should work
HTH
Fabrizio



> = models.py 
>
> class Article(models.Model):
>..
>   # with django 1.2 was
>   @models.permalink
>def get_absolute_url(self):
>return ('article_detail', (), {  'year':
> self.pub_date.strftime("%Y"),
> 'month':
> self.pub_date.strftime("%m").lower(),
> 'day':
> self.pub_date.strftime("%d"),
> 'slug': self.slug })
>   # how should it look with django 1.3 ??
>
>
>

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



Test DB Connection

2011-10-14 Thread Julian Hodgson
I've go some python modules which automatically connect to the database then
they are loaded beacuse they  have an __init__.py with

from django.core.management import setup_environ

import passion.settings

def loadSettings():
s = setup_environ(passion.settings)
print s

# this should only be run from the workbox not on the server
loadSettings()

This works fine even when it can't connect.

But later if I do:

from passion.cg.models import *
users = User.objects.filter( username='julian')
print users

then I get

# OperationalError: (1044, "Access denied for user ''@'localhost' to
database 'djangostack'")
#  - [line 3]

So I need a way to test the connection before trying to use the django
models.

I can just check for exceptions, but is there a better way?

Julian

-- 
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: Test DB Connection

2011-10-14 Thread Cal Leeming [Simplicity Media Ltd]
Ja - just catch OperationalError exception and check if the code was 1044.

Here are a list of all the error codes, so you can choose which ones you
want to handle individually:

http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html

http://dev.mysql.com/doc/refman/5.5/en/error-messages-client.html

Hope this helps

Cal

On Fri, Oct 14, 2011 at 11:38 AM, Julian Hodgson <
julian.of.lon...@googlemail.com> wrote:

> I've go some python modules which automatically connect to the database
> then they are loaded beacuse they  have an __init__.py with
>
> from django.core.management import setup_environ
>
> import passion.settings
>
> def loadSettings():
> s = setup_environ(passion.settings)
> print s
>
> # this should only be run from the workbox not on the server
> loadSettings()
>
> This works fine even when it can't connect.
>
> But later if I do:
>
> from passion.cg.models import *
> users = User.objects.filter( username='julian')
> print users
>
> then I get
>
> # OperationalError: (1044, "Access denied for user ''@'localhost' to
> database 'djangostack'")
> #  - [line 3]
>
> So I need a way to test the connection before trying to use the django
> models.
>
> I can just check for exceptions, but is there a better way?
>
> Julian
>
>  --
> 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.
>

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



Why does Django not pass on error messages with the default 404 view?

2011-10-14 Thread yakiimo
The docs (https://docs.djangoproject.com/en/dev/topics/http/views/
#customizing-error-views) state, "The page_not_found view should
suffice for 99% of Web applications, but if you want to override it,
you can specify handler404 in your URLconf".

The page_not_found view only passes on the requested URL and ignores
any message you provide when raising an exception. It seems to me that
having the *option* to provide helpful hints to the 404.html template
by default would be good for everyone.

Could someone explain the reasoning here? I'm currently making a
custom view, but maybe it's a bad idea in practice?

A more specific context: I'm using matrix URLs so the base resource is
a normal hierarchical URL followed by matrix options in the basic
format of:
;filter_type1=item:value,item:value;filter_type2=item:value...

So it is quite easy to provide helpful messages based on how far along
the parsing gets before having an error. Wouldn't it be good to pass
on a message such as the following examples?
"Allowed filter_types: type1, type2, type3." or "Allowed items for
filter_type a: item1, item2, item3."

Apologies if I missed this explanation elsewhere. I've looked.

-- 
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: a django question about "python manage.py syncdb"

2011-10-14 Thread Phang Mulianto
maybe you can try remove the models.py coz by default syncdb look for
models.py or anything beneath models folder...but cannot do both of them...
On Oct 14, 2011 5:49 PM, "Chen Xu"  wrote:

> and when i tried "python manage.py sqlall  "  it gives empty.
> I think is it because I am not importing  properly or something else is
> going wrong.
>
>
> Thanks
>
>
>
>
>
> On Fri, Oct 14, 2011 at 2:46 AM, Chen Xu  wrote:
>
>> I know that will work, but what I can do to just make "python manage.py
>> syncdb" work?
>>
>> Thanks very much
>>
>>
>> On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG wrote:
>>
>>> You can also type python manage.py sqlall  and copy paste sql
>>> instructions in your bd
>>>
>>> On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  wrote:
>>>
 Hi,
 I am new to Django.
 I have installed Django and go t everything set up correctly, just
 started some easy tutorials.

 So when I do
 Django-admin.py startapp  blog


 it creates a /blog directory that looks like thsi
 /blog
 - __init__.py
 - tests.py
 - models.py
 - views.py

 I know in Django, when you run "python manage.py syncdb", it will look
 through models.py, and create all the table it finds.
 However, I dont want to create all my tables in models.py, becaue when
 my proj get bigger, it is hard to maintain.
 Therefore, I create a subdirectory "/Models" to store all my model

 /blog
 - __init__.py
 - tests.py
 - models.py
 - views.py
 /Models
 - __init__.py
 post.py

  so in my
 models.py: (only 2 lines)
 from django.db import models
 from blog.Models import post

 in my post.py: (only 3 lines)
 from django.db import models
 class post(models.Model):
   body = models.TextField()


 and then when I run "python manage.py syncdb" , it doesn't create the
 table "post" for me.

 Could anyone please help?




 Thanks very much
 Best regards


 --
 ⚡ Chen Xu ⚡

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

>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> ⚡ Chen Xu ⚡
>>
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>

-- 
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: Ajax replacement in django

2011-10-14 Thread Babatunde Akinyanmi
>From what Iankesh said initially, I think he is having problems using
ajax to load part of a page not ajax as a whole.
Iankesh, it is possible to load only a portion of a page with ajax.

On 10/13/11, Sells, Fred  wrote:
>> On Wed, Oct 12, 2011 at 9:17 AM, lankesh87  wrote:
>> >  I am developing a web application where i need ajax like features.
>> > But I don't want to use ajax, so my question is- "is there any way to
>> > perform ajax like functions in django?"
>>
> Use Flex, it's easier.
>
> --
> 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.
>
>

-- 
Sent from my mobile device

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



Foreign key problem

2011-10-14 Thread Guy Nesher

Hi,

I'm trying to populate a table with 2 foreign keys using a csv file
and keep getting the following error :
Cannot assign "238": "PrizetoRestaurant.RestauranttId" must be a
"Restaurant" instance.

I tried to manually define the primary keys in those tables, and I'm
making sure I int() the data from the csv, but still now luck.
I've also looked in the db and a restaurant with id 238 does exist in
the Restaurant table.

I'm attaching the relevant code bellow.

Thanks!

I have the following model:

class Restaurant(models.Model):
Id = models.IntegerField(unique=True, primary_key=True)
Name = models.CharField(max_length=128)
Address = models.CharField(max_length=128)
Zip = models.CharField(max_length=128)
City = models.CharField(max_length=128)
Phone = models.CharField(max_length=128)
Latitude = models.DecimalField(max_digits=11, decimal_places=9)
Longitude = models.DecimalField(max_digits=11, decimal_places=9)

class Prize(models.Model):
Id = models.IntegerField(unique=True, primary_key=True)
Name = models.CharField(max_length=128)
GroupId = models.ForeignKey('PrizeGroup', to_field='Id')

class PrizetoRestaurant(models.Model):
RestaurantId = models.ForeignKey('Restaurant', to_field='Id')
PrizeId = models.ForeignKey('Prize', to_field='Id')
Date = models.DateField()
Quantity = models.IntegerField()


and the code is :


import csv
reader = csv.reader(open("/Users/guy.nesher/Work/tmsw/swiss/src/
monopoly/static/csv/dailydatatest.csv", "rU"), dialect='excel')
for row in reader:
 
PrizetoRestaurant.objects.get_or_create(RestaurantId=int(row[0]),
PrizeId=prizedict[2], Date = row[10], Quantity = row[2])

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



Django models design question

2011-10-14 Thread omerd
Hello everybody,
I am writing my first web application with Django.

I want to create a web of registration for many subjects.
However, each subject require different set of details to be supplied
so I don't know which models should I have in the database.

Currently I have two models:
Registration - describes a registration (each record is a different
subject)
Details - describes all the possible details which may be necessary to
register.

Now, each Registration instance should contain a list of the necessary
details, so i guess that Registration and Details are Many-To-Many
connected.

My question is - how the other model(s) which contains the actual
details and a FK to Registration model should look like? I don't want
to create a new model for each Registration record and place the
necessary details hardcoded in the model fields. What if I have 30
records in Registration table ?!

-- 
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: a django question about "python manage.py syncdb"

2011-10-14 Thread Mike Dewhirst
On 14/10/2011, at 8:23 PM, Chen Xu  wrote:

> Hi, 
> I am new to Django.
> I have installed Django and go t everything set up correctly, just started 
> some easy tutorials.
> 
> So when I do 
> Django-admin.py startapp  blog
> 
> 
> it creates a /blog directory that looks like thsi
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> 
> I know in Django, when you run "python manage.py syncdb", it will look 
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when my 
> proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
> 
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> /Models
> - __init__.py
> post.py
> 
>  so in my  
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
> 
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
> 
> 
> and then when I run "python manage.py syncdb" , it doesn't create the table 
> "post" for me.

I would start with a tried and successful approach and *after* getting the 
tables created refactor the models into separate files if that seemed to be a 
good idea at the time. 

Also my guess is that you will eventually split your project into apps as a 
more "natural" way to keep things simple rather than putting individual models 
into their own files. 

However it may be possible to simply delete your models.py file to get syncdb 
to work. I haven't tried it so I don't know. 

Mike

> 
> Could anyone please help?
> 
> 
> 
> 
> Thanks very much
> Best regards
> 
> 
> -- 
> ⚡ Chen Xu ⚡
> -- 
> 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.

-- 
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: Foreign key problem

2011-10-14 Thread Daniel Roseman
On Friday, 14 October 2011 12:44:45 UTC+1, Guy Nesher wrote:
>
>
> Hi, 
>
> I'm trying to populate a table with 2 foreign keys using a csv file 
> and keep getting the following error : 
> Cannot assign "238": "PrizetoRestaurant.RestauranttId" must be a 
> "Restaurant" instance. 
>
> I tried to manually define the primary keys in those tables, and I'm 
> making sure I int() the data from the csv, but still now luck. 
> I've also looked in the db and a restaurant with id 238 does exist in 
> the Restaurant table. 
>
> I'm attaching the relevant code bellow. 
>
> Thanks! 
>
> I have the following model: 
>
> class Restaurant(models.Model): 
> Id = models.IntegerField(unique=True, primary_key=True) 
> Name = models.CharField(max_length=128) 
> Address = models.CharField(max_length=128) 
> Zip = models.CharField(max_length=128) 
> City = models.CharField(max_length=128) 
> Phone = models.CharField(max_length=128) 
> Latitude = models.DecimalField(max_digits=11, decimal_places=9) 
> Longitude = models.DecimalField(max_digits=11, decimal_places=9) 
>
> class Prize(models.Model): 
> Id = models.IntegerField(unique=True, primary_key=True) 
> Name = models.CharField(max_length=128) 
> GroupId = models.ForeignKey('PrizeGroup', to_field='Id') 
>
> class PrizetoRestaurant(models.Model): 
> RestaurantId = models.ForeignKey('Restaurant', to_field='Id') 
> PrizeId = models.ForeignKey('Prize', to_field='Id') 
> Date = models.DateField() 
> Quantity = models.IntegerField() 
>
>
> and the code is : 
>
>
> import csv 
> reader = csv.reader(open("/Users/guy.nesher/Work/tmsw/swiss/src/ 
> monopoly/static/csv/dailydatatest.csv", "rU"), dialect='excel') 
> for row in reader: 
>   
> PrizetoRestaurant.objects.get_or_create(RestaurantId=int(row[0]), 
> PrizeId=prizedict[2], Date = row[10], Quantity = row[2]) 
>


The error is quite clear: you're getting an integer from the CSV, but 
Django's ForeignKey expects an actual instance of the related table. If 
you'd called your field something sensible like "restaurant" this would be 
more obvious.

You can actually assign the ID directly by postfixing _id to the field name 
- so in your case, it would be RestaurantId_id

Please, also read PEP8 and don't give your fields InitialCaps names - they 
should be lower_case_with_underscore.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/jrq9Q_VcyqQJ.
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: Ajax replacement in django

2011-10-14 Thread Phang Mulianto
ajax use usualy load a div part of html with new content fetch from the
server when user do something,like click a submit button. and django process
the request as a simple usual request.

i have using prototype+scriptocolous for the simple syntax to make an ajax
form.
i see the jquery version also but a bit trouble coz need to add the event
manually.

and remember the crsf token when using ajax request..will need it generated
properly..

anyone using prototype to?

or anyone have better way with ajax
On Oct 14, 2011 7:47 PM, "Babatunde Akinyanmi"  wrote:

> From what Iankesh said initially, I think he is having problems using
> ajax to load part of a page not ajax as a whole.
> Iankesh, it is possible to load only a portion of a page with ajax.
>
> On 10/13/11, Sells, Fred  wrote:
> >> On Wed, Oct 12, 2011 at 9:17 AM, lankesh87 
> wrote:
> >> >  I am developing a web application where i need ajax like features.
> >> > But I don't want to use ajax, so my question is- "is there any way to
> >> > perform ajax like functions in django?"
> >>
> > Use Flex, it's easier.
> >
> > --
> > 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.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> 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.
>
>

-- 
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 1.3: how to use get_abolute_url in class based generic views

2011-10-14 Thread Andriyko
Thank you for reply, but I still get the errror
Template error

In template /home/pinglin/DjangoProjects/weblog/templates/blog/
article_archive.html, error at line 6

Caught ViewDoesNotExist while rendering: Tried archive_day in module
django.views.generic.dates. Error was: 'module' object has no
attribute 'archive_day'
1   {% extends "blog/index.html" %}
2
3   {% block column1 %}
4   Archive
5   
6   {% for article in object_list %}
7   {{ article.title }}

8   Posted by {{ article.author }} on {{ article.pub_date|date:"F jS,
Y" }}
9   
10  {% endfor %}
11  
12  {% endblock %}
13  {% block column2 %}Last article here{% endblock %}

Could you please give an example about how to use get_absolute_url
with class based generic views?

On Oct 14, 1:31 pm, Fabrizio Mancini  wrote:
> On 13 October 2011 23:57, Andriyko  wrote:
>
> > urlpatterns = patterns('django.views.generic.dates',
> > (r'^(?P\d{4})/v/(?P\d{2})/(?P[-\w]+)/
> > $', DateDetailView.as_view(template_name='blog/article_detail.html',
> > **entry_info_dict)),
> > )
>
> Hi,
> You are using
> (?P\w{3})
> but in get_absolute_url you are using
> self.pub_date.strftime("%m").lower(),
> referring tohttp://docs.python.org/library/time.html#time.strftime
> %m return Month as a decimal number [01,12].
> this won't never work
> You should use %b instead of %m
> This should work
> HTH
> Fabrizio
>
>
>
>
>
>
>
> > = models.py 
>
> > class Article(models.Model):
> >    ..
> >   # with django 1.2 was
> >       @models.permalink
> >    def get_absolute_url(self):
> >        return ('article_detail', (), {  'year':
> > self.pub_date.strftime("%Y"),
> >                                         'month':
> > self.pub_date.strftime("%m").lower(),
> >                                         'day':
> > self.pub_date.strftime("%d"),
> >                                         'slug': self.slug })
> >   # how should it look with django 1.3 ??

-- 
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: Foreign key problem

2011-10-14 Thread Guy Nesher
Hi DR,

Thanks, I've just started developing in Python/Django so I do
apologize for the bad naming convention (I'll fix this once everything
works, don't want to add additional errors before I sort this).

Having said that I assumed that if I define the foreignkey manually
and specifically select an int field it will work.

I've tried to add the _id to the update process (ResturantId to
ResturantId_id) but I just get an error saying the field does not
exist :
Cannot resolve keyword 'RestaurantId_id' into field. Choices are:
Date, PrizeId, Quantity, RestaurantId, id

The new update line now looks like this:
PrizetoRestaurant.objects.get_or_create(RestaurantId_id=int(row[0]),
PrizeId=prizedict[2], Date = row[10], Quantity = row[2])

I'm guessing I'm missing something, just not sure what


On Oct 14, 1:24 pm, Daniel Roseman  wrote:
> On Friday, 14 October 2011 12:44:45 UTC+1, Guy Nesher wrote:
>
> > Hi,
>
> > I'm trying to populate a table with 2 foreign keys using a csv file
> > and keep getting the following error :
> > Cannot assign "238": "PrizetoRestaurant.RestauranttId" must be a
> > "Restaurant" instance.
>
> > I tried to manually define the primary keys in those tables, and I'm
> > making sure I int() the data from the csv, but still now luck.
> > I've also looked in the db and a restaurant with id 238 does exist in
> > the Restaurant table.
>
> > I'm attaching the relevant code bellow.
>
> > Thanks!
>
> > I have the following model:
>
> > class Restaurant(models.Model):
> > Id = models.IntegerField(unique=True, primary_key=True)
> > Name = models.CharField(max_length=128)
> > Address = models.CharField(max_length=128)
> > Zip = models.CharField(max_length=128)
> > City = models.CharField(max_length=128)
> > Phone = models.CharField(max_length=128)
> > Latitude = models.DecimalField(max_digits=11, decimal_places=9)
> > Longitude = models.DecimalField(max_digits=11, decimal_places=9)
>
> > class Prize(models.Model):
> > Id = models.IntegerField(unique=True, primary_key=True)
> > Name = models.CharField(max_length=128)
> > GroupId = models.ForeignKey('PrizeGroup', to_field='Id')
>
> > class PrizetoRestaurant(models.Model):
> > RestaurantId = models.ForeignKey('Restaurant', to_field='Id')
> > PrizeId = models.ForeignKey('Prize', to_field='Id')
> > Date = models.DateField()
> > Quantity = models.IntegerField()
>
> > and the code is :
>
> > import csv
> > reader = csv.reader(open("/Users/guy.nesher/Work/tmsw/swiss/src/
> > monopoly/static/csv/dailydatatest.csv", "rU"), dialect='excel')
> > for row in reader:
>
> > PrizetoRestaurant.objects.get_or_create(RestaurantId=int(row[0]),
> > PrizeId=prizedict[2], Date = row[10], Quantity = row[2])
>
> The error is quite clear: you're getting an integer from the CSV, but
> Django's ForeignKey expects an actual instance of the related table. If
> you'd called your field something sensible like "restaurant" this would be
> more obvious.
>
> You can actually assign the ID directly by postfixing _id to the field name
> - so in your case, it would be RestaurantId_id
>
> Please, also read PEP8 and don't give your fields InitialCaps names - they
> should be lower_case_with_underscore.
> --
> 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: django 1.3: how to use get_abolute_url in class based generic views

2011-10-14 Thread Andriyko
Thank you for reply, but I still get the errror
Template error

In template .../weblog/templates/blog/article_archive.html, error at
line 6

Caught ViewDoesNotExist while rendering: Tried archive_day in module
django.views.generic.dates. Error was: 'module' object has no
attribute 'archive_day'
1   {% extends "blog/index.html" %}
2
3   {% block column1 %}
4   Archive
5   
6   {% for article in object_list %}
7   {{ article.title }}

8   Posted by {{ article.author }} on {{ article.pub_date|date:"F
jS,
Y" }}
9   
10  {% endfor %}
11  
12  {% endblock %}
13  {% block column2 %}Last article here{% endblock %}

Could you please give an example about how to use get_absolute_url
with class based generic views?

On Oct 14, 1:31 pm, Fabrizio Mancini  wrote:
> On 13 October 2011 23:57, Andriyko  wrote:
>
> > urlpatterns = patterns('django.views.generic.dates',
> > (r'^(?P\d{4})/v/(?P\d{2})/(?P[-\w]+)/
> > $', DateDetailView.as_view(template_name='blog/article_detail.html',
> > **entry_info_dict)),
> > )
>
> Hi,
> You are using
> (?P\w{3})
> but in get_absolute_url you are using
> self.pub_date.strftime("%m").lower(),
> referring tohttp://docs.python.org/library/time.html#time.strftime
> %m return Month as a decimal number [01,12].
> this won't never work
> You should use %b instead of %m
> This should work
> HTH
> Fabrizio
>
>
>
>
>
>
>
> > = models.py 
>
> > class Article(models.Model):
> >    ..
> >   # with django 1.2 was
> >       @models.permalink
> >    def get_absolute_url(self):
> >        return ('article_detail', (), {  'year':
> > self.pub_date.strftime("%Y"),
> >                                         'month':
> > self.pub_date.strftime("%m").lower(),
> >                                         'day':
> > self.pub_date.strftime("%d"),
> >                                         'slug': self.slug })
> >   # how should it look with django 1.3 ??

-- 
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: Foreign key problem

2011-10-14 Thread Guy Nesher
nm, solved

On Oct 14, 1:54 pm, Guy Nesher  wrote:
> Hi DR,
>
> Thanks, I've just started developing in Python/Django so I do
> apologize for the bad naming convention (I'll fix this once everything
> works, don't want to add additional errors before I sort this).
>
> Having said that I assumed that if I define the foreignkey manually
> and specifically select an int field it will work.
>
> I've tried to add the _id to the update process (ResturantId to
> ResturantId_id) but I just get an error saying the field does not
> exist :
> Cannot resolve keyword 'RestaurantId_id' into field. Choices are:
> Date, PrizeId, Quantity, RestaurantId, id
>
> The new update line now looks like this:
> PrizetoRestaurant.objects.get_or_create(RestaurantId_id=int(row[0]),
> PrizeId=prizedict[2], Date = row[10], Quantity = row[2])
>
> I'm guessing I'm missing something, just not sure what
>
> On Oct 14, 1:24 pm, Daniel Roseman  wrote:
>
>
>
>
>
>
>
> > On Friday, 14 October 2011 12:44:45 UTC+1, Guy Nesher wrote:
>
> > > Hi,
>
> > > I'm trying to populate a table with 2 foreign keys using a csv file
> > > and keep getting the following error :
> > > Cannot assign "238": "PrizetoRestaurant.RestauranttId" must be a
> > > "Restaurant" instance.
>
> > > I tried to manually define the primary keys in those tables, and I'm
> > > making sure I int() the data from the csv, but still now luck.
> > > I've also looked in the db and a restaurant with id 238 does exist in
> > > the Restaurant table.
>
> > > I'm attaching the relevant code bellow.
>
> > > Thanks!
>
> > > I have the following model:
>
> > > class Restaurant(models.Model):
> > > Id = models.IntegerField(unique=True, primary_key=True)
> > > Name = models.CharField(max_length=128)
> > > Address = models.CharField(max_length=128)
> > > Zip = models.CharField(max_length=128)
> > > City = models.CharField(max_length=128)
> > > Phone = models.CharField(max_length=128)
> > > Latitude = models.DecimalField(max_digits=11, decimal_places=9)
> > > Longitude = models.DecimalField(max_digits=11, decimal_places=9)
>
> > > class Prize(models.Model):
> > > Id = models.IntegerField(unique=True, primary_key=True)
> > > Name = models.CharField(max_length=128)
> > > GroupId = models.ForeignKey('PrizeGroup', to_field='Id')
>
> > > class PrizetoRestaurant(models.Model):
> > > RestaurantId = models.ForeignKey('Restaurant', to_field='Id')
> > > PrizeId = models.ForeignKey('Prize', to_field='Id')
> > > Date = models.DateField()
> > > Quantity = models.IntegerField()
>
> > > and the code is :
>
> > > import csv
> > > reader = csv.reader(open("/Users/guy.nesher/Work/tmsw/swiss/src/
> > > monopoly/static/csv/dailydatatest.csv", "rU"), dialect='excel')
> > > for row in reader:
>
> > > PrizetoRestaurant.objects.get_or_create(RestaurantId=int(row[0]),
> > > PrizeId=prizedict[2], Date = row[10], Quantity = row[2])
>
> > The error is quite clear: you're getting an integer from the CSV, but
> > Django's ForeignKey expects an actual instance of the related table. If
> > you'd called your field something sensible like "restaurant" this would be
> > more obvious.
>
> > You can actually assign the ID directly by postfixing _id to the field name
> > - so in your case, it would be RestaurantId_id
>
> > Please, also read PEP8 and don't give your fields InitialCaps names - they
> > should be lower_case_with_underscore.
> > --
> > 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: a django question about "python manage.py syncdb"

2011-10-14 Thread Andre Terra
models should be lowercase, because that's the standard for every single
python package.


Cheers,
AT

On Fri, Oct 14, 2011 at 6:23 AM, Chen Xu  wrote:

> Hi,
> I am new to Django.
> I have installed Django and go t everything set up correctly, just started
> some easy tutorials.
>
> So when I do
> Django-admin.py startapp  blog
>
>
> it creates a /blog directory that looks like thsi
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
>
> I know in Django, when you run "python manage.py syncdb", it will look
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when my
> proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
>
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> /Models
> - __init__.py
> post.py
>
>  so in my
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
>
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
>
>
> and then when I run "python manage.py syncdb" , it doesn't create the table
> "post" for me.
>
> Could anyone please help?
>
>
>
>
> Thanks very much
> Best regards
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>

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



Something wrong in the model ot template - my Christmas wishes list

2011-10-14 Thread Piotr Hosowicz
Hello,

In the model I have :

def campaign(request, campaign_id):
ctx = {'camppeople': PersonPhones.objects.all() }
return render_to_response("campaign.html", ctx,
context_instance=RequestContext(request))

I also have a place where I store the info whether I want to call that
person:

class CampPeople(models.Model):
person = models.ForeignKey(Person)
camp = models.ForeignKey(Campaign)
docall = models.BooleanField(True)
called = models.BooleanField(False)
objects = CampaignManager()

The template is:


{% for piplok in camppeople %}

{{ piplok.person.label }}

{% if piplok.docall %}
dzwon
{% else %}
nie dzwon
{% endif %}
{{ piplok.phone }}

{% endfor %}


The prob;em is that there is no Django magic, piplok.docall is always
false. If you need more data I'll supply it.

Please help, I am new to Django. Thanks in advance.

Regards,

Piotr Hosowicz

-- 
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: Something wrong in the model ot template - my Christmas wishes list

2011-10-14 Thread Piotr Hosowicz
SOLVED I think.

I should have had :

def campaign(request, campaign_id):
ctx = {'phones': PersonPhones.objects.all(), "camppeople":
CampPeople.objects.all() }
return render_to_response("campaign.html", ctx,
context_instance=RequestContext(request))


in views.py.

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



Issue with complex Django join query

2011-10-14 Thread Fabrizio Buratta
I can't find a valid way with Django OMR in order to get : ( a raw
query is also fine )

the Sites.sitename which made the Analysis where
(Analysi_Items.name='somename' and Analysis_Items.value='somevalue')
and (Analysi_items_name='somename' and
Analysis_Items.value='somevalue') and (Analysis_items.name='somename'
and Analysis_Items.value='somevalue').

class Sites(models.Model):

region = models.CharField(max_length=1000)
province = models.CharField(max_length=1000)
sitename = models.CharField(max_length=1000, primary_key=True)

class Meta:

verbose_name_plural = "Sites"

def __unicode__(self):

return self.sitename

class Analysis_Items(models.Model):

code = models.ForeignKey('Analysis')
name = models.CharField(max_lenght=100)
value = models.CharField(max_length=20)

class Meta:

verbose_name_plural = "Analysis Type"

class Analysis(models.Model):

date = models.DateField()
site = models.ForeignKey('Sites')

def __unicode__(self):

return str(self.date)

class Meta:

verbose_name_plural = "Analysis"

Hope this is clear enough. thank you in advance!

-- 
Fab

http://twitter.com/extremoburo

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



django free web hosting list

2011-10-14 Thread profDjango
Updated django free wb hosting list available at

http://freedjangohosting.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.



Re: Django models design question

2011-10-14 Thread Stuart
Hello omerd --

If you give some concrete examples of what you are trying to do,
including providing your current models.py code, it will make it
easier for us to help you.

Since you have Registration and Details models, I am assuming you want
the user to be able to create/define these items, rather than
specifying them yourself beforehand. So if I am a user of your system,
I can define a new Registration for handguns, and indicate that I want
Details of caliber and shell capacity. Then another user can access
the system and register his .38 six-shooter. Is that the kind of thing
you have in mind? If so, you are essentially giving the users the
ability to define a new table (Registration) with certain columns
(Details), and then letting them populate it (and you would store the
actual values using another model like 'AttributeValue').

On the other hand, if you are defining the subjects beforehand as the
developer, you will want a different approach altogether. In that case
you might consider something like model inheritance (https://
docs.djangoproject.com/en/1.3/topics/db/models/#model-inheritance) or
some other technique to keep things DRY as you add dozens of
registration subjects.


Hope that helps,

--Stuart

On Oct 14, 6:53 am, omerd  wrote:
> Hello everybody,
> I am writing my first web application with Django.
>
> I want to create a web of registration for many subjects.
> However, each subject require different set of details to be supplied
> so I don't know which models should I have in the database.
>
> Currently I have two models:
> Registration - describes a registration (each record is a different
> subject)
> Details - describes all the possible details which may be necessary to
> register.
>
> Now, each Registration instance should contain a list of the necessary
> details, so i guess that Registration and Details are Many-To-Many
> connected.
>
> My question is - how the other model(s) which contains the actual
> details and a FK to Registration model should look like? I don't want
> to create a new model for each Registration record and place the
> necessary details hardcoded in the model fields. What if I have 30
> records in Registration table ?!

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



static files in django

2011-10-14 Thread Pulkit Mehrotra
hey i am having problem loading my static files in django 1.3

Here is my template:http://pastebin.com/nr7Z97SJ
here is my static file : http://pastebin.com/mEPYMGFt
here is my url file:http://pastebin.com/Dsz5T9zh

I have given the right address in staticfiles_dir but still the problem 
persists and the css files are also stored correctly

Please find the prob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/73yT1fwoN-YJ.
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.



Suse Linux installation

2011-10-14 Thread Andrew Johnson
I download and untar Django-1.3.1 and try to install and get:

django/Django-1.3.1> sudo python setup.py install
Traceback (most recent call last):
  File "setup.py", line 1, in ?
from distutils.core import setup
ImportError: No module named distutils.core

I don't see a file named distutils.core anywhere I look.  Did
something go wrong with my download?

-- 
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: Suse Linux installation

2011-10-14 Thread aledr
You can get it directly from the Python repo[1].
Otherwise you need python-distribute or python-setuptools to build it
(you can just install one of them with 'zypper in python-...' or
download from the same[1] repo).

[1]: http://download.opensuse.org/repositories/devel:/languages:/python/

On Fri, Oct 14, 2011 at 1:54 PM, Andrew Johnson
 wrote:
> I download and untar Django-1.3.1 and try to install and get:
>
> django/Django-1.3.1> sudo python setup.py install
> Traceback (most recent call last):
>  File "setup.py", line 1, in ?
>    from distutils.core import setup
> ImportError: No module named distutils.core
>
> I don't see a file named distutils.core anywhere I look.  Did
> something go wrong with my download?
>
> --
> 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.
>
--
[ ]'s
Aledr - Alexandre
"OpenSource Solutions for SmallBusiness Problems"

-- 
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: Suse Linux installation

2011-10-14 Thread Anoop Thomas Mathew
Check the Python Version.
Thanks,
Anoop
atm
___
Life is short, Live it hard.




On 14 October 2011 22:24, Andrew Johnson wrote:

> I download and untar Django-1.3.1 and try to install and get:
>
> django/Django-1.3.1> sudo python setup.py install
> Traceback (most recent call last):
>  File "setup.py", line 1, in ?
>from distutils.core import setup
> ImportError: No module named distutils.core
>
> I don't see a file named distutils.core anywhere I look.  Did
> something go wrong with my download?
>
> --
> 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.
>
>

-- 
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: static files in django

2011-10-14 Thread Xavier Ordoquy
Hi,

It looks like you don't have the static configured in your urls. Have a look 
here:
https://docs.djangoproject.com/en/1.3/howto/static-files/#basic-usage

Regards,
Xavier.

Le 14 oct. 2011 à 18:54, Pulkit Mehrotra a écrit :

> hey i am having problem loading my static files in django 1.3
> 
> Here is my template:http://pastebin.com/nr7Z97SJ
> here is my static file : http://pastebin.com/mEPYMGFt
> here is my url file:http://pastebin.com/Dsz5T9zh
> 
> I have given the right address in staticfiles_dir but still the problem 
> persists and the css files are also stored correctly
> 
> Please find the prob
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/73yT1fwoN-YJ.
> 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.

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



mongodb with django

2011-10-14 Thread bedros
http://mongoengine.org/

or

http://django-mongodb.org/

any ideas when django admin interface will have support for mongodb?

Thanks

Bedros

-- 
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 free web hosting list

2011-10-14 Thread Shawn Milochik
A more comprehensive and canonical list is already on the wiki:

https://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

If anything's missing then this site should probably be updated,
rather than splintering the 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.



Re: Test DB Connection

2011-10-14 Thread akshar raaj
>From what i can understand, you want to test whether you can connect to
database from your django project or not. If this is your need then try the
following:

Go to the shell using following command: python manage.py shell

On the shell, issue the following statements:

from django.db import connection
c=connection.cursor()

I you don't get any errors, it means your DATABASE_SETTINGS are correct and
you can go ahead and use your django models.
If you get an error, it means there is some error in your DATABASE_SETTINGS
and you need to rectify it before moving ahead.

Thanks,
Akshar

On Fri, Oct 14, 2011 at 4:08 PM, Julian Hodgson <
julian.of.lon...@googlemail.com> wrote:

> I've go some python modules which automatically connect to the database
> then they are loaded beacuse they  have an __init__.py with
>
> from django.core.management import setup_environ
>
> import passion.settings
>
> def loadSettings():
> s = setup_environ(passion.settings)
> print s
>
> # this should only be run from the workbox not on the server
> loadSettings()
>
> This works fine even when it can't connect.
>
> But later if I do:
>
> from passion.cg.models import *
> users = User.objects.filter( username='julian')
> print users
>
> then I get
>
> # OperationalError: (1044, "Access denied for user ''@'localhost' to
> database 'djangostack'")
> #  - [line 3]
>
> So I need a way to test the connection before trying to use the django
> models.
>
> I can just check for exceptions, but is there a better way?
>
> Julian
>
>  --
> 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.
>

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



Subquery most voted object

2011-10-14 Thread wgis
Hi,
I currently have this models:

class Place(models.Model):
()

class VoteContext(models.Model):

name = models.CharField(max_length = 15, unique = True)


class Vote(models.Model):

place = models.ForeignKey(Place, related_name='voted_place')
context = models.ForeignKey(VoteContext)
added_time = models.DateField(auto_now_add = True)
ip_address = models.IPAddressField()
vote = models.IntegerField(default = 0)

---

ie
I could have something like this in the database
ID | PLACE | CONTEXT | ... | VOTE
1 | 5 | 1 | ... |10
2 | 5 | 2 | ... | 9
3 | 5 | 3 | ... | 10
4 | 22 | 1 | ... | 10
5 | 22 | 2 | ... | 10
6 | 22 | 3 | ... | 10

---

My question is: How can I get the place with the highest votes/better
average (using information from the context 1,2 and 3)
and how can I get the place with the highest votes, let's say...
regarding the context 1?

I got stuck at the very beginning: Place.vote_set.all (...)

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-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: a django question about "python manage.py syncdb"

2011-10-14 Thread Chen Xu
I tried to delete models.py, and just have a /model subdirectory, but
"pythin manage.py syncdb" doesnt pick up the models in /models directory,
Do i need to change some configurations to tell Django to use /models
subdirectory.
Or do I need __init__.py in my /models subdirectory, I tried both, neither
works.



Thanks



On Fri, Oct 14, 2011 at 4:31 AM, Phang Mulianto  wrote:

> maybe you can try remove the models.py coz by default syncdb look for
> models.py or anything beneath models folder...but cannot do both of them...
> On Oct 14, 2011 5:49 PM, "Chen Xu"  wrote:
>
>> and when i tried "python manage.py sqlall  "  it gives empty.
>> I think is it because I am not importing  properly or something else is
>> going wrong.
>>
>>
>> Thanks
>>
>>
>>
>>
>>
>> On Fri, Oct 14, 2011 at 2:46 AM, Chen Xu  wrote:
>>
>>> I know that will work, but what I can do to just make "python manage.py
>>> syncdb" work?
>>>
>>> Thanks very much
>>>
>>>
>>> On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG wrote:
>>>
 You can also type python manage.py sqlall  and copy paste sql
 instructions in your bd

 On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  wrote:

> Hi,
> I am new to Django.
> I have installed Django and go t everything set up correctly, just
> started some easy tutorials.
>
> So when I do
> Django-admin.py startapp  blog
>
>
> it creates a /blog directory that looks like thsi
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
>
> I know in Django, when you run "python manage.py syncdb", it will look
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when
> my proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
>
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> /Models
> - __init__.py
> post.py
>
>  so in my
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
>
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
>
>
> and then when I run "python manage.py syncdb" , it doesn't create the
> table "post" for me.
>
> Could anyone please help?
>
>
>
>
> Thanks very much
> Best regards
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>

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

>>>
>>>
>>>
>>> --
>>> ⚡ Chen Xu ⚡
>>>
>>
>>
>>
>> --
>> ⚡ Chen Xu ⚡
>>
>> --
>> 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.
>>
>  --
> 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.
>



-- 
⚡ Chen Xu ⚡

-- 
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: a django question about "python manage.py syncdb"

2011-10-14 Thread Donald Stufft
You need a __init__.py in your models.py. You also need to import all your 
models into that __init__.py.

If I recall you'll also want to set

class Meta:
app_label = "the name of your package"

Because the models directory will screw up Django's ability to auto figure it 
out.  


On Saturday, October 15, 2011 at 12:32 AM, Chen Xu wrote:

> I tried to delete models.py, and just have a /model subdirectory, but "pythin 
> manage.py syncdb" doesnt pick up the models in /models directory,
> Do i need to change some configurations to tell Django to use /models 
> subdirectory.
> Or do I need __init__.py in my /models subdirectory, I tried both, neither 
> works.
>  
>  
>  
> Thanks
>  
>  
>  
> On Fri, Oct 14, 2011 at 4:31 AM, Phang Mulianto  (mailto:braveh...@gmail.com)> wrote:
> > maybe you can try remove the models.py coz by default syncdb look for 
> > models.py or anything beneath models folder...but cannot do both of them... 
> >  
> > On Oct 14, 2011 5:49 PM, "Chen Xu"  > (mailto:xuche...@gmail.com)> wrote:
> > > and when i tried "python manage.py sqlall  "  it gives empty.
> > > I think is it because I am not importing  properly or something else is 
> > > going wrong.
> > >  
> > >  
> > > Thanks
> > >  
> > >  
> > >  
> > >  
> > >  
> > > On Fri, Oct 14, 2011 at 2:46 AM, Chen Xu  > > (mailto:xuche...@gmail.com)> wrote:
> > > > I know that will work, but what I can do to just make "python manage.py 
> > > > syncdb" work?
> > > >  
> > > > Thanks very much
> > > >  
> > > >  
> > > > On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG  > > > (mailto:n.her...@gmail.com)> wrote:
> > > > > You can also type python manage.py sqlall  and copy paste 
> > > > > sql instructions in your bd
> > > > >  
> > > > > On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  > > > > (mailto:xuche...@gmail.com)> wrote:
> > > > > > Hi,  
> > > > > > I am new to Django.
> > > > > > I have installed Django and go t everything set up correctly, just 
> > > > > > started some easy tutorials.
> > > > > >  
> > > > > > So when I do  
> > > > > > Django-admin.py startapp  blog
> > > > > >  
> > > > > >  
> > > > > > it creates a /blog directory that looks like thsi
> > > > > > /blog
> > > > > > - __init__.py
> > > > > > - tests.py
> > > > > > - models.py
> > > > > > - views.py
> > > > > >  
> > > > > > I know in Django, when you run "python manage.py syncdb", it will 
> > > > > > look through models.py, and create all the table it finds.
> > > > > > However, I dont want to create all my tables in models.py, becaue 
> > > > > > when my proj get bigger, it is hard to maintain.
> > > > > > Therefore, I create a subdirectory "/Models" to store all my model
> > > > > >  
> > > > > > /blog
> > > > > > - __init__.py
> > > > > > - tests.py
> > > > > > - models.py
> > > > > > - views.py
> > > > > > /Models
> > > > > > - __init__.py
> > > > > > post.py
> > > > > >  
> > > > > >  so in my   
> > > > > > models.py: (only 2 lines)
> > > > > > from django.db import models
> > > > > > from blog.Models import post
> > > > > >  
> > > > > > in my post.py: (only 3 lines)
> > > > > > from django.db import models
> > > > > > class post(models.Model):
> > > > > >   body = models.TextField()
> > > > > >  
> > > > > >  
> > > > > > and then when I run "python manage.py syncdb" , it doesn't create 
> > > > > > the table "post" for me.
> > > > > >  
> > > > > > Could anyone please help?
> > > > > >  
> > > > > >  
> > > > > >  
> > > > > >  
> > > > > > Thanks very much
> > > > > > Best regards
> > > > > >  
> > > > > >  
> > > > > > --  
> > > > > > ⚡ Chen Xu ⚡
> > > > > > --  
> > > > > > 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 
> > > > > > (mailto:django-users@googlegroups.com).
> > > > > > To unsubscribe from this group, send email to 
> > > > > > django-users+unsubscr...@googlegroups.com 
> > > > > > (mailto:django-users%2bunsubscr...@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-users@googlegroups.com 
> > > > > (mailto:django-users@googlegroups.com).
> > > > > To unsubscribe from this group, send email to 
> > > > > django-users+unsubscr...@googlegroups.com 
> > > > > (mailto:django-users%2bunsubscr...@googlegroups.com).
> > > > > For more options, visit this group at 
> > > > > http://groups.google.com/group/django-users?hl=en.
> > > >  
> > > >  
> > > >  
> > > > --  
> > > > ⚡ Chen Xu ⚡
> > >  
> > >  
> > >  
> > > --  
> > > ⚡ Chen Xu ⚡
> > > --  
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post

Re: a django question about "python manage.py syncdb"

2011-10-14 Thread Chen Xu
thanks every one:
@Donald Stufft:  Your method eventually solves my problem, I really
appreciate it.

Thanks very much





On Fri, Oct 14, 2011 at 9:34 PM, Donald Stufft wrote:

> You need a __init__.py in your models.py. You also need to import all your
> models into that __init__.py.
>
> If I recall you'll also want to set
>
> class Meta:
> app_label = "the name of your package"
>
> Because the models directory will screw up Django's ability to auto figure
> it out.
>
> On Saturday, October 15, 2011 at 12:32 AM, Chen Xu wrote:
>
> I tried to delete models.py, and just have a /model subdirectory, but
> "pythin manage.py syncdb" doesnt pick up the models in /models directory,
> Do i need to change some configurations to tell Django to use /models
> subdirectory.
> Or do I need __init__.py in my /models subdirectory, I tried both, neither
> works.
>
>
>
> Thanks
>
>
>
> On Fri, Oct 14, 2011 at 4:31 AM, Phang Mulianto wrote:
>
> maybe you can try remove the models.py coz by default syncdb look for
> models.py or anything beneath models folder...but cannot do both of them...
>  On Oct 14, 2011 5:49 PM, "Chen Xu"  wrote:
>
> and when i tried "python manage.py sqlall  "  it gives empty.
> I think is it because I am not importing  properly or something else is
> going wrong.
>
>
> Thanks
>
>
>
>
>
> On Fri, Oct 14, 2011 at 2:46 AM, Chen Xu  wrote:
>
> I know that will work, but what I can do to just make "python manage.py
> syncdb" work?
>
> Thanks very much
>
>
> On Fri, Oct 14, 2011 at 2:37 AM, nicolas HERSOG wrote:
>
> You can also type python manage.py sqlall  and copy paste sql
> instructions in your bd
>
> On Fri, Oct 14, 2011 at 11:23 AM, Chen Xu  wrote:
>
> Hi,
> I am new to Django.
> I have installed Django and go t everything set up correctly, just started
> some easy tutorials.
>
> So when I do
> Django-admin.py startapp  blog
>
>
> it creates a /blog directory that looks like thsi
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
>
> I know in Django, when you run "python manage.py syncdb", it will look
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when my
> proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
>
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> /Models
> - __init__.py
> post.py
>
>  so in my
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
>
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
>
>
> and then when I run "python manage.py syncdb" , it doesn't create the table
> "post" for me.
>
> Could anyone please help?
>
>
>
>
> Thanks very much
> Best regards
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>
>
>  --
> 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.
>
>
>
>
> --
> ⚡ Chen Xu ⚡
>
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>
>  --
> 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.
>
>
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>
>
>  --
> 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, se