Thursday, November 29, 2012

Re: [ANNOUNCE] Django 1.5 beta 1 released

On Tue, Nov 27, 2012 at 11:17 PM, James Bennett <ubernostrum@gmail.com> wrote:
> Our second milestone on the road to Django 1.5 came today, with the
> release of the first beta package.
>
> Blog post about it is here:
>
> https://www.djangoproject.com/weblog/2012/nov/27/15-beta-1/
>
> Release notes are here:
>
> https://docs.djangoproject.com/en/dev/releases/1.5-beta-1/
>
> And you can get the alpha from the downloads page:
>
> https://www.djangoproject.com/download/
>

We have also updated the BitNami DjangoStack to include 1.5 beta1. The
stack also includes PostgreSQL 9.2.1 with PostGIS 2.0.1 so now that
GeoDjango supports PostGIS 2.0 you can easily test it. Here you can
find a few notes:
http://blog.bitnami.org/2012/11/django-15-beta-geodjango-support-for.html
The native installers, Ubuntu virtual machines and Amazon Cloud images
are available in http://bitnami.org/stack/djangostack

Cheers,

Victoria.



> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: admin foreign key issues

On Thu, Nov 29, 2012 at 12:34 PM, Bill Freeman <ke1g.nh@gmail.com> wrote:
>
>
> On Thu, Nov 29, 2012 at 12:30 PM, Larry Martell <larry.martell@gmail.com>
> wrote:
>>
>> On Thu, Nov 29, 2012 at 10:43 AM, Bill Freeman <ke1g.nh@gmail.com> wrote:
>> >
>> >
>> > On Thu, Nov 29, 2012 at 9:10 AM, Larry Martell <larry.martell@gmail.com>
>> > wrote:
>> >>
>> >> This is probably very simple, but I've never run into this before and
>> >> googling has not revealed anything.
>> >>
>> >> I have these 2 models:
>> >>
>> >> class Category(models.Model):
>> >> class Meta: db_table = 'data_category'
>> >> name = models.CharField(max_length=20, unique=True, db_index=True)
>> >>
>> >> class Tool(models.Model):
>> >> class Meta: db_table = 'data_tool'
>> >> name = models.CharField(max_length=10, unique=True)
>> >> category = models.ForeignKey(Category)
>> >>
>> >> In admin when I click on 'Categorys' I get a table of 'Category
>> >> object' and I have to click on those to get at an actual row in the
>> >> table. How can I make the data available from 'Categorys' without that
>> >> extra level?
>> >>
>> >> Similarly, in Tools the Category column has 'Category object' and when
>> >> I click on a specific tool and get into change tool, the Category is a
>> >> drop down that has 'Category object' as every choice. How can I make
>> >> the actual category names appear here?
>> >>
>> >> I tried defining a CategoryAdmin class:
>> >>
>> >> class CategoryAdmin(admin.ModelAdmin):
>> >> list_display = ('name')
>> >> list_filter = ('name')
>> >> admin.site.register(Category, CategoryAdmin)
>> >>
>> >> But that fails with 'CategoryAdmin.list_display' must be a list or
>> >> tuple.
>> >>
>> >>
>> >> And finally, how can I get it to display 'Categories' instead of
>> >> 'Categorys'
>> >>
>> > Start by creating a __unicode__() method on each of your models that
>> > returns
>> > a string giving a better description of your object, say by using its
>> > 'name'
>> > field. If you are using python3, then see the recent discussion here
>> > about
>> > what to do instead of __unicode__().
>> >
>> > Use of the __unicode__() method is described in the tutorial.
>>
>> Thanks much Bill, that did the trick.
>>
>> Now does anyone know how to get it to display 'Categories' instead of
>> 'Categorys'?
>>
> verbose_name_plural Model Meta option?
> https://docs.djangoproject.com/en/1.4/ref/models/options/#verbose-name-plural

Thanks again, Bill.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: admin foreign key issues



