[ANNOUNCE] Django 1.10 beta 1 released

2016-06-21 Thread Tim Graham
We've made the second release on the way to Django's next major release, 
Django 1.10! With a month and a half until the scheduled final release, 
we'll need timely testing from the community to ensure an on-time and 
stable release. Check out the blog post:

https://www.djangoproject.com/weblog/2016/jun/21/django-110-beta-1-released/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/250f30a7-de13-495d-9409-fc1fc907b716%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: how to design custom forms in django with bootstrap

2016-06-21 Thread 1351552...@qq.com

u need read how to use css file by django 
:https://docs.djangoproject.com/en/1.9/intro/tutorial06/ 
before this u need download bootstrap in ur location disk,and add 
in the  of ur html.


ww
 
From: Ikram Ulhaq
Date: 2016-06-21 05:02
To: Django users
Subject: Re: how to design custom forms in django with bootstrap

sir i want to design a custom form in django that will store data in 
database...i done this with built in django forms but i can't be able to design 
with bootstarp or css. data not inserted if i create my own custom form like 




Email address

  




Email address

  



some button




Email address

aa

  


On Monday, June 20, 2016 at 4:56:29 PM UTC+5, Ikram Ulhaq wrote:
Hi everyone!
i am new in django and want to design custom form in bootstarp that can use to 
send data to database.i made form successfully but values not inserted in 
database.please 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0872af0f-c81f-42f9-998f-89a60ec390aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/201606220844433196233%40qq.com.
For more options, visit https://groups.google.com/d/optout.


Re: choices field language

2016-06-21 Thread Luis Zárate
Use in the first line

#- coding: utf-8
from __future__ import unicode_literals

And put in models



from django.utils.encoding import python_2_unicode_compatible

@python_2_unicode_compatible
class MyClass(object):
   def __str__(self):
   return "Instance of my class"

See more in

https://docs.djangoproject.com/en/1.9/topics/python3/



El martes, 21 de junio de 2016, ludovic coues  escribió:
> Python 3 have a better support of international alphabet.
>
> 2016-06-20 23:44 GMT+02:00 Xristos Xristoou :
>> hello i want to use choices in my field but not work if i write in my
>> language(greek) only work in the england language.
>> if i writing choices in my language show me error message in the admin
mode
>> (this choose is not valid),any idea how to fix that ?i have python 2.7
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>>
https://groups.google.com/d/msgid/django-users/5bfdb5b9-e286-40e1-aa8b-2a0e68878204%40googlegroups.com
.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> Cordialement, Coues Ludovic
> +336 148 743 42
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAEuG%2BTaq-wqgpk1k2B%2BiGWesPdo32OvRhFGAEHu%2BwC7p25%2BmHQ%40mail.gmail.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyNZF6SjWdN4y5Q9zs8rWisy4%3D6KOj2G3NngiomsFn1dow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: choices field language

2016-06-21 Thread ludovic coues
Python 3 have a better support of international alphabet.

2016-06-20 23:44 GMT+02:00 Xristos Xristoou :
> hello i want to use choices in my field but not work if i write in my
> language(greek) only work in the england language.
> if i writing choices in my language show me error message in the admin mode
> (this choose is not valid),any idea how to fix that ?i have python 2.7
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5bfdb5b9-e286-40e1-aa8b-2a0e68878204%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTaq-wqgpk1k2B%2BiGWesPdo32OvRhFGAEHu%2BwC7p25%2BmHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django rest framework - request context key error

2016-06-21 Thread Aamu Padi
I have two models (Like and News). I am using django-rest-framework to make
a web api out of it.

class Like(models.Model):
user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')

class News(models.Model):
user = models.ForeignKey(User)
title = models.CharField(max_length=150)
...
likes = GenericRelation(Like)


A *Like object* has its own user field to store who liked the News object.
Now to check if a specific user exists in any of the likes of a News
object, I am getting request.user from a SerializerMethodField.

class NewsSerializer(serializers.HyperlinkedModelSerializer):
user = UserSerializer()
likes_count = serializers.IntegerField(source='likes.count', read_only=
True)
user_in_likes = serializers.SerializerMethodField()

class Meta:
model = News
fields = ('user', 'title', 'body', 'article_image', 'pub_date',
'likes_count', 'user_in_likes')

def get_user_in_likes(self, obj):
user = self.context['request'].user
what = obj.likes.filter(user=user).exists()
return what


When I go the /news/ url, I get the json objects including the
*user_in_likes* to true/false for each news object.

However, I have another serialzer for different model which imports
*NewsSerializer
class* and other similar serializers:

