How to ForeignKey automatically add new row?

2012-01-15 Thread Tsung-Hsien
Hello, I want to connect User to Userprofile. When I create new user, the Userprofile can't automatically add new user. Should I need to write create Userprofile on view? Why the ForeignKey can't automatically add? My model as below: class Userprofile(models.Model): user = models.ForeignK

Re: {% elif %} error

2011-12-27 Thread Tsung-Hsien
Thank you all! I don't see the line "New in Django Development version." On Dec 27, 10:44 pm, Tsung-Hsien wrote: > Hi, > I want to use {% elif %} > my template: >                         {% if bookmark.hours %} >                                

{% elif %} error

2011-12-27 Thread Tsung-Hsien
Hi, I want to use {% elif %} my template: {% if bookmark.hours %} {{ bookmark.hours }} hours ago {% elif bookmark.days %} {{ bookmark.days }} days ago {% elif book

When override default setting of TinyMCE, why can't get the value of textarea?

2011-12-26 Thread Tsung-Hsien
Hi, I refer the article,https://code.djangoproject.com/wiki/ AddWYSIWYGEditor, and create textareas.js to override default setting of TinyMCE. the textarea shows new functions while creating the textareas.js. However, when I submit the data, server can't save the data. if I don't override the setti

String problem about creating user

2011-12-09 Thread Tsung-Hsien
Hello If I use register page to create user, the string of username and email displays u'' on command line, and if I create user on command line, the string of username and email display ''. the difference is one has the 'u' and the other doesn't. The important thing is: When I want to fil

Re: How to format string on I18n

2011-12-05 Thread Tsung-Hsien
already set > to UTF-8 (if applicable). > > 2011/12/5 Tsung-Hsien > > > > > > > > > > > Hello > >I get the wrong message when type a string which needed to format >

How to format string on I18n

2011-12-04 Thread Tsung-Hsien
Hello I get the wrong message when type a string which needed to format such as msgid "An inviatation was sent to %(email)s." msgstr "邀請已送到%(email)s" -- Incorrect string value: '\xE9\x82\x80\xE8\xAB\x8B...

Doesn't display any comments

2011-11-26 Thread Tsung-Hsien
I use comment of Django applicaition, and the comment page looks anything good, but when I post the comment, there is no comment displayed on the page without any problem showing. the template code: Comments {% get_comment_count for bookmarks.sharedbookmark shared_bookmark.id as c

Re: Get 500 error with Ajax on firebug

2011-11-20 Thread Tsung-Hsien
I type wrong in view.py, causing the problem. Have been solve this. On Nov 20, 2:32 am, Tsung-Hsien wrote: > The error does not show on Django, but firebug shows the error. > I refer "Django 1.0 Web Site Development" and use the jQuery code > below: > > function bookma

Get 500 error with Ajax on firebug

2011-11-20 Thread Tsung-Hsien
The error does not show on Django, but firebug shows the error. I refer "Django 1.0 Web Site Development" and use the jQuery code below: function bookmark_save() { var item = $(this).parent(); var data = { url: item.find("#id_url").val(), title: ite

How to create unique tags based on Taggit

2011-10-27 Thread Tsung-Hsien
I use Taggit to create a list of tags, and want to create unique tags of the list. I have a list as below tags=[[], [], [], [], [],[], [], []] and write this for i in range(0,len(tags)): if tags[i] not in s: s.append(tags[i]) However, the output s is same as tags. s=[[],

Weird situation about static file

2011-10-26 Thread Tsung-Hsien
I just change some style of css, but after runserver, the css is nothing change. I not only deleted the image file in the static folder, but deleted whole static folder and the website still show the image and css. only use in localhost, even doesn't deploy to server yet. I don't know why that happ

Re: How to filter arithmetic seires in loop?

2011-10-23 Thread Tsung-Hsien
Thanks your advice! However,using {% if forloop.counter % 4 == 1 %} shows problem that Exception Value: Could not parse the remainder: '%' from '%' Now, I refer http://stackoverflow.com/questions/1438486/how-to-use-math-remainder-in-django-template and change it to {%forloop.counter|add:"-1"|divis

How to filter arithmetic seires in loop?

2011-10-22 Thread Tsung-Hsien
I want to filter a loop when the number comes to 1,5,9,13,17... I use this but fail {% if forloop.counter |divisibleby range(1,100,4)%}{% endif %} How to fix it, thanks a lot !! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

How to solve the instancemethod TypeError

2011-10-16 Thread Tsung-Hsien
I have a photo page needed connecting each photo to different URL. -- The URL as below: url(r'^gallery/(?P\d+)/(?P\d+)/$', zoom_photo) The view as below: def zoom_photo(request, item_id, photo_id): item = Item.objects.get(id=item_id)

How to handle the URL

2011-10-15 Thread Tsung-Hsien
I want to build a gallery which connects to different photo sets. I have been completed the gallery main page, however, I meet two problems: 1) Use title name of cover image as the URL of photo page, but if the name include blank, then The URL is not complete. For example: the cover image named sum

Re: How to get the items of Foreign Key

2011-10-07 Thread Tsung-Hsien
On Oct 6, 11:50 pm, kenneth gonsalves wrote: > On Thu, 2011-10-06 at 23:31 -0700, Tsung-Hsien wrote: > > class Item(models.Model): > >     name = models.CharField(max_length=250) > >     description = models.TextField() > > >     class Meta: > >          

How to get the items of Foreign Key

2011-10-06 Thread Tsung-Hsien
I write a model as below: class Item(models.Model): name = models.CharField(max_length=250) description = models.TextField() class Meta: ordering = ["name"] def __unicode__(self): return self.name class Photo(models.Model): item = models.Forei

Question about Template

2011-10-05 Thread Tsung-Hsien
I want to put pictures on website and to let each row shows only four pictures, but I write the template which shows each pictures in the same row. the loop within the , I think it should include and add if syntax to do that. How to write the syntax? thanks! {% load static %} {% get_static_prefix

How TinyMCE don't displays Html tags to vistors

2011-09-19 Thread Tsung-Hsien
I've been done my admin interface with TinyMCE. However, aftering editing, I see words with HTML tags update to my website. What's a good way to solve this? Thank you! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

CSS can't load when deploy to GAE

2011-09-15 Thread Tsung-Hsien
Hi, when I runserver on my localhost, CSS can load on the web site. Before I deployed to GAE, I only change the app.yaml setting: - url: /media/admin static_dir: django/contrib/admin/media expiration: '0' to - url: /static static_dir: static expiration: '0' After I deployed to GAE, I