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 each path 
individually.

Glad you figured it out.

Sent from my iPhone

> On Mar 1, 2014, at 5:41 PM, Omar Acevedo  wrote:
> 
> To see if it worked, and yes it did!
> So, I'm just having trouble with the paths.
> I'm using a virtual environment.
> So I guess I'll have to deal with the paths.
> Thank you a lot anyways!!! :)
> 
> 
>> On Sat, Mar 1, 2014 at 8:39 PM, Omar Acevedo  wrote:
>> I explicitly wrote '/home/catacafe/.env/env/lib/python2.7/db.sqlite3' in the 
>> NAME option of the DATABASES dictionary.
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAH_X0gMnjh%2BOy5AQC2rw_LtKEjnWU-YVY_yBH3AzTMoSP%2BCiXw%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67FC5368-10B8-4534-A059-FE1CD467CB26%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


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

2013-12-12 Thread Jonathan D. Baker
There definitely could already be middleware that accomplishes this (I've never 
looked). Even if you end up writing your own, I think you'll enjoy the process 
of grokking the django request/response cycle and seeing how powerful 
middleware can be.

Good luck with the task, and cheers.

Sent from my iPhone

> On Dec 12, 2013, at 8:08 PM, Christopher Welborn <cjwelb...@live.com> wrote:
> 
>> On 12/12/2013 06:19 PM, Jonathan Baker wrote:
>> Django is just Python, after all, so you can use the same approach that
>> you would in "regular python scripts". "when a view is rendered" is a
>> pretty vague description of what you're aiming to profile. If your start
>> point is the request coming in to Django, and your stop point is the
>> rendered response exiting Django, then I'd write a piece of custom
>> middleware. If, on the other hand, you're aiming to profile a specific
>> method of a view (like rendering a template), then you'll want to target
>> the method itself. You could do this with a decorator if you're using
>> FBVs, or a abstract base class if you're using CBVs. This 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 appreciate your response, instead of using a lot of third-party apps
> I have written everything on my site from scratch to get things
> exactly the way I want them. I was actually hoping for a third-party
> solution for this one, but if it takes me writing my own middleware
> then thats just what I'll do. It is the whole request and response I
> am trying to look at, but finer grain control would be good too.
> 
> Thanks again, I'm going to study up on middleware.
> -- 
> 
> - Christopher Welborn <cjwelb...@live.com>
>  http://welbornprod.com
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/l8dtmt%241lm%241%40ger.gmane.org.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2684D8A9-2802-49D4-8506-006C154CA52E%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


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 inside Customer and 
> Business using @Embedded annotation.Is there an equivalent to @embedded in 
> python without using ForeignKey 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a3cc0fb3-93f1-4759-a30b-b91b22ae47d1%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/510ABBAA-0539-4D5F-A470-AA61704E47C8%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


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 get an error,
> 
> RuntimeError at /articles/search You called this URL via POST, but the URL 
> doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect 
> to the slash URL while maintaining POST data. Change your form to point to 
> localhost:8000/articles/search/ (note the trailing slash), or set 
> APPEND_SLASH=False in your Django settings.
> 
> I checked for "/" in my code, but its there. Don't know what's going on. 
> Please help.
> 
> application's urls.py:
> 
> url(r'^search/$', 'article.views.search_title'),
> )
> views.py:
> 
> def search_title(request):
> if request.method == "POST":
> search_text = request.POST['search_text']
> else:
> search_text = ''
> 
> articles = Article.objects.filter(title__contains=search_text)
> 
> return render_to_response('ajax_search.html', {'article': article})
> I'm using jquery version: jquery-2.0.0.min.js
> 
> ajax.js:
> 
> $(function(){
> 
> $('#search').keyup(function() {
> 
> $.ajax({
> type: "POST",
> url: '/articles/search/',
> data: { 
> 'search_text' : $('#search').val(),
> 'csrfmiddlewaretoken' : 
> $("input[name=csrfmiddlewaretoken]").val()
> },
> success: searchSuccess,
> dataType: 'html'
> });
> 
> });
> 
> });
> 
> function searchSuccess(data, textStatus, jqXHR)
> {
> $('#search-results').html(data);
> }
> And even when I inspect the ajax.js, in the last line
> 
> $('#search-results').html(data);
> 
> It reads it as:
> 
> $('#search-results').html(date);
> 
> Please help me somebody. Thank you.
> 
> My main url:
> 
> (r'^articles/', include('article.urls')),
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




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 side. This is done with javascript. Using the unit tests,
> there doesn't seem to be a way I emulate that for testing. How do
> folks write tests for situations like this?
> 
> 
> Thanks!
> -larry
> 
> -- 
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




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 of Django :)
> Now I'm looking to host my new app online, but where and how?
> 
> My only requirement: I want something really simple.
> I'm not a sysadmin, and I'm usually pretty bad at playing with the command 
> line to install/configure stuff. 
> That's why I'm looking to something extremely simple. Something like "drag 
> and drop your app folder here, and it's done" would be great.
> 
> Does a really simple Django hosting solution exist?
> Thanks for your help!
> -- 
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




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 deletes an entry in the admin back end, I'll receive an 
> email as to which user did what to which model. I already figured out how to 
> detect the 3 user actions mentioned above in the models.py as well as how to 
> send email templates. The issue is that I need to the current user 
> information to insert into that email template. And like I mentioned before, 
> this is an admin back end, meaning I'm not touching the views.py at all. 
> 
> If there are any other ways to accomplish this, I'm all ears!
> 
> Thanks
> -- 
> 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 http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 PM UTC-6, jondbaker wrote:
>
> I've successfully installed Django-SEO, but when I try to limit
> the number of backends (I only need/want my admin to have 'path'
> and not the other three) I am met with the following error:
>
>
>   AttributeError at /admin/
>
>
>   'NoneType' object has no attribute '_meta'
>
>
> I am using the documentation
> here: 
> http://django-seo.readthedocs.org/en/latest/reference/definition.html#Meta.backends
> 
> 
>
> *seo.py*
> from rollyourown import seo
>
> class AppMetadata(seo.Metadata):
> title = seo.Tag(head=True, max_length=68)
> description = seo.MetaTag(max_length=155)
>
> class Meta:
> backends = ('path',)
> #backends = ('path', 'modelinstance', 'model', 'view',)
> This works but includes all default backends
>
> *admin.py*
> from django.contrib import admin
> from rollyourown.seo.admin import register_seo_admin
>
> from localsite.seo import AppMetadata
>
> register_seo_admin(admin.site, AppMetadata)
>
> -- 
> 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/-/gB5-ZyRCpHIJ.
> 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.


