Re: Permission denied when saving a record with an ImageField in the model

2012-03-17 Thread Jonathan D. Baker
You need to make sure your server has write permissions on the home/projects directory. Sent from my iPhone On Mar 17, 2012, at 9:02 AM, Sithembewena Lloyd Dube wrote: > Hi all, > > I have a model with an ImageField and when I try to save a record in the > admin site, I get the following: >

Re: Word Cap Form Labels

2012-04-18 Thread Jonathan D. Baker
Not sure about django, but this is easy to do in CSS. Sent from my iPhone On Apr 18, 2012, at 11:21 PM, Lee Hinde wrote: > The default behavior for a form label is to capitalize the first letter - > 'Report name'. I'd like to capitalize the first letter of each word - 'Report > Name'. Short o

Re: Can't get model to show up in admin interface

2012-04-26 Thread Jonathan D. Baker
Perhaps the Coltrane folder needs a blank __init__.py? Sent from my iPhone On Apr 27, 2012, at 12:00 AM, Mika wrote: > I'm working through James Bennet's Practical Django Projects 2nd > edition. I have a folder called "coltrane" which has a models.py file > with the following: > > from django.

Re: outdated django book

2012-04-27 Thread Jonathan D. Baker
You need to import User from django.contrib.auth.models and login_required from django.contrib.auth.decorators. Hope this helps. Sent from my iPhone On Apr 27, 2012, at 8:09 PM, knowledge_seeker wrote: > My Django book (from the university library) said to add the label > "@login_required" to

Re: @login_required do nothing

2012-04-28 Thread Jonathan D. Baker
You have to be sure and import the module at the top of your script: from django.contrib.auth.decorators import login_required. Otherwise, it's never in scope and thus not available. Sent from my iPhone On Apr 28, 2012, at 1:00 PM, marcelo nicolet wrote: > Hi > Following the on-line docs ( >

Re: Good method to require EULA acceptance

2012-05-02 Thread Jonathan D. Baker
You could store the Eula as a boolean field on a user profile model and manage it that way. Sent from my iPhone On May 2, 2012, at 3:34 PM, BGMaster wrote: > Hi, > > I'm trying to implement acceptance of a EULA into my site registration > form. The EULA acceptance is on a separate page from t

Re: user.set_password('new password')

2012-05-18 Thread Jonathan D. Baker
Save is a method, so it needs parentheses: user.save() Sent from my iPhone On May 18, 2012, at 10:53 PM, Min Hong Tan wrote: > Hi, > > I 'm trying to change password in views.py in one of my def. > having the below code. > newpassword ="testing123" > user = User.objects.get(username__exact =

Re: How to get News by category? - GET method

2012-05-25 Thread Jonathan D. Baker
The query string parameters in your URL need to be in key=value format, such as http://127.0.0.1:8000/news/?category=music Sent from my iPhone On May 25, 2012, at 6:01 AM, enemybass wrote: > Hi. How to get News by category name? My try: http://dpaste.com/752094/ > If I click category name in t

Re: Exception Type: TypeError Exception Value: individual() takes exactly 2 arguments (1 given)

2012-11-11 Thread Jonathan D. Baker
You need to capture the id parameter in your URL by wrapping it in parentheses: ([0-9]) Sent from my iPhone On Nov 12, 2012, at 12:49 AM, muhammed riyas wrote: > Request Method:GET > Request URL:http://localhost:9744/employee/1/ > Exception Type:TypeError > Exception Value:individual() takes

Re: ignore field during form validation

2013-01-21 Thread Jonathan D. Baker
Hi Sarfraz, If your form class inherits from ModelForm, you can use a subset of fields within your form per the following documentation: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form If you're not inheriting from ModelForm, then it's a matter

Re: Django-SEO issue

2013-01-22 Thread Jonathan D. Baker
I wasn't. If anyone has a solution I'd still be interested in cleaning up the clutter and removing the backends I'm not using. On 01/22/2013 12:05 PM, Jeff Ammons wrote: > Were you able to figure out what was happening here? I'm experiencing > the same issue. > > On Friday, August 17, 2012 2:16:53

Re: Can anyone give me a suggestion or a recommendation as to how I can access the current user's username in the models.py?

2013-03-14 Thread Jonathan D. Baker
Perhaps a combination of signals and receivers would fit the bill? Models.py shouldn't be concerned with request objects. Sent from my iPhone On Mar 14, 2013, at 12:59 PM, Simon Chan wrote: > Essentially, I'm just trying to make a simple email alert system. If anyone > creates, modifies or de

Re: A really simple hosting for my Django app?

2013-06-15 Thread Jonathan D. Baker
Check out webfaction. They have a ton of documentation, great support and it's only $10/mo. Sent from my iPhone On Jun 15, 2013, at 1:32 PM, thoms wrote: > Hi there! > > I just finished my first Django app that's working great locally. I have a > PHP background, and I'm already a big fan

Re: client side tests

2013-07-15 Thread Jonathan D. Baker
Check out functional testing with selenium. Sent from my iPhone On Jul 15, 2013, at 4:00 AM, Larry Martell wrote: > There's no way, using the django unit tests, to effect something > client side, is there? > > For example, in one of my django apps the user can filter the data on > the client s

Re: django ajax runtime error - URL doesn't end in slash

2013-08-10 Thread Jonathan D. Baker
Can you paste the markup for your search form? Sent from my iPhone On Aug 10, 2013, at 11:46 AM, Robin Lery wrote: > I am practicing from a tutorial where I have reached to create a search box > with jquery and ajax. Every thing is going good, except, when i press any key > in the search, I g

Re: Is there an equivalent to JPA @embedded in django modeling

2013-10-02 Thread Jonathan D. Baker
Could you use an abstract base class to define the address fields and then inherit from that? Sent from my iPhone > On Oct 2, 2013, at 4:55 PM, Khanh Tran wrote: > > Lets say both Customer and Business have an Address. In JPA, we can store > address attributes(street,city,state,zip) directly

Re: Get memory-use serverside when rendering a view?

2013-12-12 Thread Jonathan D. Baker
his approach is >> nice because you're abstracting away the profiling code which allows you >> to easily reuse it. >> >> Hope this helps a little, >> JDB > >> -- >> Jonathan D. Baker >> Developer >> http://jonathandbaker.com > > I

Re: Trouble with Django in production server.

2014-03-01 Thread Jonathan D. Baker
Instead of hard-coding paths, check out os.path, os.abspath and os.sep (and the rest of the os module) for such needs. I usually declare a PROJECT_ROOT var at the top of my settings.py using the aforementioned os module, and then hang paths (like your db path) off of that instead of building eac