ValueError: cannot reindex from a duplicate axis

2016-04-23 Thread Chen
http://stackoverflow.com/questions/36809762/valueerror-cannot-reindex-from-a-duplicate-axis-while-using-pivot-table

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1ca66da6-8c31-4185-ba37-131733927a3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


New Django User

2016-04-07 Thread Chen
I'm new to Django.. I actually wanted to take inputs from a web user 
through web page and then using those inputs perform further operations. So 
does Django helps in connecting HTML, Python and PHP altogether?
How do I connect a html and python file?

I have a user login page which I can proceed with HTML and PHP very 
smoothly. After login, the recommendation part comes where using the user's 
activity some recommendations are made to the user. So how should I proceed 
with the recommendation part which is implemented in Python. How to track 
user's activity?
Please suggest. I haven't worked with Python Web Framework before.

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


ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

2016-04-13 Thread Chen
def reshape(self, students, questions, scores, q_ratings=None):
self.df.reset_index(inplace=True)
if q_ratings != None:
self.q_ratings = pd.DataFrame(self.df.pivot_table(index=questions, 
values=q_ratings))
self.q_ratings.columns= ['difficulty rating']

self.df = self.df.pivot_table(index=students, columns=questions, 
values=scores)
object1.reshape(self.df['student_id'],self.df.index,self.df['score'],self.df['question_rating'])


On calling this function, the following error occurs :

  File "C:\Users\sony\Anaconda2\lib\site-packages\pandas\core\generic.py", 
line 731, in __nonzero__
.format(self.__class__.__name__))

ValueError: The truth value of a Series is ambiguous. Use a.empty, 
a.bool(), a.item(), a.any() or a.all().


The value in dataframe is all in integers. It also have repetitive values 
of index.
Attached : CSV data 

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


Data lost by a migration for renaming a field

2018-09-08 Thread chen
Hi,

I have a model which contains a BooleanField. I changed its name to a new 
one and updated help text as well. django generates operations RemoveField 
and AddField  in sequence for those changes. As a result of running this 
migration, original data is lost. I was confused by this behavior why 
django does not generate an operation to just rename the field by executing 
ALTER TABLE. Renaming a database field name is a common task during 
development, I think django should handle this properly without developer's 
extra work to migrate data (but probably SQLite could be an exception).

I actually did nothing special to make that migration. django version is 
1.11.13 and database backend is mariadb.

Any idea about this issue?

Thanks.

Regards,
Chenxiong Qi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/847a9c72-7b7b-4eca-9624-989340ee82f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Data lost by a migration for renaming a field

2018-09-08 Thread chen


On Sunday, September 9, 2018 at 12:48:52 AM UTC+8, Jason wrote:
>
> https://docs.djangoproject.com/en/1.11/ref/migration-operations/#alterfield
>
> There are AlterField and RenameField operations available with migrations, 
> but you probably have to include them in your custom migrations.  Reason 
> being, how would django know that you're just renaming a field and not 
> deleting it and adding a new field in its place?  In other words, how would 
> django know going from 
>
> text = models.TextField()
> to
> other_name = models.TextField()
>
> is a rename operation instead of remove and add new column?
>

Hi Jason,

Thanks for explaining. It makes sense. I'm also thinking it might be much 
helpful to detect the rename as much as possible and give warning message 
about developer has to modify the migration to rename field properly. 
Alternatively, instead of detecting potential rename by django framework 
itself, it should be also helpful to add an option to makemigrations to do 
a rename migration, e.g.

./manage makemigrations --rename-field app

This new option would be useful for the case of creating a dedicated 
migration just to rename a field.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9103e0a3-1e2f-47a3-ba66-fd390cfee643%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


alert table while updating model automatically

2008-10-31 Thread Xian Chen
Hi All,

I want to know whether Django support alerting the tables automatically
while I modify the models or not.

Suppose the website has run a long time and stored lots of data. In this
case, the administrator wants to modify the model to add/remove some
properties. Does the corresponding tables in the database will be alerted
automatically?

If not, how can make it happen? The administrator has no knowledge about SQL
language. So, the administrator cannot run ALERT/DROP TABLE ...

Thanks,
Xian

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



Templaite:display li items alternatively using for

2008-10-31 Thread Xian Chen
Hi,

I want to display a list of items by using {% for item in items %}.

To make the web pages look better, I want to use two kinds of 
alternatively.

E.G item
   item

My question is how can i use the tags to implement this requirement?

Any build-in tags for this?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to rename uploaded files in FileField?

2008-11-03 Thread Chen Yinliu
I've searched this group and find some related mails, but their solutions
seem out of date, for example:
http://gulopine.gamemusic.org/2007/nov/07/customizing-filenames-without-patching/
but there is no _save_FIELD_file method there, the underline file storage
system had been refactored in 1.0 release.

so anyone who know how to do it? thanks very much.



-- 
Chen Yingliu

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



Re: django template language + greater than? does it exist?

2009-01-13 Thread Mengsong Chen
FYI,

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

On Tue, Jan 13, 2009 at 11:03 AM, Matías Costa wrote:

>
> Fast answer: No
>
> Better awswer: No, but you can get one on djangosnippets.org
>
> On Mon, Jan 12, 2009 at 2:44 PM, rabbi  wrote:
> >
> > is there a greater than method in the template language?
> > >
> >
>
> >
>

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



temporary user model

2009-01-13 Thread Mengsong Chen
Just wonder if anyone have achieved such a temporary user model to allow
unregistered user to use some features,but will clean up the data after the
session completed if the user is not going to register.

Thanks in advanced.

M

--~--~-~--~~~---~--~~
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 1.0 admin with inline model, IntegrityError when delete

2008-09-03 Thread Arnold Chen

I have upgraded to django 1.0 beta or the latest version for my
development machine. And faced IntegrityError when i delete a record
with few related records. This problem do not happen before django 1.0

A Product model and a Part model, which is a 1-to-many relationship,
(a Product can have multiple Parts). The Parts has an InlineAdmin in
Product admin, so that i can modify the Part records which belongs to
it on the same admin page.

I have created Product record, with some Part records (which belong to
the Product record) and save, it is OK.
When i delete the product record i have created. The django admin
shows a confirmation page. Say that:

Are you sure?
Are you sure you want to delete the product "My Product"? All of the
following related items will be deleted:

I answered: "Yes, I'm Sure", but it shows 1451, 'Cannot delete or
update a parent row: a foreign key constraint fails'

Do you know why? my models.py and admin.py are as follows:

--
models.py
--
class Product(models.Model):
name = models.CharField(max_length=100)

class Part(models.Model):
product = models.ForeignKey(product)
name = models.CharField(max_length=100)

--
admin.py
--
class PartInline(admin.TabularInline):
model = Part

class ProductAdmin(admin.ModelAdmin):
inlines = [PartInline]

admin.site.register(Product, ProductAdmin)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to get the current record id from django admin form?

2008-09-05 Thread Arnold Chen

I am using django version 1.0.

I have a admin with a form for custom validation. My validation is
done in def clean(self):

The problem is that I have a requirement to get the record id to check
against database for data validation. But i don't know how to do.
My model is:

class Category(models.Model):
name = models.CharField(max_length=100)
parent = models.ForeignKey('self')

The validation is to check if user selected the record itself as its
"parent", which is illogical.

I think i need to get the record id to check against database.
However, i am only able to get form values, but not the record id. Do
you have any idea?

Arnold




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



Apache with home directory Django

2008-09-25 Thread Xian Chen
Hi,

I want to run my Django app on a shared web server.

As so many people share this server, I install python and Django(1.0) under
my home directory.

How can I configure the Apache with mod_python to make the django under my
directory running?

The server administrator refused to install Django in the /usr/bin directory

Thanks,
Xian

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



Django v0.95 issue

2008-09-25 Thread Xian Chen
Hi All,

I have a problem with Django v0.95 ( I cannot convince the administrator to
install 1.0 for me.)

I got this feedback:(
AttributeError at /xianchen/ 'function' object has no attribute
'rindex' Request
Method: GET  Request URL: http://ubinet.engr.uconn.edu/xianchen/  Exception
Type: AttributeError  Exception Value: 'function' object has no attribute
'rindex'  Exception Location:
/var/lib/python-support/python2.4/django/core/urlresolvers.py
in get_mod_func, line 23
After looking up the internet, I found the urls.py should in this format
(r'^$', 'app.views.main_page'),

But, it still does not work.

Any suggestions?

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Apache, Django configuration

2009-02-09 Thread Xian Chen
Hi All,

I use mod_python to run Django on Apache.

But, I notice all of the urls that Django received are not correct. In deed,
the "/" after the domain name is truncated.

e.g. http://localhost/admin/ , Django receives "http://localhostadmin";

Why this happen?

Thanks,
Xian

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



start new thread in mod_python

2009-02-11 Thread Xian Chen
Is threading in mod_python allowed?

I design my project like this:

in the views.py, once the user click some buttons, the view function will
start new thread to run some background processes.

The site runs good by using Django owner server. But when I using
mod_python, it seems the thread do not work any more.

And the logging module cannot work in mod_python either. Django reports
'[Errno 13] Permission denied: 'my.log'' error.


Thanks,
Xian

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



fastcgi can not send url to my backend server

2009-03-15 Thread Robert Chen
Hi, all:
I used Lighttpd + fastcgi to deploy my Django project. My lighttpd
configuration is as following:

server.modules  = (
"mod_rewrite",
"mod_redirect",
"mod_alias",
"mod_access",
"mod_status",
"mod_fastcgi",
"mod_accesslog" )

server.document-root= "/var/www/lighttpd-htdocs/"

server.errorlog = "/var/log/lighttpd/error.log"

index-file.names= ( "index.php", "index.html",
"index.htm", "default.htm" )

accesslog.filename  = "/var/log/lighttpd/access.log"

url.access-deny = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py" )

server.username= "work"

server.groupname   = "work"

status.status-url  = "/server-status"
status.config-url  = "/server-config"
status.statistics-url = "/server-statistics"

fastcgi.debug = 1

$HTTP["host"] == "www.ziyoudu.com" {
server.document-root = "/home/work/clubhome/web/clubhome"

fastcgi.server = (
"/ziyoudu.fcgi" => (
"main" => (
"host" => "127.0.0.1",
"port" => 8080,
)
),
)

alias.url = (
"/medias/" => "/home/work/clubhome/web/clubhome/medias/"
)

url.rewrite-once = (
"^(/medias.*)$" => "$1",
"^/favicon\.ico$" => "/medias/favicon.ico",
"^/server-status" => "/server-status",
"^/server-config" => "/server-config",
"^/server-statistics" => "/server-statistics",
"^(/.*)$" => "/ziyoudu.fcgi$1",
)
}

The configuration is the same as that in www.djangoproject.com. But lighttpd
return 404 when I access http://www.ziyoudu.com/login/
I enabled the debug information then and found it seems that the url is
translated to a static file path. The debug infomation is:

2009-03-15 16:08:05: (response.c.221) -- splitting Request-URI
2009-03-15 16:08:05: (response.c.222) Request-URI  :  /login/
2009-03-15 16:08:05: (response.c.223) URI-scheme   :  http
2009-03-15 16:08:05: (response.c.224) URI-authority:  www.ziyoudu.com
2009-03-15 16:08:05: (response.c.225) URI-path :  /login/
2009-03-15 16:08:05: (response.c.226) URI-query:
2009-03-15 16:08:05: (response.c.221) -- splitting Request-URI
2009-03-15 16:08:05: (response.c.222) Request-URI  :  /ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.223) URI-scheme   :  http
2009-03-15 16:08:05: (response.c.224) URI-authority:  www.ziyoudu.com
2009-03-15 16:08:05: (response.c.225) URI-path :  /ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.226) URI-query:
2009-03-15 16:08:05: (response.c.276) -- sanatising URI
2009-03-15 16:08:05: (response.c.277) URI-path :  /ziyoudu.fcgi/login/
2009-03-15 16:08:05: (mod_access.c.135) -- mod_access_uri_handler called
2009-03-15 16:08:05: (response.c.391) -- before doc_root
2009-03-15 16:08:05: (response.c.392) Doc-Root :
/home/work/clubhome/web/clubhome
2009-03-15 16:08:05: (response.c.393) Rel-Path : /ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.394) Path :
2009-03-15 16:08:05: (response.c.442) -- after doc_root
2009-03-15 16:08:05: (response.c.443) Doc-Root :
/home/work/clubhome/web/clubhome
2009-03-15 16:08:05: (response.c.444) Rel-Path : /ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.445) Path :
/home/work/clubhome/web/clubhome/ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.462) -- logical -> physical
2009-03-15 16:08:05: (response.c.463) Doc-Root :
/home/work/clubhome/web/clubhome
2009-03-15 16:08:05: (response.c.464) Rel-Path : /ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.465) Path :
/home/work/clubhome/web/clubhome/ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.482) -- handling physical path
2009-03-15 16:08:05: (response.c.483) Path :
/home/work/clubhome/web/clubhome/ziyoudu.fcgi/login/
2009-03-15 16:08:05: (response.c.539) -- file not found
2009-03-15 16:08:05: (response.c.540) Path :
/home/work/clubhome/web/clubhome/ziyoudu.fcgi/login/