-- 
Software Developer
https://github.com/jondbaker
GPG: 1F6F3FFD

-- 
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: 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 of
configuring your model and form fields to allow null/blank. In this
case, seeing your code would help provide more direction.

Hope this helps,
Jonathan

On 01/21/2013 04:34 AM, Sarfraz ahmad wrote:
> Hello everyone,
>
>  i m facing a problem while validating django
> form. i have 5 form fields in a form and in the view i want to
> validate only three form fields which i need to update .. tell
> me a solution if anyone have any
> -- 
> 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/-/oZfMAZ8FWt4J.
> 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.


-- 
Software Developer
https://github.com/jondbaker
GPG: 1F6F3FFD

-- 
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: 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 exactly 2 arguments (1 given)
> Exception 
> Location:/home/user/google_appengine/lib/django_0_96/django/core/handlers/base.py
>  in get_response, line 77
> 
> 
> 
> url is  (r'^employee/[0-9]+/$','qburstemployeeapp.main.views.individual'),
> 
> in this the [0-9]+ denotes id number for the user ...
> 
> in my view...
> 
> 
> 
> def individual(request,id):
> employees = Employeeprofile.all()
> for employee in employees:
> if(employee.key().id() == id):
>   return render_to_response('main/individual1.html', { 'employee' 
> : employee }) 
> 
> What is the mistake?...
> 
> 
> 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/-/PJcdrn57HooJ.
> 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: 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 template, nothing happens -> in web
> browser is url: http://127.0.0.1:8000/news/category?music
> 
> 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 
> 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: 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 = request.user)
> user.set_password(newpassword)
> user.save
> 
> it didn't prompt me any error.  but, why my password still remained unchanged?
> 
> Regards,
> MH
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: 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 the rest of the
> registration form. I'm trying to figure out a way to prevent the user
> from accessing the rest of the site without accepting the EULA. Every
> path I go down seems to end up being very hackish. Has anyone done a
> EULA in a separate view/page from the rest of the site registration?
> What method did you use?
> 
> 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 
> 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: @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 ( 
> https://docs.djangoproject.com/en/1.4/topics/auth/ ) I decorated my "index" 
> view with @login_required, but nothing happens. In other words, it'supossed I 
> would be redirected to a login page, else an exception migth raise. But the 
> whole thing keeps doing as always.
> What am I doing the wrong way?
> 
> TIA
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: 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 views that I wish to restrict user access on.
> Django 1.4 does not allow this; obviously the book is dated! Is there
> a more modern way to get the same effect?
> 
> Similarly, admin does not allow access to my classes, even when I have
> created an Admin class; is this a new security feature?
> 
> Finally, when I tried to create a view that allowed web-based user
> creation, the views.py file would not recognize the class "User"; is
> there something I need to import?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



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

2012-04-27 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.db import models
> 
> class Category(models.Model):
>title = models.CharField(max_length = 250)
>slug = models.SlugField(unique = True)
>description = models.TextField()
> 
>def__unicode__(self):
>return self.title
> 
> I want to be able to manage this model through the admin interface so
> I've added the folder name to the INSTALLED_APPS setting of the
> project like so:
> 
> INSTALLED_APPS = (
>'django.contrib.auth',
>'django.contrib.contenttypes',
>'django.contrib.sessions',
>'django.contrib.sites',
>'django.contrib.admin',
>'django.contrib.flatpages',
>'coltrane',
> 
> )
> 
> Now I want to see it on the dev server, so I cd into the directory
> that contains the INSTALLED_APPS setting and run python manage.py
> syncdb to install the table. But I keep getting an error message that
> reads "Error: No module named coltrane".
> 
> Any idea why this is happening?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: 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 of manually over-riding each label, is there a built-in way to 
> do that?
> 
> 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 
> 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: 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:
> 
> Environment:
> 
> 
> Request Method: POST
> Request URL: http://127.0.0.1:8000/admin/myapp/course/add/
> 
> Django Version: 1.3.1
> Python Version: 2.7.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin',
>  'munchlearnapp']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
> get_response
>   111. response = callback(request, *callback_args, 
> **callback_kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" 
> in wrapper
>   307. return self.admin_site.admin_view(view)(*args, 
> **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
> _wrapped_view
>   93. response = view_func(request, *args, **kwargs)
> File 
> "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in 
> _wrapped_view_func
>   79. response = view_func(request, *args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" 
> in inner
>   197. return view(request, *args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
> _wrapper
>   28. return bound_func(*args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
> _wrapped_view
>   93. response = view_func(request, *args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
> bound_func
>   24. return func(self, *args2, **kwargs2)
> File "/usr/local/lib/python2.7/dist-packages/django/db/transaction.py" in 
> inner
>   217. res = func(*args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" 
> in add_view
>   882. self.save_model(request, new_object, form, 
> change=False)
> File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" 
> in save_model
>   665. obj.save()
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in save
>   460. self.save_base(using=using, force_insert=force_insert, 
> force_update=force_update)
> File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in 
> save_base
>   543. for f in meta.local_fields if not 
> isinstance(f, AutoField)]
> File 
> "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/files.py" in 
> pre_save
>   255. file.save(file.name, file, save=False)
> File 
> "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/files.py" in 
> save
>   92. self.name = self.storage.save(name, content)
> File "/usr/local/lib/python2.7/dist-packages/django/core/files/storage.py" in 
> save
>   49. name = self._save(name, content)
> File "/usr/local/lib/python2.7/dist-packages/django/core/files/storage.py" in 
> _save
>   166. os.makedirs(directory)
> File "/usr/lib/python2.7/os.py" in makedirs
>   150. makedirs(head, mode)
> File "/usr/lib/python2.7/os.py" in makedirs
>   150. makedirs(head, mode)
> File "/usr/lib/python2.7/os.py" in makedirs
>   150. makedirs(head, mode)
> File "/usr/lib/python2.7/os.py" in makedirs
>   150. makedirs(head, mode)
> File "/usr/lib/python2.7/os.py" in makedirs
>   157. mkdir(name, mode)
> 
> Exception Type: OSError at /admin/myapp/course/add/
> Exception Value: [Errno 13] Permission denied: '/home/projects'
> 
> I'm on Ubuntu 11.10, using Django 1.3.1. Any thoughts? Thanks.
> 
> -- 
> Regards,
> Sithembewena Lloyd Dube
> -- 
> 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