Re: def__str__(self) not working properly

2016-07-01 Thread Joey Chang
try to use __repr__ https://docs.python.org/2/reference/datamodel.html#object.__repr__ 2016-07-01 17:50 GMT+08:00 Gary Roach : > Hi all; > > I am working on the official django tutorial (https// > docs.djangoproject.com/en/1.9/intro/tutorial/02/) on the section that is > adding the choices. Spec

Re: Writing your first Django app, part 1 (1.6)

2013-12-10 Thread Joey Chang
can you share more lines you typed before. It's hard to analysis depending on just one line 2013/12/11 Suhendri > Hi, > > I'm new in Django, I'm excited with Django so I have to following the > existing tutorial to knew how to create a program with Django. > > I started with tutorial 1, Writing

Re: Three Django forms in different tabs in one template?

2013-10-24 Thread Joey Chang
I think you can try to use a base view to handle the request and distribute to sub functions. like: def base_view(request): form_type = request.REQUEST.get("form_type", "1") if form_type == "1": result = sub_view1(request) ... else: result = sub_viewn(request)

Re: django , python and ides

2013-06-03 Thread Joey Chang
+1 sublime text2. efficient. 2013/6/3 tony gair > Got to say that this looks very promising. Theres also a Django plugin > too. dddjjjannnggooo! > > > On Saturday, June 1, 2013 9:01:00 PM UTC, Doug S wrote: > >> Hey I just ran into a new opensource Python IDE that looks interesting >> that

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-30 Thread Joey Chang
you just give the user object to the form object in you view handler. some like: form = HeatingUserForm(user=request.user) or if have request POST data, you could do it like this: form = HeatingUserForm(request.POST, user=request.user) then: self.user = kwargs.pop('user') will

Re: Is unique_together case-insensitive ?

2013-05-11 Thread Joey Chang
recha > Yes, I forgot to mention > I am running Django 1.5, with database MySQL > > So, how can I change the COLLATE pattern through Django's model fields ? > If not via Django, can you show me how to change it manually ? > > > On Sat, May 11, 2013 at 1:19 PM, J

Re: Is unique_together case-insensitive ?

2013-05-11 Thread Joey Chang
What's your database engine? As i know, if your database engine was mysql, and the database's COLLATE pattern name ends with "_ci" which means case-insensitive. you should got that result. You can change the COLLATE pattern to the name which ends with "_cs" or "_bin". Wish it's useful to you 2