I know I must made a mistake somewhere. But I can not found it out. Any
suggestion?

Thanks very much.

Best Regards
Robert.

--~--~-~--~~~---~--~~
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: fastcgi can not send url to my backend server

2009-03-15 Thread Robert Chen
Yes, that's the reason, thanks very much.

I commented out "check-local" because I thought it came with "socket"
configuration. That's the mistake.

Now it woks. Thanks.

Robert.

On Sun, Mar 15, 2009 at 7:45 PM, Ramiro Morales  wrote:

>
> On Sun, Mar 15, 2009 at 8:50 AM, Robert Chen
>  wrote:
> > Hi, all:
> > I used Lighttpd + fastcgi to deploy my Django project. My lighttpd
> > configuration is as following:
> >
> >
> >   fastcgi.server = (
> >   "/ziyoudu.fcgi" => (
> >
> >   "main" => (
> >   "host" => "127.0.0.1",
> >
> >   "port" => 8080,
> >
> > [..]
> >
> > The configuration is the same as that in www.djangoproject.com. But
> lighttpd
> > return 404 when I access http://www.ziyoudu.com/login/
> > I enabled the debug information then and found it seems that the url is
> > translated to a static file path. The debug infomation is:
>
> That's because you aren't really following the documentation
> example, you are missing the "check-local" => "disable"
> directive.
>
> --
> Ramiro Morales
> http://rmorales.net
>
> >
>

--~--~-~--~~~---~--~~
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.utils.html bug?

2009-03-24 Thread Chen Jie

>>> from django.utils import html
>>> html.urlize('炳叔的这句“这不是典型的大蒜瞧不起腊八蒜,妒忌人家好吃不臭嘛。”太逗了。http://blog.donews.com/bingshu/archive/2009/03/25/1479512.aspx')
u'\u70b3\u53d4\u7684\u8fd9\u53e5\u201c\u8fd9\u4e0d\u662f\u5178\u578b
\u7684\u5927\u849c\u77a7\u4e0d\u8d77\u814a\u516b\u849c\uff0c
\u5992\u5fcc\u4eba\u5bb6\u597d\u5403\u4e0d\u81ed\u561b\u3002\u201d
\u592a\u9017\u4e86\u3002http://blog.donews.com/bingshu/archive/
2009/03/25/1479512.aspx'
>>> html.urlize('。http://blog.donews.com/bingshu/archive/2009/03/25/1479512.aspx')
u'\u3002http://blog.donews.com/bingshu/archive/
2009/03/25/1479512.aspx'
>>> html.urlize('http://blog.donews.com/bingshu/archive/2009/03/25/1479512.aspx')
u'http://blog.donews.com/bingshu/archive/
2009/03/25/1479512.aspx">http://blog.donews.com/bingshu/archive/
2009/03/25/1479512.aspx'

looks like if http is combined with a unicode char, the html.urlize
not works?

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



Re: Working for a startup.

2010-04-22 Thread Jonathan Chen
Just to add my two cents. I think the fight between FOSS vs
Proprietary is kind of a faulty argument because there is pros and
cons for both sides. Anybody who says FOSS is the best or this
Proprietary software is the best really doesn't understand the
difference between FOSS and Proprietary software. I have worked with
FOSS products and proprietary software before and they both have
interesting issues between both of them. ASP.NET in my opinion is
easier to scale.

For proprietary stuff you'll probably have better support vs FOSS
stuff generally. The cost to support FOSS products vs the cost of
buying proprietary stuff usually ends up being equal in the long run.
But I think its more important to understand as a business what are
the key use cases and see if django or asp.net will fit the features
needed. Basically, the decision between the two needs to be a business
decision rather than a technological decision. I'm all for whatever is
the best solution for the company. I think it is silly to say that
FOSS is always better. If FOSS is always better then why don't more
companies use it over Oracle or SAP or RHEL or SLES? It really needs
to be a business decision. There are some cases where windows would do
better.

Other than that I would really just mention why django is better over
asp.net. In my opinion, django has better organization and pushes for
better organization than asp.net does in general. ASP.NET MVC is kind
of behind the times versus other web frameworks, but it is catching
up. Finding django developers are a lot fewer than asp.net developers,
but I think (generally) you'll find better quality python developers
than asp.net developers. There are probably other reasons, but can't
think of them off the top of my head. Also, Python has more
applications than C# does, and django has a mascot. Where is C#
mascot? Retired!!


Jonathan C.


On Apr 22, 8:28 am, Kenneth Loafman  wrote:
> Joe Goldthwaite wrote:
> > I’ve been working for a startup for a month or so.  The main guy is
> > enthusiastic about technology.  He probably runs more applications on
> > his computer than anyone I know.  He also switched from a Windows
> > background to a Mac notebook a year ago.  He doesn’t know a lot about
> > web development or how it all works.  That’s what I’ve been helping with.
>
> > He’s interviewed a number of companies trying to find a good one to
> > develop version1 of the application.  I’ve been pushing him towards
> > Linux/Python/Django and thought I had him convinced.  The company he’s
> > thinking about going with is a .net shop.  They say they can do anything
> > but the bulk of their developers are .net.  Still, he was thinking about
> > going with this company but still having them develop in Django.
>
> > This morning we had a conference call with one of the references the
> > development company provided.  It turns out they’re a startup that’s
> > working on a different application in the same industry as us so there
> > was an affinity there.  The guy mentioned that they originally started
> > with a different company using Ruby on Rails.  He said that after the
> > other company got bogged down and wasn’t making progress, he switched to
> > the new company that we’re considering.  He said that they got the
> > project back on track and organized but ended up running into lots of
> > problems with Rails.  They talked it over and decided to rewrite
> > everything in .net.  Now he’s happy with the progress and feels like
> > .net is a superior platform and is allowing him to develop his program
> > at a lower total cost.
>
> > This has my boss worried.  Most of the people he’s been talking to are
> > from large companies.  One of them was even a high end Microsoft
> > person.  I think he’s starting to think that the Microsoft technology
> > stack might be the safer choice. He wants to get to the point of having
> > millions of users and is worried that Django wont cut it. I’m also
> > worried that if he does stick with Django, the development company might
> > blame any setbacks on Django and push for a rewrite in .net.
>
> I also work for a startup company and we are firmly entrenched in Linux,
> Django, Postgress, and other FOSS products.  We could not afford to go
> any other route.
>
> When someone asks about FOSS vs proprietary, my first question is:
> "Would Google be here at all if it had to pay MS license fees?".
>
> And the answer is NO.
>
> If you are doing web based software-as-a-service, you can serve data to
> any OS out there from Linux, Mac, pocket calculators, anything.  The
> data does not care, and the customer does not care how you got the data
> as long as it suits his needs.  There's nothing magic about Windows, and
> .NET is a lock-in trap that guarantees you'll stay with Windows,
> regardless of what the Mono guys say.
>
> ...Ken
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email

about django model save

2009-12-24 Thread chen gang
Hi,
I am really new to this tool... and need you help about this issue,
thanks in advance!

I create models.py like this,

...
class Sms_detailed(models.Model):
group = models.CharField(max_length=15)
phone_num = models.CharField(max_length=15) 
IMEI  = models.CharField(max_length=15)   
sw_ver= models.CharField(max_length=20)   
project   = models.CharField(max_length=10)   
sw_checksum = models.CharField(max_length=10) 
recv_date_time = models.DateTimeField()
raw_data = models.CharField(max_length=30)  # raw reset data
...

Then create the db
[gac...@pipi autosms]$ python manage.py sql asms
BEGIN;

CREATE TABLE "asms_sms_detailed" (
"id" integer NOT NULL PRIMARY KEY,
"group" varchar(15) NOT NULL,
"phone_num" varchar(15) NOT NULL,
"IMEI" varchar(15) NOT NULL,
"sw_ver" varchar(20) NOT NULL,
"project" varchar(10) NOT NULL,
"sw_checksum" varchar(10) NOT NULL,
"recv_date_time" datetime NOT NULL,
"raw_data" varchar(30) NOT NULL
)
;
...
COMMIT;

but when I am trying to save a object, 
sms_detailed = Sms_detailed(group='test',phone_num =
'123456',IMEI='1234',sw_ver='3.03',sw_checksum='1234',project='rh-125',recv_date_time=datetime.datetime.now(),raw_data='s1234')
>>> sms_detailed.save()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line
410, in save
self.save_base(force_insert=force_insert, force_update=force_update)
  File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line
495, in save_base
result = manager._insert(values, return_id=update_pk)
  File "/usr/lib/python2.6/site-packages/django/db/models/manager.py",
line 177, in _insert
return insert_query(self.model, values, **kwargs)
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py",
line 1087, in insert_query
return query.execute_sql(return_id)
  File
"/usr/lib/python2.6/site-packages/django/db/models/sql/subqueries.py",
line 320, in execute_sql
cursor = super(InsertQuery, self).execute_sql(None)
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py",
line 2369, in execute_sql
cursor.execute(sql, params)
  File "/usr/lib/python2.6/site-packages/django/db/backends/util.py",
line 19, in execute
return self.cursor.execute(sql, params)
  File
"/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py",
line 193, in execute
return Database.Cursor.execute(self, query, params)
OperationalError: table asms_sms_detailed has no column named phone_num


Br, Chen Gang

--

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: about django model save

2009-12-24 Thread chen gang
Hi,

thanks for the quick reply.

Actually I call "python manage.py syncdb "  and I just didn't mention it
in previous mail. I can save other type of models defined in my
models.py. Is this a bug (my poor guess)?

Br. Chen Gang

On Fri, 2009-12-25 at 03:17 +0100, ext Xia Kai(夏恺) wrote:
> Hi,
> 
> It seemed that your db is not created, try to use
> 
> python manage.py syncdb
> 
> to create the database.
> 
> manage.py sql would only print the statements which would be used to created 
> the database:
> 
> ---
> [^_^:~/msgcenter-django/msgcenter]python manage.py help sql
> Usage: manage.py sql [options] 
> 
> Prints the CREATE TABLE SQL statements for the given app name(s).
> ---
> 
> 
> 
> Xia Kai(夏恺)
> xia...@gmail.com
> http://blog.xiaket.org
> 
> --
> From: "chen gang" 
> Sent: Friday, December 25, 2009 10:02 AM
> To: 
> Subject: about django model save
> 
> > Hi,
> > I am really new to this tool... and need you help about this issue,
> > thanks in advance!
> >
> > I create models.py like this,
> >
> > ...
> > class Sms_detailed(models.Model):
> >group = models.CharField(max_length=15)
> >phone_num = models.CharField(max_length=15)
> >IMEI  = models.CharField(max_length=15)
> >sw_ver= models.CharField(max_length=20)
> >project   = models.CharField(max_length=10)
> >sw_checksum = models.CharField(max_length=10)
> >recv_date_time = models.DateTimeField()
> >raw_data = models.CharField(max_length=30)  # raw reset data
> > ...
> >
> > Then create the db
> > [gac...@pipi autosms]$ python manage.py sql asms
> > 
> 
> --
> 
> 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: about django model save

2009-12-24 Thread chen gang
Hi,

after some discussion with XIa Kai and I tried to delete the .db file
and rebuild it. it works now!


Br, Chen Gang

On Fri, 2009-12-25 at 03:53 +0100, ext Xia Kai(夏恺) wrote:
> Hi,
> 
> It seemed that you have run syncdb before your adding the phone_num to the 
> model.
> 
> As the table is already created in the database, you may have to delete the 
> table and create it again.
> 
> 
> Xia Kai(夏恺)
> xia...@gmail.com
> http://blog.xiaket.org
> 
> --
> From: "chen gang" 
> Sent: Friday, December 25, 2009 10:02 AM
> To: 
> Subject: about django model save
> 
> > Hi,
> > I am really new to this tool... and need you help about this issue,
> > thanks in advance!
> >
> > I create models.py like this,
> >
> > ...
> > class Sms_detailed(models.Model):
> >group = models.CharField(max_length=15)
> >phone_num = models.CharField(max_length=15)
> >IMEI  = models.CharField(max_length=15)
> >sw_ver= models.CharField(max_length=20)
> >project   = models.CharField(max_length=10)
> >sw_checksum = models.CharField(max_length=10)
> >recv_date_time = models.DateTimeField()
> >raw_data = models.CharField(max_length=30)  # raw reset data
> > ...
> >
> > Then create the db
> > [gac...@pipi autosms]$ python manage.py sql asms
> > BEGIN;
> > 
> > CREATE TABLE "asms_sms_detailed" (
> >"id" integer NOT NULL PRIMARY KEY,
> >"group" varchar(15) NOT NULL,
> >"phone_num" varchar(15) NOT NULL,
> >"IMEI" varchar(15) NOT NULL,
> >"sw_ver" varchar(20) NOT NULL,
> >"project" varchar(10) NOT NULL,
> >"sw_checksum" varchar(10) NOT NULL,
> >"recv_date_time" datetime NOT NULL,
> >"raw_data" varchar(30) NOT NULL
> > )
> > ;
> > ...
> > COMMIT; 
> 
> --
> 
> 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 serving static PDF file

2007-07-17 Thread Arnold Chen

Can any one please tell me how to serve a static PDF in django ? The
file is located in the server, and do not need to be created on the
fly (by using report lab). I have done it in PHP by using header, but
i just don't know how to do it with django. Thanks


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



Re: Django serving static PDF file

2007-07-17 Thread Arnold Chen

Thanks Ben,

Besides, i've found that www.lawrence.com and www.ljworld.com (which
are famous sites that use django) use a http://media.their-domain-name.com
to store the media files.
All static files, images, css are from the http://media.their-domain-name.com
server. Obviously the media subdomain is not a django environment, i
wonder if we can setup an environment like that, and can i still
upload image to the media subdomain from the django admin console?

Arnold


On Jul 17, 3:29 pm, Ben van Staveren <[EMAIL PROTECTED]> wrote:
> You're better off not doing it with Django, just make a directory
> that won't be handled by Django and stick all your static content in
> there. After all, the webserver is usually better at serving static
> files than Django is :)
>
> On 17/07/2007, at 2:26 PM, Arnold Chen wrote:
>
>
>
> > Can any one please tell me how to serve a static PDF in django ? The
> > file is located in the server, and do not need to be created on the
> > fly (by using report lab). I have done it in PHP by using header, but
> > i just don't know how to do it with django. Thanks


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



Re: Django serving static PDF file

2007-07-17 Thread Arnold Chen

Besides, i want to revise my first question as:

How to serve static file by "pushing" a PDF to client? In php, there
is a way to serve PDF by pushing the file to the client, and client to
choose "Save As" or "Open" the file directly.

Adobe reader is very slow if they run in browsers, and most of the
time, they hang the browser, so is there a way to push ?

regards,
Arnold

On Jul 17, 4:03 pm, Arnold Chen <[EMAIL PROTECTED]> wrote:
> Thanks Ben,
>
> Besides, i've found thatwww.lawrence.comandwww.ljworld.com(which
> are famous sites that use django) use ahttp://media.their-domain-name.com
> to store the media files.
> All static files, images, css are from thehttp://media.their-domain-name.com
> server. Obviously the media subdomain is not a django environment, i
> wonder if we can setup an environment like that, and can i still
> upload image to the media subdomain from the django admin console?
>
> Arnold
>
> On Jul 17, 3:29 pm, Ben van Staveren <[EMAIL PROTECTED]> wrote:
>
> > You're better off not doing it with Django, just make a directory
> > that won't be handled by Django and stick all your static content in
> > there. After all, the webserver is usually better at serving static
> > files than Django is :)
>
> > On 17/07/2007, at 2:26 PM, Arnold Chen wrote:
>
> > > Can any one please tell me how to serve a static PDF in django ? The
> > > file is located in the server, and do not need to be created on the
> > > fly (by using report lab). I have done it in PHP by using header, but
> > > i just don't know how to do it with django. Thanks


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