On Thu, Nov 29, 2012 at 12:30 PM, Larry Martell <larry.martell@gmail.com> wrote:
On Thu, Nov 29, 2012 at 10:43 AM, Bill Freeman <ke1g.nh@gmail.com> wrote:
>
>
> On Thu, Nov 29, 2012 at 9:10 AM, Larry Martell <larry.martell@gmail.com>
> wrote:
>>
>> This is probably very simple, but I've never run into this before and
>> googling has not revealed anything.
>>
>> I have these 2 models:
>>
>> class Category(models.Model):
>>     class Meta: db_table = 'data_category'
>>     name = models.CharField(max_length=20, unique=True, db_index=True)
>>
>> class Tool(models.Model):
>>     class Meta: db_table = 'data_tool'
>>     name = models.CharField(max_length=10, unique=True)
>>     category = models.ForeignKey(Category)
>>
>> In admin when I click on 'Categorys' I get a table of 'Category
>> object' and I have to click on those to get at an actual row in the
>> table. How can I make the data available from 'Categorys' without that
>> extra level?
>>
>> Similarly, in Tools the Category column has 'Category object' and when
>> I click on a specific tool and get into change tool, the Category is a
>> drop down that has 'Category object' as every choice. How can I make
>> the actual category names appear here?
>>
>> I tried defining a CategoryAdmin class:
>>
>> class CategoryAdmin(admin.ModelAdmin):
>>     list_display = ('name')
>>     list_filter = ('name')
>> admin.site.register(Category, CategoryAdmin)
>>
>> But that fails with 'CategoryAdmin.list_display' must be a list or tuple.
>>
>>
>> And finally, how can I get it to display 'Categories' instead of
>> 'Categorys'
>>
> Start by creating a __unicode__() method on each of your models that returns
> a string giving a better description of your object, say by using its 'name'
> field.  If you are using python3, then see the recent discussion here about
> what to do instead of __unicode__().
>
> Use of the __unicode__() method is described in the tutorial.

Thanks much Bill, that did the trick.

Now does anyone know how to get it to display 'Categories' instead of
'Categorys'?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: admin foreign key issues

On Thu, Nov 29, 2012 at 10:43 AM, Bill Freeman <ke1g.nh@gmail.com> wrote:
>
>
> On Thu, Nov 29, 2012 at 9:10 AM, Larry Martell <larry.martell@gmail.com>
> wrote:
>>
>> This is probably very simple, but I've never run into this before and
>> googling has not revealed anything.
>>
>> I have these 2 models:
>>
>> class Category(models.Model):
>> class Meta: db_table = 'data_category'
>> name = models.CharField(max_length=20, unique=True, db_index=True)
>>
>> class Tool(models.Model):
>> class Meta: db_table = 'data_tool'
>> name = models.CharField(max_length=10, unique=True)
>> category = models.ForeignKey(Category)
>>
>> In admin when I click on 'Categorys' I get a table of 'Category
>> object' and I have to click on those to get at an actual row in the
>> table. How can I make the data available from 'Categorys' without that
>> extra level?
>>
>> Similarly, in Tools the Category column has 'Category object' and when
>> I click on a specific tool and get into change tool, the Category is a
>> drop down that has 'Category object' as every choice. How can I make
>> the actual category names appear here?
>>
>> I tried defining a CategoryAdmin class:
>>
>> class CategoryAdmin(admin.ModelAdmin):
>> list_display = ('name')
>> list_filter = ('name')
>> admin.site.register(Category, CategoryAdmin)
>>
>> But that fails with 'CategoryAdmin.list_display' must be a list or tuple.
>>
>>
>> And finally, how can I get it to display 'Categories' instead of
>> 'Categorys'
>>
> Start by creating a __unicode__() method on each of your models that returns
> a string giving a better description of your object, say by using its 'name'
> field. If you are using python3, then see the recent discussion here about
> what to do instead of __unicode__().
>
> Use of the __unicode__() method is described in the tutorial.

Thanks much Bill, that did the trick.

Now does anyone know how to get it to display 'Categories' instead of
'Categorys'?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Error: No module named books

Im betting you're using Django 1.4x 

The layout is different in 1.4. Download the version the book is using (1.1? https://www.djangoproject.com/download/ bottom right), then all should work.


On Thu, Nov 29, 2012 at 4:33 PM, Tom Evans <tevans.uk@googlemail.com> wrote:
On Thu, Nov 29, 2012 at 4:51 AM, Chris Recher
<perfectlygenericaddress@gmail.com> 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?
>

Hi Chris

First hint, newlines are free to use! Consider some next time!

Second, Django is an evolving framework. It helps to know what version
you are using.

Finally, launch the django shell ("python mange.py shell" instead of
"python manage.py runserver").
Try to import your module - "import mysite.books" - does it work?
If it doesn't, does this work? - "import books"

Cheers

Tom

--
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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: _set.all in template should be simple, wood and trees maybe?

Perfect, thanks

On Thursday, November 29, 2012 3:48:41 PM UTC, ke1g wrote:
You have specified related_name to the foreign key in HotTopic.  Try either taking that out, or using newsletter_instance.letter_set.all .

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

Re: how to use named urls from apps


Named urls are URLs defined in your urlconf that have named views. The
contrib auth app, although it provides a bunch of views, does not
automatically install any of them at any URLs, hence this would fail.

If you include the login view in one of your urlconfs, it will not
have the 'auth' app label, it will have whatever name you decide to
give it.

Cheers

Tom

That makes sense, and explains why none of my solutions worked.  The solution provided by Paul Backhouse works, I suppose because it is referring to the view function and not the url name.


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