class ActivityObjectRelatedField(serializers.RelatedField):
def to_representation(self, value):
if isinstance(value, User):
serializer = UserSerializer(value)
elif isinstance(value, Job):
serializer = JobSerializer(value)
elif isinstance(value, News):
serializer = NewsSerializer(value)
elif isinstance(value, Tender):
serializer = TenderSerializer(value)
else:
raise Exception('Unexpected type of tagged object')
return serializer.data

class ActivitySerializer(serializers.HyperlinkedModelSerializer):
actor = ActivityObjectRelatedField(read_only=True)
target = ActivityObjectRelatedField(read_only=True)

class Meta:
model = Activity
fields = ('url', 'actor', 'verb', 'target', 'pub_date')


Now if I visit */activities/*, to get the activities objects I am getting
an error:

KeyError at /activities/

'request'


And it points to the line of SerializerMethod of NewsSerialize class where
*self.context['request'].user* is used.

Exception Location: /vagrant/myproject/news/serializers.py in
 get_user_in_likes, line 25


Again if I visit */news/* url, everything is fine and I get news objects.
What am I missing here? Why is *request* not being recognized in the
*ActivitiesSerializer
class*? Please help me solve this problem. Thank you.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHSNPWsBp3uXaMVzqLmHmyQGP3MtwO06nZ-GQE98523DAVD-8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please help me with CBV template_name behaviour.

2016-06-21 Thread JoeCodeswell
Dear James &  Django-Users,

As an afterthought, I wonder why my misspelling didn't cause an error 
instead of a "wrong" Template being used?

Any insights?

Thanks again,

Love and peace,

Joe

On Tuesday, June 21, 2016 at 10:01:31 AM UTC-7, JoeCodeswell wrote:
>
> Dear James & All,
>
> I installed the Django Debug Toolbar and here is what it says when i 
> navigate to 'http://127.0.0.1:8000/contacts/psearchc/last_name/contains/d/
> '
>
> Template path 
>
>1. C:\Users\joeco\djtut\mysite\templates
>
> Template *contacts/contact_list.html 
> *
> C:\\Users\\joeco\\djtut\\mysite\\templates\\contacts\\contact_list.html
> Context:
> {'False': False, 'None': None, 'True': True}
> {'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10,
> 'ERROR': 40,
> 'INFO': 20,
> 'SUCCESS': 25,
> 'WARNING': 30},
>  'csrf_token': ,
>  'debug': True,
>  'messages':  object at 0x01E614D9C8D0>,
>  'perms':  0x01E614D91940>,
>  'request': '<>',
>  'sql_queries': . at 0x01E614DA7A60>,
>  'user': >}
> {}
> {'contact_list': '<>',
>  'is_paginated': False,
>  'object_list': '<>',
>  'page_obj': None,
>  'paginator': None,
>  'view':  0x01E614D9C278>}
>
> Context processors *django.template.context_processors.csrf*
> {'csrf_token': }
>
> *django.template.context_processors.debug*
> {'sql_queries': . at 0x01E614DA7A60>, 
> 'debug': True}
>
> *django.template.context_processors.request*
> {'request': }
>
> *django.contrib.auth.context_processors.auth*
> {'perms':  0x01E614D91940>, 'user': >}
>
> *django.contrib.messages.context_processors.messages*
> {'DEFAULT_MESSAGE_LEVELS': {'INFO': 20, 'WARNING': 30, 'DEBUG': 10, 
> 'ERROR': 40, 'SUCCESS': 25}, 'messages':  fallback.FallbackStorage object at 0x01E614D9C8D0>}
>
> Again, i am EXPECTING the view to use the 
> CRUD Template == 'contacts/crudlist.htm';NOT the Plain TEMPLATE == '
> contacts/contact_list.html'
> *OK EVERYONE, I APOLOGIZE. I HAD A SPELLING MISTAKE.* 'contacts/crudlist.
> htm'*SHOULD HAVE BEEN*'contacts/crudlist.html'
> *All WORKS NOW.*
> *THANKS for the help. **At least i found out about the Django Debug 
> Toolbar.*
> *Sorry again.** Thanks AGAIN.*
>
> *Love and peace,*
>
>
> *Joe*
>
>
>
>
>
>
>
> On Monday, June 20, 2016 at 9:18:44 AM UTC-7, JoeCodeswell wrote:
>>
>> Dear James,
>>
>> Thanks for your reply. 
>>
>>1. I'll investigate using the "Django debug toolbar".
>>2. re: "extraneous classes":  I was trying to make a point of how to 
>>construct the second-2 classes from the first-2. The second-2 classes 
>> (CRUD 
>>classes) are a *text copy* of the first-2 with the difference being 
>>that the second-2 have their names changed, in the appropriate 2 places & 
>>(I THOUGHT) they point to A DIFFERENT Crud Template 
>>('contacts/crudlist.htm'). The Crud Template IS NOT USED FOR RENDERING. 
>>INSTEAD the Template mentioned in the first-2 classes is used.
>>3. re: "template inheritance structure". Any Django Docs on this 
>>subject?
>>
>> I'll investigate the Debug Toolbar & see what it tells me.
>>
>>
>> Again, THANKS, BIG TIME, James.
>>
>>
>> Love and peace,
>>
>> Joe
>>
>> On Saturday, June 18, 2016 at 10:52:46 PM UTC-7, James Schneider wrote:
>>>
>>> > I EXPECT the Views with CRUD in their names (CRUD Views) to behave THE 
>>> SAME AS the others EXCEPT items are listed with read, update & delete 
>>> links, because that is how `contacts/crudlist.htm` displays them.
>>> >
>>> > THE PROBLEM IS that the CRUD Views display the items using the Plain 
>>> Template (contacts/contact_list.html) NOT the CRUD Template 
>>> ('contacts/crudlist.htm')
>>> >
>>>
>>> The Django debug toolbar can likely illuminate the problem here, or at 
>>> least provide a direction. You would need to verify the template(s) that 
>>> have been rendered as part of your view call, and that they're actually 
>>> doing what you think they're doing.
>>>
>>> It's a bit hard to follow your code, as you include extraneous classes 
>>> that don't appear to be relevant to the problem (no inheritance, no 
>>> indication they've been triggered, etc.). With that being said, your output 
>>> from the view appears to be correct and shows a different (and correct) 
>>> template_name for each view. I might be missing something though, and 
>>> admittedly I'm responding on my phone.
>>>
>>> My assumption at this point would be that the templates are rendered 
>>> correctly by Django (correctly meaning 'as configured'), and that the issue 
>>> actually lies within your template inheritance structure (if any). Again, 
>>> the debug toolbar will walk you through that.
>>>
>>> -James
>>>
>>

-- 
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 

Re: Please help me with CBV template_name behaviour.

2016-06-21 Thread JoeCodeswell
Dear James & All,

I installed the Django Debug Toolbar and here is what it says when i 
navigate to 'http://127.0.0.1:8000/contacts/psearchc/last_name/contains/d/'

Template path 
   
   1. C:\Users\joeco\djtut\mysite\templates

Template *contacts/contact_list.html 
*
C:\\Users\\joeco\\djtut\\mysite\\templates\\contacts\\contact_list.html
Context:
{'False': False, 'None': None, 'True': True}
{'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10,
'ERROR': 40,
'INFO': 20,
'SUCCESS': 25,
'WARNING': 30},
 'csrf_token': ,
 'debug': True,
 'messages': ,
 'perms': ,
 'request': '<>',
 'sql_queries': . at 0x01E614DA7A60>,
 'user': >}
{}
{'contact_list': '<>',
 'is_paginated': False,
 'object_list': '<>',
 'page_obj': None,
 'paginator': None,
 'view': }

Context processors *django.template.context_processors.csrf*
{'csrf_token': }

*django.template.context_processors.debug*
{'sql_queries': . at 0x01E614DA7A60>, 
'debug': True}

*django.template.context_processors.request*
{'request': }

*django.contrib.auth.context_processors.auth*
{'perms': , 'user': >}

*django.contrib.messages.context_processors.messages*
{'DEFAULT_MESSAGE_LEVELS': {'INFO': 20, 'WARNING': 30, 'DEBUG': 10, 'ERROR': 
40, 'SUCCESS': 25}, 'messages': }

Again, i am EXPECTING the view to use the 
CRUD Template == 'contacts/crudlist.htm';NOT the Plain TEMPLATE == 'contacts
/contact_list.html'
*OK EVERYONE, I APOLOGIZE. I HAD A SPELLING MISTAKE.* 'contacts/crudlist.
htm'*SHOULD HAVE BEEN*'contacts/crudlist.html'
*All WORKS NOW.*
*THANKS for the help. **At least i found out about the Django Debug 
Toolbar.*
*Sorry again.** Thanks AGAIN.*

*Love and peace,*


*Joe*







On Monday, June 20, 2016 at 9:18:44 AM UTC-7, JoeCodeswell wrote:
>
> Dear James,
>
> Thanks for your reply. 
>
>1. I'll investigate using the "Django debug toolbar".
>2. re: "extraneous classes":  I was trying to make a point of how to 
>construct the second-2 classes from the first-2. The second-2 classes 
> (CRUD 
>classes) are a *text copy* of the first-2 with the difference being 
>that the second-2 have their names changed, in the appropriate 2 places & 
>(I THOUGHT) they point to A DIFFERENT Crud Template 
>('contacts/crudlist.htm'). The Crud Template IS NOT USED FOR RENDERING. 
>INSTEAD the Template mentioned in the first-2 classes is used.
>3. re: "template inheritance structure". Any Django Docs on this 
>subject?
>
> I'll investigate the Debug Toolbar & see what it tells me.
>
>
> Again, THANKS, BIG TIME, James.
>
>
> Love and peace,
>
> Joe
>
> On Saturday, June 18, 2016 at 10:52:46 PM UTC-7, James Schneider wrote:
>>
>> > I EXPECT the Views with CRUD in their names (CRUD Views) to behave THE 
>> SAME AS the others EXCEPT items are listed with read, update & delete 
>> links, because that is how `contacts/crudlist.htm` displays them.
>> >
>> > THE PROBLEM IS that the CRUD Views display the items using the Plain 
>> Template (contacts/contact_list.html) NOT the CRUD Template 
>> ('contacts/crudlist.htm')
>> >
>>
>> The Django debug toolbar can likely illuminate the problem here, or at 
>> least provide a direction. You would need to verify the template(s) that 
>> have been rendered as part of your view call, and that they're actually 
>> doing what you think they're doing.
>>
>> It's a bit hard to follow your code, as you include extraneous classes 
>> that don't appear to be relevant to the problem (no inheritance, no 
>> indication they've been triggered, etc.). With that being said, your output 
>> from the view appears to be correct and shows a different (and correct) 
>> template_name for each view. I might be missing something though, and 
>> admittedly I'm responding on my phone.
>>
>> My assumption at this point would be that the templates are rendered 
>> correctly by Django (correctly meaning 'as configured'), and that the issue 
>> actually lies within your template inheritance structure (if any). Again, 
>> the debug toolbar will walk you through that.
>>
>> -James
>>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/42fa0c5f-b6a9-4d79-9da4-f3414e4ea1f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to design custom forms in django with bootstrap

2016-06-21 Thread Jani Tiainen

Hi,

If you're unsure what markup should look a like, you can create initial 
HTML as you have done it with form.as_p (or whatever you used to make 
working form). Then open then source of page and copy to and start 
applying bootstrap CSS/html tags/attributes.


You should then get working form.

On 21.06.2016 00:02, Ikram Ulhaq wrote:


sir i want to design a custom form in django that will store data in 
database...i done this with built in django forms but i can't be able 
to design with bootstarp or css. data not inserted if i create my own 
custom form like





Email address
placeholder="Email">

  




Email address
placeholder="Email">

  



some button




Email address

aa

  


On Monday, June 20, 2016 at 4:56:29 PM UTC+5, Ikram Ulhaq wrote:

Hi everyone!
i am new in django and want to design custom form in bootstarp
that can use to send data to database.i made form successfully but
values not inserted in database.please 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0872af0f-c81f-42f9-998f-89a60ec390aa%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.

--
Jani Tiainen

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57690AE5.7080004%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to design custom forms in django with bootstrap

2016-06-21 Thread Babatunde Akinyanmi
Hello Ikram,
You still didn't give enough details. For example, does it submit and
successfully or does it not?

Anyway, I can see some problems in your markup.

1. I do not see any form tag ( <\form>)  in your markup.
2. More importantly, your form input elements do not have a name attribute.

Your browser *might* help you out with (1) but the server will not receive
the data in your form input elements if they do not have any name attribute
assigned to them.
On Jun 20, 2016 10:02 PM, "Ikram Ulhaq"  wrote:

>
> sir i want to design a custom form in django that will store data in
> database...i done this with built in django forms but i can't be able to
> design with bootstarp or css. data not inserted if i create my own custom
> form like
>
> 
> 
> 
> Email address
>  placeholder="Email">
>   
> 
>
> 
> 
> Email address
>  placeholder="Email">
>   
> 
> 
>
> some button
>
>
> 
> 
> Email address
> 
> aa
> 
>   
> 
>
> On Monday, June 20, 2016 at 4:56:29 PM UTC+5, Ikram Ulhaq wrote:
>>
>> Hi everyone!
>> i am new in django and want to design custom form in bootstarp that can
>> use to send data to database.i made form successfully but values not
>> inserted in database.please 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c1c0d45f-94d1-4047-8df5-d7370e27a70b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BWjgXM33-GTsjkV33Ls7ciJfeD71p4mENppymCT3sjChE4Zzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.