Using session variable in models

2007-07-25 Thread Arnold Chen

I am implementing a multi-lingual product catalog website with Django.
It is in English (default), Trad. Chinese and Simp. Chinese. I want to
let user to choose the language they want, and the system display the
corresponding product name (in the selected language).

The product class is something like

# === start class =
class Product(models.Model)
   name_en = mode.CharField()
   name_tw = mode.CharField()
   name_cn = mode.CharField()

   def get_name(self, lang="en"):
 return eval("self.name_" + lang)

# === end class =

The language preference that user has chosen will be saved in
request.session['django_language']

Of cos, i don't know how to use the get_name() function that i've
implemented, because i can't pass the lang from view or template. So,
the question is how do i get the request.session['django_language']
variable in models ? or is there any other way to achieve the desired
result?

Thanks in advance.
Arnold


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



Re: Using session variable in models

2007-07-25 Thread Arnold Chen

You know? you are superb!!!

Arnold

On Jul 25, 7:19 am, "Wolfram Kriesing" <[EMAIL PROTECTED]>
wrote:
> and i forgot, this allows you to access the property "name" of the
> object anywhere seemlessly, in the template, in the code, etc. this is
> pretty neat imho :-)
>
> wolfram
>
> On 7/25/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
>
>
>
> > after some investigation and help from the list i took this approach
> > and have to say it works great:
>
> > from django.utils import translation
>
> > @property
> > def name(self):
> > if translation.get_language()=="en":
> > return self.name_en
> > else:
> > return self.name_de
>
> > good luck
>
> > wolfram
>
> > On 7/25/07, Arnold Chen <[EMAIL PROTECTED]> wrote:
>
> > > I am implementing a multi-lingual product catalog website with Django.
> > > It is in English (default), Trad. Chinese and Simp. Chinese. I want to
> > > let user to choose the language they want, and the system display the
> > > corresponding product name (in the selected language).
>
> > > The product class is something like
>
> > > # === start class =
> > > class Product(models.Model)
> > >name_en = mode.CharField()
> > >name_tw = mode.CharField()
> > >name_cn = mode.CharField()
>
> > >def get_name(self, lang="en"):
> > >  return eval("self.name_" + lang)
>
> > > # === end class =
>
> > > The language preference that user has chosen will be saved in
> > > request.session['django_language']
>
> > > Of cos, i don't know how to use the get_name() function that i've
> > > implemented, because i can't pass the lang from view or template. So,
> > > the question is how do i get the request.session['django_language']
> > > variable in models ? or is there any other way to achieve the desired
> > > result?
>
> > > Thanks in advance.
> > > Arnold
>
> > --
> > cu
>
> > Wolfram
>
> --
> cu
>
> Wolfram


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



php fsockopen equivalent in Django

2007-09-09 Thread Arnold Chen

Dear All,

I am writing an application that require "silent" post of data to a
specific URL. I know that is a function fsockopen in PHP which can
achieve this, and i am looking for function in Django like that.

fsockopen is used to Open Internet or Unix domain socket connection.
and you can post GET, POST data to a URL silently, here is an example
code:

\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>

To know more about fsockopen :
http://www.php.net/fsockopen


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



Re: php fsockopen equivalent in Django

2007-09-09 Thread Arnold Chen

How come i don't remember using the python socket ? thanks James

On Sep 10, 1:13 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 9/9/07, Arnold Chen <[EMAIL PROTECTED]> wrote:
>
> > I am writing an application that require "silent" post of data to a
> > specific URL. I know that is a function fsockopen in PHP which can
> > achieve this, and i am looking for function in Django like that.
>
> http://docs.python.org/lib/module-socket.html
>
> Remember that "Django" is not a programming language; Django is
> written in Python, and does not try to duplicate things Python already
> handles. So when you find yourself looking for the counterpart to
> something you're used to from another language, the Python
> documentation is the best place to check.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."


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



SOMETIMES mod_python error

2007-09-11 Thread Arnold Chen

Dear all,

I am experiencing some situation that is very strange. the development
site is http://alberta.design97.com

This site is django-powered, it is up sometimes, on some computers,
you can visit this site for a preview, if you get an error, try reload
the page, usually the page will show within 5-10 times reload.

The error message that i SOMETIMES got is:

MOD_PYTHON ERROR

ProcessId:  15673
Interpreter:'alberta.design97.com'

ServerName: 'alberta.design97.com'
DocumentRoot:   '/var/www/vhosts/design97.com/subdomains/alberta/
httpdocs'

URI:'/'
Location:   '/'
Directory:  None
Filename:   '/var/www/vhosts/design97.com/subdomains/alberta/
httpdocs/'
PathInfo:   ''

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

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
1128, in _execute_target
result = object(arg)

  File "/usr/lib/python2.3/site-packages/django/core/handlers/
modpython.py", line 177, in handler
return ModPythonHandler()(req)

  File "/usr/lib/python2.3/site-packages/django/core/handlers/
modpython.py", line 150, in __call__
response = self.get_response(request)

  File "/usr/lib/python2.3/site-packages/django/core/handlers/
base.py", line 111, in get_response
return debug.technical_500_response(request, *sys.exc_info())

  File "/usr/lib/python2.3/site-packages/django/views/debug.py", line
103, in technical_500_response
pre_context_lineno, pre_context, context_line, post_context =
_get_lines_from_file(filename, lineno, 7, loader, module_name)

  File "/usr/lib/python2.3/site-packages/django/views/debug.py", line
195, in _get_lines_from_file
context_line = source[lineno].strip('\n')

IndexError: list index out of range


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



Re: SOMETIMES mod_python error

2007-09-11 Thread Arnold Chen

Yes, the server has been restarted many times

On 9月11日, 下午6時54分, Ryan K <[EMAIL PROTECTED]> wrote:
> Have you tried restarting the web server?
>
> Arnold Chen wrote:
> > Dear all,
>
> > I am experiencing some situation that is very strange. the development
> > site ishttp://alberta.design97.com
>
> > This site is django-powered, it is up sometimes, on some computers,
> > you can visit this site for a preview, if you get an error, try reload
> > the page, usually the page will show within 5-10 times reload.
>
> > The error message that i SOMETIMES got is:
>
> > MOD_PYTHON ERROR
>
> > ProcessId:  15673
> > Interpreter:'alberta.design97.com'
>
> > ServerName: 'alberta.design97.com'
> > DocumentRoot:   '/var/www/vhosts/design97.com/subdomains/alberta/
> > httpdocs'
>
> > URI:'/'
> > Location:   '/'
> > Directory:  None
> > Filename:   '/var/www/vhosts/design97.com/subdomains/alberta/
> > httpdocs/'
> > PathInfo:   ''
>
> > Phase:  'PythonHandler'
> > Handler:'django.core.handlers.modpython'
>
> > Traceback (most recent call last):
>
> >   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
> > 1537, in HandlerDispatch
> > default=default_handler, arg=req, silent=hlist.silent)
>
> >   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
> > 1229, in _process_target
> > result = _execute_target(config, req, object, arg)
>
> >   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
> > 1128, in _execute_target
> > result = object(arg)
>
> >   File "/usr/lib/python2.3/site-packages/django/core/handlers/
> > modpython.py", line 177, in handler
> > return ModPythonHandler()(req)
>
> >   File "/usr/lib/python2.3/site-packages/django/core/handlers/
> > modpython.py", line 150, in __call__
> > response = self.get_response(request)
>
> >   File "/usr/lib/python2.3/site-packages/django/core/handlers/
> > base.py", line 111, in get_response
> > return debug.technical_500_response(request, *sys.exc_info())
>
> >   File "/usr/lib/python2.3/site-packages/django/views/debug.py", line
> > 103, in technical_500_response
> > pre_context_lineno, pre_context, context_line, post_context =
> > _get_lines_from_file(filename, lineno, 7, loader, module_name)
>
> >   File "/usr/lib/python2.3/site-packages/django/views/debug.py", line
> > 195, in _get_lines_from_file
> > context_line = source[lineno].strip('\n')
>
> > IndexError: list index out of range


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



i18n/setlang no longer support GET

2007-09-20 Thread Arnold Chen

I used to use /i18n/setlang?language=zh-cn approach to change
language. However i found that the latest (as of this writing 20th
Sept, 2007) svn version django do not support calling the url using
GET, and there is a sentence in the function set_language in the
i18n.py file

"Since this view changes how the user will see the rest of the site,
it must only be accessed as a POST request."

The django website shows an example of using the convenient setlang
function and the url is:
http://www.djangoproject.com/documentation/i18n/#the-set-language-redirect-view

This example is good to demonstrate the power of the function, but the
usability is not as good as its functionality.
Imagine the user don't even know English. So, the user don't know even
he/she should click on the selection box and select.

So i use my own way showing "English | 中文 | 日文 | Français" and
hyperlinking each language to corresponding setlang URL. For example,
setlang?language=fr for Français.

I don't know why the developers change like that, and if there any one
can, please tell me the consequences of using GET (by modifying the
set_language function by myself)

Arnold


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



Using auth in model

2007-11-07 Thread Arnold Chen

I want to let users to create their own profile in django admin. And
when they save any new records, use their logged-in user id
(models.ForeignKey(User)) and override the save() function of the
model.

Is there any statement that i can use? i believe it should be
something like auth.user

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using auth in model

2007-11-07 Thread Arnold Chen

My question above can be simplified as "how to get logged-in user with
request parameter"

On Nov 8, 12:32 pm, Arnold Chen <[EMAIL PROTECTED]> wrote:
> I want to let users to create their own profile in django admin. And
> when they save any new records, use their logged-in user id
> (models.ForeignKey(User)) and override the save() function of the
> model.
>
> Is there any statement that i can use? i believe it should be
> something like auth.user
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using auth in model

2007-11-09 Thread Arnold Chen

Sorry, there is a typo mistake, my question is "how to get logged-in"
user WITHOUT request parameter.
Because i want to use it in a function in models.py

regards,
Arnold

On 11月8日, 下午8時18分, Dan Fairs <[EMAIL PROTECTED]> wrote:
> > My question above can be simplified as "how to get logged-in user with
> > request parameter"
>
> request.user will give you the logged-in user.
>
> If you want to know more about Django profile support, read the docs:
>
>http://www.djangobook.com/en/beta/chapter12/
>
> You want the profiles section, near the bottom.
>
> Cheers,
> Dan
>
> --
> Dan Fairs <[EMAIL PROTECTED]>


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



Re: ImageField Validation Error

2007-11-15 Thread Arnold Chen

I faced this problem as well, but there is a work around. I am using
django 0.97 pre (i downloaded from svn 16th Nov, 2007)

Go to c:/python2.4/lib/site-packages/django/core/validators.py
or
/usr/lib/python2.4/site-packages/django/core/validators.py , if you
are using Fedora

comment the following lines (the line numbers in my version is 186 and
187
trial_image = Image.open(StringIO(content))
trial_image.load()

Good luck

On Nov 5, 3:27 am, Matt <[EMAIL PROTECTED]> wrote:
> I've got a model with anImageField. But, when I attempt to add an
> image via the Admin interface, I receive theerrormessage: "Upload a
> valid image. The file you uploaded was either not an image or a
> corrupted image."
>
> I'm pretty sure that all of my paths are set correctly because I can
> change the field to a FileField and add an image without any problems.
> I can also successfully work with the same image field via PIL - so I
> don't think it's not an issue with the actual image file or PIL.
>
> Is this a bug or is there something I'm not doing right? I'm running
> the latest Django from SVN, PIL 1.1.6 and  Python 2.5.1 on OS X 10.5.
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Method 'allow_tags' doesn't work?

2007-11-16 Thread Arnold Chen

I also faced this problem, i have a rolled-out site, using the
allow_tags method to do a critical mission in a customized admin site.

regards,
Arnold

On Nov 16, 3:34 am, wowar <[EMAIL PROTECTED]> wrote:
> Today, after updating django to revision 6678 method 'allow_tags'
> doesn't work. Despite it is set to True I've got html code.
>
> Regards,
> WW
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cannot run django with Apache

2007-12-24 Thread Xian Chen

all of my code works well with the django server, but not for Apache


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE temp.settings
PythonDebug On
PythonPath "['/home/xian/mycode'] + sys.path"


here is the configuration in httpd.conf
my "temp" project is in "/home/xian/mycode/"

Add this line in the urls.py
(r'^$','temp.helloworld.index'),

Helloworld.py
from django.http import HttpResponse

def index(request):
return HttpResponse("Hello, Django.")

Apache works, mod_python has been installed.

I use Ubuntu 7.1

but http://localhost/temp returns

Page not found (404)
Request Method: GET
Request URL:http://localhost/temp/

Using the URLconf defined in temp.urls, Django tried these URL
patterns, in this order:

   1. ^$

The current URL, /temp/, didn't match any of these.

Any ideas?

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



Re: cannot run django with Apache

2007-12-24 Thread Xian Chen
Great & THX
On 12/25/07, Empty <[EMAIL PROTECTED]> wrote:
>
>
> > Add this line in the urls.py
> > (r'^$','temp.helloworld.index'),
> >
>
> Your url pattern is not going to match a subfolder.  Remember as you
> have it setup everything after the http://localhost/ is what will be
> sent to be matched. If you want to use /temp in apache as a sub, then
> you need also specify that in your url pattern:
>
> (r'^temp/$','temp.helloworld.index'),
>
> Michael Trier
> blog.michaeltrier.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



a conflict between django and php4

2006-09-18 Thread zhongke chen

i'm using django with apache2. if i disable php4 module of
apache2(using a2dismod php4), my django application runs well. if i
enable php4 module and log a user in, my django application gives the
following error message:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py",
line 163, in handler
return ModPythonHandler()(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py",
line 136, in __call__
response = self.get_response(req.uri, request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py",
line 59, in get_response
response = middleware_method(request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/middleware/locale.py",
line 16, in process_request
language = translation.get_language_from_request(request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/utils/translation/trans_real.py",
line 308, in get_language_from_request
lang_code = request.session.get('django_language', None)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/middleware.py",
line 35, in get
return self._session.get(key, default)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/middleware.py",
line 57, in _get_session
self._session_cache = s.get_decoded()

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/models.py",
line 65, in get_decoded
raise SuspiciousOperation, "User tampered with session cookie."

SuspiciousOperation: User tampered with session cookie.

i need to use php4 and django together, how can i solve it?appreciate any help

my system:
debian linux
kernal version 2.6.17-2-686
apache2 2.0.55-4.2
libapache2-mod-python 3.2.10-1
python 2.4.3
django 0.95

-- 
from czk.

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



Re: a conflict between django and php4

2006-09-18 Thread zhongke chen

Not the same problem.

if i enable php4, and i do not log in under django, my django app
works too. if i log in, error occurs.

On 9/19/06, Bryan Murdock <[EMAIL PROTECTED]> wrote:
>
> On 9/18/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> >
> > i'm using django with apache2. if i disable php4 module of
> > apache2(using a2dismod php4), my django application runs well. if i
> > enable php4 module and log a user in, my django application gives the
> > following error message:
> >
> > Mod_python error: "PythonHandler django.core.handlers.modpython"
> 
>
> Are you having this problem?
>
> http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp
>
> Bryan
>
> >
>


-- 
from czk.

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



Re: a conflict between django and php4

2006-09-18 Thread zhongke chen

Thanks! i solve this by removing libmhash package. but it's only a
workaround solution. i expect to see a perfect one.


On 9/19/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2006-09-19 at 12:52 +0800, zhongke chen wrote:
> > Not the same problem.
> >
> > if i enable php4, and i do not log in under django, my django app
> > works too. if i log in, error occurs.
>
> Could it possibly be a repeat of this problem:
>
> http://groups.google.com/group/django-users/browse_frm/thread/eeb44c894342d6f7/535749bbc456d296?lnk=gst&q=md5+problem&rnum=7#535749bbc456d296
>
> I'm not sure if there was ever a resolution to that one. There is
> another thread on the same list around that time (search for md5) with
> some related information, if memory serves.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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



Re: DRY in templates

2006-10-03 Thread Slowness Chen

1. refactor the blocks you want into separate templates , do something
like {%include 'block1.html'%} , {%include 'block2.html'%}. I guess
this is what you want.
or
2. "You can use as many levels of inheritance as needed."

Luis P. Mendes wrote:
> Hi,
>
> I have several applications running and each of them has its own
> template files.  They're working fine.
>
> Then, I decided that I should create another application that would
> merge all data information from each of those separated ones mentioned
> above.
>
> There were two problems to consider:
> 1- regarding data and views
> 2- regarding templates
>
> As for 1, I found a way that follows the DRY principle.  For each
> function that would be requested I joined another field as an argument.
> From: ex:  def viewListA(request):
> To:def viewListA(request, integrated = False):
> Integrated is True when the request is demanded by the global application.
> If Integrated == False, the function returns the html file corresponding
> to it; if True, it returns 'request'.
>
> So far, so good.
>
> Now, for part nr. 2.
>
> I didn't find a way not to repeat the same lines of the partial html
> files in a big global html one, for the application that merges all
> information.  My concern is only about data information that is
> presented mostly in tables.
>
> I am aware of the {% extends ... %} tag, but it can only be used once
> per file.  Otherwise, I could use that tag for each of the partial
> templates and would import the data blocks of each of them.
>
> My question is this one:  Is there a way I don't have to repeat the same
> template coding for the above illustrated example?
> 
> Luis P. Mendes


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



How to change the representation of newline?

2006-12-09 Thread zhongke chen
When I input some text with newline characters in TextField under
admin page, I found that the newline character in database is
represented as \r\n. My django site is running at linux, other program
under linux always treat newline as \n. This cause some compatible
problems. How can I change the representation of newline?

-- 
Yours, Zhongke Chen 陈忠克

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



Re: How to change the representation of newline?

2006-12-13 Thread zhongke chen
thanks a lot. problem fixed as you said.

I use Firefox under linux. does it treat newline as \r\n??

On 12/11/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> It seems that your browser treats new lines as under dos/windows. Is
> it Konqueror?
>
> I would suggest you to override the save method of your model,
> replacing new line characters to the preferred format:
>
> class MyModel(models.Model):
> body_text = models.TextField()
> ...
> def save(self):
> self.body_text = self.body_text.replace("\r\n", "\n").
> self.body_text = self.body_text.replace("\r", "\n").
> super(MyModel, self).save()
>
> Good luck!
> Aidas Bendoraitis [aka Archatas]
>
>
>
> On 12/10/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> > When I input some text with newline characters in TextField under
> > admin page, I found that the newline character in database is
> > represented as \r\n. My django site is running at linux, other program
> > under linux always treat newline as \n. This cause some compatible
> > problems. How can I change the representation of newline?
> >
> > --
> > Yours, Zhongke Chen 陈忠克
> >
> > >
> >
>
> >
>


-- 
Yours, Zhongke Chen 陈忠克

欢迎访问温州本地Linux论坛:http://groups.google.com/group/linux-wz

[EMAIL PROTECTED]/excel/ppt文件给我,请先转成PDF格式。谢谢!PLEASE
contact me using [EMAIL PROTECTED] from now on. Other mail boxes
have been deprecated. If you want to attach word/excel/powerpoint
files for me, PLEASE convert them to pdf. Thanks a lot.

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



Re: How to change the representation of newline?

2006-12-14 Thread zhongke chen
It's not my html page, but the django admin page.

the head of admin page is like this:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; lang="zh-cn" xml:lang="zh-cn" >

站点管理员



no encoding here, but lang = 'zh-cn'.

and all chinese characters in my pages and mysql are encoded in UTF-8.
Locale of my server is like this:

LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:zh:en_US:en
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=


On 12/13/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> It might be that it treats new lines as \r\n when you are using some
> windows-* encoding for your html pages. Check the source code. I would
> rather use UTF-8 in any case.
>
> Regards
> Aidas Bendoraitis [aka Archatas]
>
>

-- 
Yours, Zhongke Chen 陈忠克

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



Re: How to change the representation of newline?

2006-12-14 Thread zhongke chen
firefox shows utf-8

my firefox is 2.0

On 12/14/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> And what encoding is showed in the page info? ...when you right click
> somewhere in the page and choose "View Page Info" from the menu. Maybe
> just the default character encoding in your firefox settings is set
> wrongly?
>
> You can always override admin templates copying them into your
> custom_templates/admin directory.
>
> Regards,
> Aidas Bendoraitis
>
>
>
> On 12/14/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> > It's not my html page, but the django admin page.
> >
> > the head of admin page is like this:
> >
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > http://www.w3.org/1999/xhtml"; lang="zh-cn" xml:lang="zh-cn" >
> > 
> > 站点管理员
> >  > href="/oj/adminmedia/css/dashboard.css" />
> > 
> >
> > no encoding here, but lang = 'zh-cn'.
> >
> > and all chinese characters in my pages and mysql are encoded in UTF-8.
> > Locale of my server is like this:
> >
> > LANG=zh_CN.UTF-8
> > LANGUAGE=zh_CN:zh:en_US:en
> > LC_CTYPE="zh_CN.UTF-8"
> > LC_NUMERIC="zh_CN.UTF-8"
> > LC_TIME="zh_CN.UTF-8"
> > LC_COLLATE="zh_CN.UTF-8"
> > LC_MONETARY="zh_CN.UTF-8"
> > LC_MESSAGES="zh_CN.UTF-8"
> > LC_PAPER="zh_CN.UTF-8"
> > LC_NAME="zh_CN.UTF-8"
> > LC_ADDRESS="zh_CN.UTF-8"
> > LC_TELEPHONE="zh_CN.UTF-8"
> > LC_MEASUREMENT="zh_CN.UTF-8"
> > LC_IDENTIFICATION="zh_CN.UTF-8"
> > LC_ALL=
> >
> >
> > On 12/13/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> > > It might be that it treats new lines as \r\n when you are using some
> > > windows-* encoding for your html pages. Check the source code. I would
> > > rather use UTF-8 in any case.
> > >
> > > Regards
> > > Aidas Bendoraitis [aka Archatas]
> > >
> > >
> >
> > --
> > Yours, Zhongke Chen 陈忠克
> >
> > >
> >
>
> >
>


-- 
Yours, Zhongke Chen 陈忠克

欢迎访问温州本地Linux论坛:http://groups.google.com/group/linux-wz

[EMAIL PROTECTED]/excel/ppt文件给我,请先转成PDF格式。谢谢!PLEASE
contact me using [EMAIL PROTECTED] from now on. Other mail boxes
have been deprecated. If you want to attach word/excel/powerpoint
files for me, PLEASE convert them to pdf. Thanks a lot.

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



Re: Which is better: dreamhost or bluehost?

2006-05-10 Thread Slowness Chen

My site (SeaAboveSkyBelow.org) is running smoothly on Dreamhost.

- Original Message - 
From: "panta" <[EMAIL PROTECTED]>
To: "Django users" 
Sent: Wednesday, May 10, 2006 11:31 PM
Subject: Which is better: dreamhost or bluehost?


>
> Hi all,
> I'm going to setup a (small) site using django and I need to decide on
> a basic hosting plan.
> I'm considering both dreamhost and bluehost and I can't quite decide.
> Do you have any recommendations?
>
> Thanks in advance,
> Marco
>
>
> > 



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



use data model and database api along

2006-07-29 Thread Gennan Chen
Hi!I will like to django's ORM in my standalone app (not web app).  Do I always its admin tool to create tables? Or it can reuse the table structure I create in the db? Gen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



using legacy db system

2006-08-01 Thread Gennan Chen
Hi! All,I am new to Django and will like to use its good admin interface to build a new web app. However, we used a couple of databases on a single mysql server. So, is there any chance I can reuse them? It seems you can only have use 1 db only in the settings.  Any pro and con on designing a system spanning across a couple of dbs? It just seems more flexible an elegant. Gen-Nan Chen, PhDChief ScientistResearch and Development GroupCorTechs Labs Inc (www.cortechs.net)1020 Prospect St., #304, La Jolla, CA, 92037Tel: 1-858-459-9700 ext 16Fax: 1-858-459-9705Email: [EMAIL PROTECTED]  
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



Re: using legacy db system

2006-08-01 Thread Gennan Chen
I am with you on that.  Gen On Aug 1, 2006, at 8:23 AM, Jacob Kaplan-Moss wrote:On Aug 1, 2006, at 9:16 AM, [EMAIL PROTECTED] wrote: This might be of some help:http://code.djangoproject.com/wiki/MultipleDatabaseSupportIt's a SoC 2006 project, so the branch has yet to be merged into trunkbut he reports it as being feature-complete. It just might not be 100%stable. Actually it's not an SOC project, just a community one.I've played with the branch a bit and it's quite stable.  There's a  chance that the syntax might change slightly between now and when it  gets merged to trunk, but nothing major, I think.If you want to give it a shot and report back how it works for you,  that would help us get it rolled into trunk quicker.  Of course,  starting out on a branch might be a rocky introduction to Django, so  you might want to start with some simpler stuff with a single  database before branching out (no pun intended!)Jacob

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


customize admin

2006-08-01 Thread Gennan Chen
Hi!django's admin is pretty neat and I will like to customize it. I know there is a documentation to change its appearance. But how about I want to add a bit more function or buttons on the form. For example, I need to run some server side scripts/program after user click saving changes. How do I do that? And if I want to add some buttons on the form to run shutdown and reboot machines (this has nothing to do with db except adding a log), where is the documentation for that??   Gen-Nan Chen, PhDChief ScientistResearch and Development GroupCorTechs Labs Inc (www.cortechs.net)1020 Prospect St., #304, La Jolla, CA, 92037Tel: 1-858-459-9700 ext 16Fax: 1-858-459-9705Email: [EMAIL PROTECTED]  
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



put some initial data in the db

2006-08-02 Thread Gennan Chen
Hi!is there any way to put some initial data in the db by using "syncdb" option? Or I need to cook my own?? Gen 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



Re: put some initial data in the db

2006-08-02 Thread Gennan Chen
 Thanks for help. I did feel this hook is kind of strange since the whole idea of using model/DB API is to avoid writing SQL script. Since initial info I need to put in is some system info (such as host name, ip address...), which are not fixed, I intend to write another py file to do that instead of generating SQL dynamically. However, can I override class's __init__ function? Or I need to create a customized Manager for that?? Gen On Aug 2, 2006, at 3:38 PM, Malcolm Tredinnick wrote:On Wed, 2006-08-02 at 14:52 -0700, Gennan Chen wrote: Hi!is there any way to put some initial data in the db by using "syncdb"option? Or I need to cook my own?? http://www.djangoproject.com/documentation/model_api/#providing-initial-sql-dataRegards,Malcolm  

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


Re: put some initial data in the db

2006-08-02 Thread Gennan Chen
Thanks! Joe and Russ. I plan to do it this way. I am pretty new to django. So, i really don't want to mess it too much, such as create my own manger etc... Gen On Aug 2, 2006, at 4:45 PM, Joseph Heck wrote:You might just consider using the model objects, or even the default manipulators, to create your base objects. That's exactly what we did, and have both "initial_data.py" and "example_data.py" as a part of our build & testing process. At the start, we just have the model imports and away we go. It's not build in to the framework, but it's not hard to use either.-joeOn 8/2/06, Gennan Chen < [EMAIL PROTECTED]> wrote:   Thanks for help. I did feel this hook is kind of strange since the whole idea of using model/DB API is to avoid writing SQL script. Since initial info I need to put in is some system info (such as host name, ip address...), which are not fixed, I intend to write another py file to do that instead of generating SQL dynamically. However, can I override class's __init__ function? Or I need to create a customized Manager for that??  Gen On Aug 2, 2006, at 3:38 PM, Malcolm Tredinnick wrote: On Wed, 2006-08-02 at 14:52 -0700, Gennan Chen wrote: Hi! is there any way to put some initial data in the db by using "syncdb"option? Or I need to cook my own??   http://www.djangoproject.com/documentation/model_api/#providing-initial-sql-dataRegards,Malcolm

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


Re: Off Topic: Mac software for database design?

2006-08-05 Thread Gennan Chen
I am using Eclipse with PyDev and Quantum. It is a nice IDE. Gen On Aug 5, 2006, at 3:44 PM, [EMAIL PROTECTED] wrote:& that should have also said that while MySQL Workbench is flaky ( asyou've found out ), I haven't had any problems with MySQL admin.There's also YourSQL which is quite nice (http://yoursql.ludit.it/)--Simon

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


DateTime field milliseconds?

2006-08-08 Thread Gennan Chen
Hi!I am using MySQL as my DB and it seems datetime field did not store milliseconds. Is it the correct behavior? Any chance I can hack that/ I need Milliseconds resolution.  Gen-Nan Chen 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



django cannot connect to mysql after upgrade

2006-08-21 Thread zhongke chen

After upgrade mysql from 5.0.22 to 5.0.24, django cannot work with
mysql. The error messages as following:
Traceback (most recent call last):
  File "./manage.py", line 11, in ?
execute_manager(settings)
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 1343, in execute_manager
execute_from_command_line(action_mapping, argv)
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 1260, in execute_from_command_line
action_mapping[action]()
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 448, in syncdb
cursor = connection.cursor()
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/mysql/base.py",
line 90, in cursor
self.connection = Database.connect(**kwargs)
  File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line
75, in Connect
return Connection(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
207, in __init__
self.autocommit(False)
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you
can't run this command now")


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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



Re: django cannot connect to mysql after upgrade

2006-08-22 Thread zhongke chen

There is no MySQLdb-python package in my system. There is a package
named python-mysqldb. I reinstalled it and the problem is still the
same.

My system is debian etch, python-mysqldb is 1.2.1, python 2.3 or
2.4(both have the same problem), django 0.95 or svn(both the same).


On 8/22/06, Spike^ekipS <[EMAIL PROTECTED]> wrote:
>
> Hi, chen.
> I got the same problems after updating my system.
> Just re-install MySQLdb-python modules.
>
>
> zhongke chen wrote:
> > After upgrade mysql from 5.0.22 to 5.0.24, django cannot work with
> > mysql. The error messages as following:
> > Traceback (most recent call last):
> >   File "./manage.py", line 11, in ?
> > execute_manager(settings)
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
> > line 1343, in execute_manager
> > execute_from_command_line(action_mapping, argv)
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
> > line 1260, in execute_from_command_line
> > action_mapping[action]()
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
> > line 448, in syncdb
> > cursor = connection.cursor()
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/mysql/base.py",
> > line 90, in cursor
> > self.connection = Database.connect(**kwargs)
> >   File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line
> > 75, in Connect
> > return Connection(*args, **kwargs)
> >   File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
> > 207, in __init__
> > self.autocommit(False)
> > _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you
> > can't run this command now")
> >
> >
> > --
> > from czk.
> > My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
> > deprecated. Please contact with me using the following email address
> > from now on: [EMAIL PROTECTED]
> > If you want to attach word/excel/powerpoint files for me, please
> > convert them to pdf. because i have no money to buy ms-office.
>
>
> >
>


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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



Exception Value: no such table: django_admin_log

2006-02-18 Thread Slowness Chen

I changed my model,  ran  "python manage.py init" , "python manage.py
install myapp" , "python manage.py createsuperuser" again, and when I
logged in, the
 "Exception Value:  no such table: django_admin_log" error came up. I
checked the model's schema, there is no table django_admin_log in it.
before changing my model, I
logged in successfully.
so,the question is, when is the django_admin_log table created? how can
I created it?
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Exception Value: no such table: django_admin_log

2006-02-18 Thread Slowness Chen

BTW:  I am running on magic-removal revision 2330


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



Re: Exception Value: no such table: django_admin_log

2006-02-18 Thread Slowness Chen

Well, it seems like I should run "python manage.py install admin"
again, since admin tables are in the same database. Sorry for the
newbie question. 
in the half day', Django did impress me. great work.


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



Re: ANN: magic-removal branch merged to trunk

2006-05-02 Thread Slowness Chen

great! thanks for all the hard work.


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



Write a DRY URL configuration

2006-05-02 Thread Slowness Chen

a recipe i just added to cookbook. hope it can be a little useful :-)
http://code.djangoproject.com/wiki/CookBookMakeURLConfDRY

Question:
In a url configuration file, we use the first argument to the
patterns() function to specify a prefix to apply to each view function
, avoiding typing that out for each entry in urlpatterns. but in the
practical application, it is quite normal that only part of patterns
have the common prefix. In that case, we cann't use a prefix directly
for example:

urlpatterns = patterns( ''
 (r'^/?$',
'django.views.generic.date_based.archive_index'),
 (r'^(?P\d{4})/(?P[a-z]{3})/$',
'django.views.generic.date_based.archive_month'),
 (r'^tag/(?P\w+)/$', 'weblog.views.tag'),
  )

Answer:
All Django URL resolver needs is a urlpatterns variable in the url
configuration, which is a list of pattern objects returned by the
patterns() function. So we can do as the following to make our
configuration DRY:

urlpatterns = patterns( 'django.views.generic.date_based'
 (r'^/?$', 'archive_index'),

(r'^(?P\d{4})/(?P[a-z]{3})/$','archive_month'),

  )

urlpatterns += patterns('weblog.views',
 (r'^tag/(?P\w+)/$', 'tag'),   
  )


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



Re: Write a DRY URL configuration

2006-05-02 Thread Slowness Chen

Sorry, there are two typos:
 urlpatterns = patterns( ''
should be
 urlpatterns = patterns( '' ,
and
 urlpatterns = patterns( 'django.views.generic.date_based'
should be
 urlpatterns = patterns( 'django.views.generic.date_based' ,


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



Custom Unique Registration Number Required

2023-04-05 Thread chen...@gmail.com
Good day all

I am new to django and I need assistance where I can make a unique 
registration number via model with the following format

*ch2023ed0213* where 

*'ch'* stands for abbreviated school name,
*'2023'* year of programme,
*'ed'* for department and 
*'0213'* student unique number..

Urls Link or recorded tutorials are welcome.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/51fe2ab2-c60b-4044-80b6-139cc70ed229n%40googlegroups.com.


Multiuser Login and Registration required

2023-05-21 Thread chen...@gmail.com
I need a tutorial from scratch on how new Users can register and login 
having different forms for HOD, Staff and Student. 

I need tutorial on Multiusers

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eba30d6c-8bcc-4642-a8a2-0ddcbaf6c8adn%40googlegroups.com.


Re: What Can I use?

2012-02-11 Thread Chen Xu
For those packages, I wonder where I can find a demo about how they look ?

Thanks very much
Best regards

On Sat, Feb 11, 2012 at 8:24 AM, Kevin Harvey  wrote:

> I always look at djangopackages.com for questions like this:
> http://djangopackages.com/grids/g/commenting/
>
>  --
> 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/-/Ber8mjS00bwJ.
>
> 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: Use STATIC_URL in templates

2012-09-12 Thread Chao Chen
hi ,in the Django files you can read the  docs/howto/static-files.txt

On Wed, Sep 12, 2012 at 10:12 PM, Axel Aguilar  wrote:

> Hello, I'm pretty new with django, exactly the same than with python, and
> after reading a few tutorials and make a very simple django site, I have a
> django/python question...
>
>
> I made this script in python:
>
> 
>
> import os
> import random
>
> url
> ='/home/usuario/django/projects/volei/volei/static/img/stories/fotos_jugadoras/'
>
> directorios = os.listdir(url)
>
> lista_ficheros = []
> for direc in directorios:
> url_ficheros = url+direc
> lista_ficheros.extend(os.listdir(url_ficheros))
>
> r = random.choice(lista_ficheros)
>
> 
>
> And it do exactly what I want, get a pic at random from a few folders.
>
> Ok, I have a few templates, and all of them inherit from base.html, and in
> base.html I want to add this random pics...
>
> I think the script goes in the view.py, but I don't know how it can be
> since no view goes directly (and at same time all indirectly) they end in
> base.html... I tried to put all the script in {% %} in the base.html, but
> it doen't work..
>
>
> I will explain briefly what I want to do only in case django or python
> have a easier way to do:
> get random image from a tree folder like this:
> folder/subfolder1/img.jpg
> folder/subfolder2/img2.jpg
> folder/subfolder3/img3.jpg
>
> I have an slide, and only showing one at once, so the idea was every time
> slide goes to show an image, it will get it from the random script...
>
> I don't know if I explain myself.. ^^'
>
> Thanks in advance!
>
> --
> 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/-/T71GlSb01dwJ.
> 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.
>



-- 
幻想是一种生命!minixer

-- 
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: In unitTest, GET Formset returns 302 instead of 200

2011-09-07 Thread Xinlei CHEN
@Malcolm, Sorry It should be some bad pastes :(

Finally, I have solved the problem using the following 2 lines:

c = Client()
c.login(username='alex...@e.com', password='alex')

In fact, I can't login in with the following code
self.client.login(username='alex...@e.com', password='alex')

I don't know why. So if anyone knows the reason, why not share it without us
:)

Xinlei

On 7 September 2011 16:44, Malcolm Box  wrote:

> On 7 September 2011 11:52, MATHIEU  wrote:
>
>> For the GET method, I have tried the following code:
>> 
>>def test_patron_phone_get_form(self):
>>self.client.login(usernamer='alex...@e.com',
>> password='alex')
>>response = self.client.get(reverse('patron_edit_phone'))
>>self.assertEquals(response.status_code, 200)
>> 
>> But this doesn't work. Instead of getting a status_code=200, I get a
>> status_code=302. Why?
>>
>
> If this is a cut'n'paste of your code, you have a typo in the
> self.client.login() call - you're passing "usernamer" not "username"
>
> Malcolm
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Question about losing port number.

2011-09-26 Thread Chen Xu
I have a general question about  PHP:
So basically I have a link, and I want the href to be absolute., so I
do 'https://' . $_SERVER['HTTP_HOST'] . '/login' ; this gives me
https://127.0.0.1/login on my local; however, what i really want is
https://127.0.0.1:9090/login, it is missing ":9090".

Could anyone please help?

-- 
⚡ 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: Question about losing port number.

2011-09-26 Thread Chen Xu
Thx, but $_SERVER['SERVER_PORT'] doesn't give me 9090, it gives me 80.

On Mon, Sep 26, 2011 at 12:33 PM, Kurtis Mullins
wrote:

> Umm, I'm kinda new here so I'm not sure if this is the right place for that
> kind of a question. But, you could easily include $_SERVER['SERVER_PORT'] in
> there
> Source: http://php.net/manual/en/reserved.variables.server.php
>
>
> On Mon, Sep 26, 2011 at 3:30 PM, Chen Xu  wrote:
>
>> I have a general question about  PHP:
>> So basically I have a link, and I want the href to be absolute., so I
>> do 'https://' . $_SERVER['HTTP_HOST'] . '/login' ; this gives me
>> https://127.0.0.1/login on my local; however, what i really want is
>> https://127.0.0.1:9090/login, it is missing ":9090".
>>
>> Could anyone please help?
>>
>> --
>> ⚡ 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.



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

does php code works in Django

2011-10-20 Thread Chen Xu
Hi, everyone:
I am new to Django, does anyone know whether php code works in Django?

Thanks

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



How to add extra fields to User table

2011-10-23 Thread Chen Xu
Hi, Every one:
I am trying to create a user registration form.
The default of User table has limited number of fields, but I want to add
more into it.
Therefore, I am wondering what is the better way to do it? Creating another
UserProfile class, and adding  "AUTH_PROFILE_MODULE = account.UserProfile",
or using Model inheritance?

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.



question about django-admin.py

2011-12-25 Thread Chen Xu
Hi, everyone:
Does anyone run the following command recently:

django-admin.py startproject project


It does not create what the django document says:
it creates somehting like:

project/
__init__.py
manage.py
settings.py
urls.py
project/
__init__.py
manage.py
settings.py
urls.py


it is like nested and duplicated directory.


Thanks


-- 
⚡ 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: question about django-admin.py

2011-12-25 Thread Chen Xu
No, I made a mistake in my previous email:
It generates something like:

project/
__init__.py
manage.py
settings.py
urls.py
project/
__init__.py
wsgi.py
settings.py
urls.py


It seems like some changes have been made to the most recent django version?


Thanks


On Sun, Dec 25, 2011 at 3:45 AM, 软刀  wrote:

> I don't know why u get this
> I run it well
>
> maybe u can reinstall it
>
> --
> 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.



Since Django has its own database schema, can we still use sqlalchemy instead?

2012-01-07 Thread Chen Xu
Hi, everyone:

Since Django has its own database schema, can we still use sqlalchemy
instead?


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.



Could someone who has experience on both Django and Bottle please tell me what are the some differences between those two

2012-01-08 Thread Chen Xu
Hi, everyone:
Could someone who has experience on both Django and Bottle please tell me
what are the some differences between those two?


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.



Does anyone know any blogs that write about how to quickly install and deploy a django application on Amazon EC2?

2012-01-11 Thread Chen Xu
Hi, everyone:
Does anyone know any blogs that write about how to quickly install and
deploy a django application on Amazon EC2?


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.



Customize "This field is required" message.

2012-01-16 Thread Chen Xu
Hi, everyone:
I created a django form, when I validate it,  the empty field that can not
be none shows error message "This field is required." Is there a way to
tell which filed is required instead of just saying "This field is
required." in general? Ex: Username is required.

Thanks


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



Could someone please give some suggestions about how to set up email sending settings on production.

2012-01-18 Thread Chen Xu
Hi, everyone:

Could someone please give some suggestions about how to set up email
sending settings on production.

I know on local, you can do  either:
python -m smtpd -n -c DebuggingServer localhost:1025

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025

and then email will be printed on the terminal

or
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'm...@gmail.com'
EMAIL_HOST_PASSWORD = 'pw'

but I dont want to use gmail account to send emails on production.

Therefore, could someone 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.



Does Django provide a function that can get the base_url. Ex: http://127.0.0.1:8000/ if on local, www.example.com if on prod?

2012-01-21 Thread Chen Xu
Hi, everyone:
Does Django provide a function that can get the base_url. Ex:
http://127.0.0.1:8000/  if on local, www.example.com if on prod?


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.



Question mark in Django URL Mapping

2012-01-26 Thread Chen Xu
When I type the following as the normal python function, it returns the
correct things:

>>> pattern =
re.compile(r'^account_activation\?user_id=(?P[0-9]+)&auth_key=(?P[0-9a-zA-Z]+)$')
>>> match =
pattern.match("account_activation?user_id=36&auth_key=f9717d96aa4e3452a47955225a60862d07119702")
>>> match.groupdict()

{'auth_key': 'f9717d96aa4e3452a47955225a60862d07119702', 'user_id': '36'}

However, when I do this in the Django URL mapping:

url(r'^account_activation?user_id=(?P[0-9]+)&auth_key=(?P[0-9a-zA-Z]+)$',
  'activate_registration'),

It seems like the question mark is causing the url mapping not found issue.


Does anyone know why.



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.



how to show the text line number in the left of the textarea

2012-11-21 Thread jianhui chen
Hi all,
I was wondering how can I show the text line numbers in the left of the
text area.
The result is somehow like this:
1  this is first line.
2  this is second line.
;

The number is in the outside of the box, and it is automatically
displayed when the user change the line.
 By the way, I an new comer in django and learning this
http://www.djangobook.com/en/2.0/index.html now. Is there any source
teaching the interactive response in the web, expecially in text editing?

Jimmy

-- 
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: Error: No module named books

2012-11-29 Thread jianhui chen
I am learning django book too. Do you check the output of error.?
Generally, there are hint like ValueError in the output.

On Wednesday, November 28, 2012, Chris Recher wrote:

> Hi all,
>
> I'm working through the Django book and I've run into an error that wasn't
> predicted. I've got a project called mysite. I used "python manage.py
> startapp books" to create an app called books inside of it. I added a few
> models to the models.py file inside books, then tried to use "python
> manage.py validate". I got "Error: No module named books" in return.
> __init__.py is perfectly intact in both the second mysite directory and the
> books directory. I've added mysite.books to INSTALLED_APPS. All the results
> I could find searching for this problem deal with someone that's made a
> spelling mistake somewhere. I've been through my files multiple times, and
> my spelling is pristine. I figure I'm making an obvious, beginner's mistake
> - could anyone help?
>
> --
> 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/-/5gaeHt1dGtwJ.
> To post to this group, send email to 
> django-users@googlegroups.com 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com  '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.
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: strangle url error in django with google app engine

2013-01-08 Thread jianhui chen
The problem is solved. Thanks.


On Mon, Jan 7, 2013 at 10:02 AM, Daniel Roseman wrote:

> On Monday, 7 January 2013 13:54:59 UTC, jianhui chen wrote:
>
>> Hi all.
>>I use djangoappengine http://www.allbuttonspressed.**
>> com/projects/djangoappengine#**zip-packages<http://www.allbuttonspressed.com/projects/djangoappengine#zip-packages>to
>>  manage google app engine.
>>I test a very simple project:
>>url.py:
>>from django.conf.urls.defaults import *
>> from shape_practice.views import introduction
>> handler500 = 'djangotoolbox.errorviews.**server_error'
>>
>> urlpatterns = patterns('',
>> ('^_ah/warmup$', 'djangoappengine.views.warmup'**),
>>  (r'^introduction/$', introduction),
>> )
>>
>> views.py:
>>
>> from django.conf import settings
>> from django.http import HttpResponse
>> from django.utils.importlib import import_module
>> from django.template import loader, Context, RequestContext
>>
>> def introduction(request):
>> t = loader.get_template('**introduction.html')
>> c = Context({})
>> return HttpResponse(t.render(c))
>>
>> but when I type 
>> http://127.0.0.1:8000/**introduction/<http://127.0.0.1:8000/introduction/>. 
>> The browser doesn't show "introduction.html", but another "html", let's
>> say A.html. But A.html can't be found in the urlpatterns. Anywhere else can
>> set .html file?
>> Another strange thing is that: in the url.py file, I can use "from
>> shape_practice.views import introduction", but I can't use
>> shape_practice.views.**introduction which has an "shape_practice
>> undefined error"
>>
>> Thanks.
>>
>>
>>
> You should ask App Engine questions on the App Engine users group.
> Presumably you have something in your app.yaml file which is sending the
> user to static page rather than the Django app.
> If you don't import shape_practice, you can't reference it.
> --
> 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/-/GoDD8oHllVEJ.
> 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.



show an image in django

2013-01-08 Thread jianhui chen
Hi all,
I want to show an image in project in which the folder DIR looks like this:
images/a.jpg
templates/introduction.html

In introduction.html I use


It can show image correctly when I open the "introduction.html" directly
using firefox, but it shows ""GET /images/gauge_example.jpg HTTP/1.1" 404 "
when I open it in http://127.0.0.1:8000/introduction/, and there is no
image in the webpage.

I used the last method in
http://stackoverflow.com/questions/2148738/cannot-get-images-to-display-in-simple-django-site.
But it doesn't work.

Could anyone give me some suggestions?

jianhui

-- 
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: Can't set static file directory.

2013-01-08 Thread jianhui chen
Hi,
   I am not to interrupt your question, actually I have the same problems
as you. It seems that Django comers suffer this problem so much.
   I use Manager Static File as a guide, but still has problem.
   1, Put your static files somewhere that staticfiles will find them
  I set following in the setting.py
  STATIC_URL = '/static/'

 # Additional locations of static files
STATICFILES_DIRS = (
   # Put strings here, like "/home/html/static" or
"C:/www/django/static".
   # Always use forward slashes, even on Windows.
   # Don't forget to use absolute paths, not relative paths.
   "E:/code/python/djangoBook/django-testapp-develop/static"  #this is
only used in my local test
  )
   2, Make sure that django.contrib.staticfiles is included in your
INSTALLED_APPS
.
  So I set that:
   INSTALLED_APPS = (
#'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.staticfiles',   #this
'djangotoolbox',
'autoload',
'dbindexer',
'shape_practice',

# djangoappengine should come last, so it can override a few manage.py
commands
'djangoappengine',

)
   TEMPLATE_CONTEXT_PROCESSORS = (
 'django.contrib.auth.context_processors.auth',
   'django.core.context_processors.request',
   'django.core.context_processors.media',
'django.core.context_processors.static',  #this
 )
  3, You’ll probably need to refer to these files in your templates.
   So I did this:

  

  And, so someone pointed out that : using
RequestContext,
so I dit that
  def introduction(request):
t = loader.get_template('introduction.html')
c = RequestContext(request, {})   #this
return HttpResponse(t.render(c))

  The problem is that when I comment out
"E:/code/python/djangoBook/django-testapp-develop/static" in the
STATICFILES_DIRS , it has an error :

"NetworkError: 500  -
http://127.0.0.1:8000/static/images/gauge_example.jpg";. When I didn't
commented out, it works. So I think STATICFILES_DIRS and STATIC_URL
actually works in

my app, the problem is that how to set it to the correct path. In my
case, I want to STATIC_URL can find my "static" folder which is in the
project home directory.

  I was puzzled by this problem many days, right now I have no way but
to use local folder
"E:/code/python/djangoBook/django-testapp-develop/static" to code and
test in my PC.

  Thanks.

Jianhui








On Sat, Jan 5, 2013 at 1:38 PM, Mārtiņš Jakubovičs <
martins.jakubov...@gmail.com> wrote:

> Hello.
>
> I try a lot of things and can't understand, why not working STATIC_ROOT
> and MEDIA_ROOT in settings.py.
>
> I want, that all my media and static folders is in different place that
> python files, so I set media, static and templates to different place.
> Templates TEMPLATE_DIRS works well, bet MEDIA_ROOT and STATIC_ROOT not.
>
> I try setup like this:
>
> /home/domain/www/my_proj/ there is project folder and all apps, and there
> I place my htdocs folder, in which is static, templates and media folders.
>
> When i set in STATIC_ROOT = '/home/domain/www/my_proj/htdocs/static'
>
> In apache error log i got:
>
> File does not exist: /home/domain/www/my_proj/my_proj/static
>
> I don't get, why django don't want to take new setting...
>
> I use django 1.4.
>
> Thanks.
>
> --
> 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/-/crL9a25SIWMJ.
> 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: show an image in django

2013-01-09 Thread jianhui chen
My setting.py is:
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *

import os

# Activate django-dbindexer for the default database
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
AUTOLOAD_SITECONF = 'indexes'

SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'

INSTALLED_APPS = (
#'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.staticfiles',
'djangotoolbox',
'autoload',
'dbindexer',
'shape_practice',

# djangoappengine should come last, so it can override a few manage.py
commands
'djangoappengine',

)

MIDDLEWARE_CLASSES = (
# This loads the index definitions, so it has to come first
'autoload.middleware.AutoloadMiddleware',

'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
)

# This test runner captures stdout and associates tracebacks with their
# corresponding output. Helps a lot with print-debugging.
TEST_RUNNER = 'djangotoolbox.test.CapturingTestSuiteRunner'

ADMIN_MEDIA_PREFIX = '/media/admin/'
TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),)

ROOT_URLCONF = 'urls'
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"E:/code/python/djangoBook/django-testapp-develop/static",  #this only
used for local debug
)

and I use STATIC_URL in the html

But, it must be something wrong in my setting.py since the project can't
find the image.
Any suggestions? Thanks.



On Tue, Jan 8, 2013 at 4:00 PM, Mario Gudelj  wrote:

> Try removing .. from the path. Also make sure your static path is set
> correctly in settings.py
> On 9 Jan, 2013 1:42 AM, "jianhui chen"  wrote:
>
>> Hi all,
>> I want to show an image in project in which the folder DIR looks like
>> this:
>> images/a.jpg
>> templates/introduction.html
>>
>> In introduction.html I use
>> 
>>
>> It can show image correctly when I open the "introduction.html" directly
>> using firefox, but it shows ""GET /images/gauge_example.jpg HTTP/1.1" 404 "
>> when I open it in http://127.0.0.1:8000/introduction/, and there is no
>> image in the webpage.
>>
>> I used the last method in
>> http://stackoverflow.com/questions/2148738/cannot-get-images-to-display-in-simple-django-site.
>>  But it doesn't work.
>>
>> Could anyone give me some suggestions?
>>
>> jianhui
>>
>>
>>
>>
>>
>>  --
>> 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.
>

-- 
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 realtime output to browser

2013-01-10 Thread ximin chen
I 'm trying to output something to browser in real-time. I started a 
subprocess.Popen() by django in server side, and I want to redirect these 
output from Popen to browser in real-time way. How to do that? Thanks!

-- 
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/-/F3Kfe5gO4j0J.
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: show an image in django

2013-01-12 Thread jianhui chen
Really thanks your help. Finally, I find the problem is not in django
settings, but in google engine settings.
By trying many methods, my problem problem is solved by this way.
add
- url: /static
  static_dir: static  #my static folder is in the root of the project
  expiration: '0'
to app.yaml.

and I run command :

./manage.py collectstatic

before I update file to google app engine, but I don't whether this
command is necessary for the static issue.




On Thu, Jan 10, 2013 at 5:39 PM, @jeffblack360 wrote:

> I think your configuration should allow you to hit your image from your
> browser via the following link:
>
> http://localhost:8000/static/images/gauge_example.jpg
>
> If that works change your replace {{STATIC_URL}} with '/static/'...
>
>  = "390" height = "225" />
>
>
> On Tuesday, January 8, 2013 8:41:55 AM UTC-6, jianhui chen wrote:
>>
>> Hi all,
>> I want to show an image in project in which the folder DIR looks like
>> this:
>> images/a.jpg
>> templates/introduction.html
>>
>> In introduction.html I use
>> 
>>
>> It can show image correctly when I open the "introduction.html" directly
>> using firefox, but it shows ""GET /images/gauge_example.jpg HTTP/1.1" 404 "
>> when I open it in 
>> http://127.0.0.1:8000/**introduction/<http://127.0.0.1:8000/introduction/>,
>> and there is no image in the webpage.
>>
>> I used the last method in http://stackoverflow.com/**
>> questions/2148738/cannot-get-**images-to-display-in-simple-**django-site<http://stackoverflow.com/questions/2148738/cannot-get-images-to-display-in-simple-django-site>.
>>  But it doesn't work.
>>
>> Could anyone give me some suggestions?
>>
>> jianhui
>>
>>
>>
>>
>>
>>  --
> 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/-/AO-VKasUjWcJ.
>
> 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.



database query error:Subqueries are not supported (yet)

2013-01-14 Thread jianhui chen
Hi all,
There is an Subqueries are not supported (yet) error when I use
"filter" function in databade.
First, I create a database based in models.py:
class ImageItem(models.Model):
name = models.CharField(max_length = 100)
depthOffset = models.FloatField()
depthResize = models.FloatField()
focalLength = models.FloatField()
sensorWidth = models.FloatField()

def __str__(self):
return self.name
def Meta():
ordering = ["name"]

class PixelPosition(models.Model):
xPos = models.FloatField()
yPos = models.FloatField()
depth = models.FloatField()
normalX = models.FloatField()
normalY = models.FloatField()
normalZ = models.FloatField()
imageItem = models.ForeignKey(ImageItem)

   Then I create some data and save.
   Finally I query the database.
1, ps = PixelPosition.objects.all() , no error, I can use ps[0], ps[1]
 but when use 2, pixels = PixelPosition.objects.filter( imageItem =
imageItem), I can't use pixels[0],.. it has an DatabaseError: Subqueries
are not supported (yet).
 I check the type of ps and pixels, both of them is class
'django.db.models.query.QuerySet'.I don't understand why the result of
PixelPosition.objects.filter() has this error.
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.



Model object save gives Warning: Data truncated for column

2013-01-14 Thread Chen Xu
Hi Everyone,
I am new to Django, I am currently converting my site from php to Django. I
have already have my database (all the tables) setup when I wrote in php;
now when I convert to Django, I am basically matching each column with the
existing column. After I finished doing this, I try to create an object,
and doing a .save()  gives me Warning: Data truncated for column
''. However, I checked, the length of my string did not excess
the limit.

Could anyone help?


Thanks




-- 
⚡ 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: Model object save gives Warning: Data truncated for column

2013-01-15 Thread Chen Xu
I am using my existing mysql db. I found out that if I have an enum and try
to insert a value not present in the enum this error will occur.

However, my problem occurs on a TimeField. I created this field using
phpMyAdmin, it is a timestamp, and default is current time. Therefore, I
did the following in my Django model:

message_create_time = models.TimeField(auto_now_add=True)

When I create an object, and save, it gives me:

Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Python/2.7/site-packages/django/db/models/base.py", line
463, in save
self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
  File "/Library/Python/2.7/site-packages/django/db/models/base.py", line
551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk,
using=using, raw=raw)
  File "/Library/Python/2.7/site-packages/django/db/models/manager.py",
line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
  File "/Library/Python/2.7/site-packages/django/db/models/query.py", line
1593, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
  File
"/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line
912, in execute_sql
cursor.execute(sql, params)
  File "/Library/Python/2.7/site-packages/django/db/backends/util.py", line
40, in execute
return self.cursor.execute(sql, params)
  File
"/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line
114, in execute
return self.cursor.execute(query, args)
  File
"/Library/Python/2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg/MySQLdb/cursors.py",
line 203, in execute
if not self._defer_warnings: self._warning_check()
  File
"/Library/Python/2.7/site-packages/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg/MySQLdb/cursors.py",
line 117, in _warning_check
warn(w[-1], self.Warning, 3)
Warning: Data truncated for column 'message_create_time' at row 1


However if I change it to :
message_create_time = models.DateTimeField()


It works perfectly.

Any ideas?

Thanks in advance




On Tue, Jan 15, 2013 at 7:32 AM, Bill Freeman  wrote:

> Does the field in question have "max_length" specified (assuming that it
> is a character field or a sub class)?  Does introspecting the database with
> the database's tools indicate that the corresponding field has that size?
> Was the database created using Django's syncdb, or are you attempting to
> use an existing database.  Which database engine are you using (e,g.;
> PostgreSQL, MySQL, etc. - different people will have insights into
> different back ends)?  Is a stack trace printed - if so, provide it for
> us?  At least, what is the exact text of the error message?
>
> Bill
>
> On Tue, Jan 15, 2013 at 1:19 AM, Chen Xu  wrote:
>
>> Hi Everyone,
>> I am new to Django, I am currently converting my site from php to Django.
>> I have already have my database (all the tables) setup when I wrote in php;
>> now when I convert to Django, I am basically matching each column with the
>> existing column. After I finished doing this, I try to create an object,
>> and doing a .save()  gives me Warning: Data truncated for column
>> ''. However, I checked, the length of my string did not excess
>> the limit.
>>
>> Could anyone help?
>>
>>
>> Thanks
>>
>>
>>
>>
>> --
>> ⚡ 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.



  1   2   3   >