Re: any good books for django2

2019-01-29 Thread Danylo K.
https://www.packtpub.com/application-development/django-2-example
Great tutorial style-book.

On Tue, Jan 29, 2019 at 11:02 AM Lutalo Bbosa joseph 
wrote:

> guys can anyone assist me with a link to any django2 book because it seems
> its
> most are not free
>
> --
> 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/CAMz%3Dh%3DRdpm-MaeCG3d9Kf4tTQC5WS3BFXv9cF8S5nvCRtPN8Hg%40mail.gmail.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/CADnU5JEDr%3DSi2Cn20QNTR8F%2BoxK73A5h6Ve6YQJQETD9bE1YUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best Learning Resources

2019-01-21 Thread Danylo K.
* I love this book:*


*https://www.packtpub.com/application-development/django-2-example*

 

On Wednesday, January 16, 2019 at 8:20:15 AM UTC-5, cale...@gmail.com wrote:
>
> Hi All,
>
> I'm just starting out with Django and python and wondering if anyone can 
> direct me to some goto learning resources. Beginner to Advanced
>
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e804053b-91b7-4bb7-bc62-431c6e2ece25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Microsoft Visual Studion 2017 Environment is good for Django development ?

2019-01-21 Thread Danylo K.
Visual Studio 2017 is excellent for Django development. Just don't use
project templates to create new Django projects. Create new project in
command line tool (cmd) and then create new Visual Studio project using
"Existing Python Project" option.

Cheers.
Danyo

On Mon, Jan 21, 2019 at 9:56 AM Matthew Pava  wrote:

> I use PyCharm.
>
> https://www.jetbrains.com/pycharm/
>
>
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *Django Geek Aditya
> *Sent:* Sunday, January 20, 2019 1:55 AM
> *To:* Django users
> *Subject:* Is Microsoft Visual Studion 2017 Environment is good for
> Django development ?
>
>
>
> I am a beginner in Django. Is Microsoft Visual Studio will be a better
> environment to start with django from basics.
>
> They are providing a detailed help on their website LINK
> .
>  Please
> help me and suggest me the ways to proceed further.
>
> I want to enter into the Web Development with Django and I have to work on
> my idea.
>
> --
> 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/e8a0bf47-2906-41cf-a109-14fef6e60f68%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/8eed738aec364d76b47a35560abc1913%40iss2.ISS.LOCAL
> 
> .
> 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/CADnU5JEF5kVXgwn%3D%2BbQoQDAttRONdY7q74u8kLBmjrUwUq3VWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-17 Thread Danylo K.
try .\scripts\activate.bat


On Thu, Jan 17, 2019 at 2:18 PM Django Geek Aditya 
wrote:

> Shell Output after entering command is
> PS E:\todo> . \Scripts\activate
> . : The term '\Scripts\activate' is not recognized as the name of a
> cmdlet, function, script file, or operable
> program. Check the spelling of the name, or if a path was included, verify
> that the path is correct and try again.
> At line:1 char:3
> + . \Scripts\activate
> +   ~
> + CategoryInfo  : ObjectNotFound: (\Scripts\activate:String)
> [], CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> PS E:\todo>
>
> --
> 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/00a2f79a-0d62-4fd8-8cd4-cd5b9e8d1f2b%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/CADnU5JEQuC__qBQ5K0MBF8Hx-AF9aNhPTyxjh9GELsAs_Nmt3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: working fine with sqllite but not showing result in mysql

2019-01-14 Thread Danylo K.
if you change the code to this, it will work:

   post = get_object_or_404(Post, slug=post,
 status='published',
 publish__year=year)
 # publish__month=month,
 # publish__day=day)


On Mon, Jan 14, 2019 at 2:22 PM tribhuvan kishor <
tribhuvankishor...@gmail.com> wrote:

> yes all things are working fine like post list are working fine
>
> from django.shortcuts import render, get_object_or_404
> from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
> from django.views.generic import ListView
> from .models import Post
>
> def post_list(request):
> object_list = Post.published.all()
> paginator = Paginator(object_list, 3) # 3 posts in each page
> page = request.GET.get('page')
> try:
> posts = paginator.page(page)
> except PageNotAnInteger:
> # If page is not an integer deliver the first page
> posts = paginator.page(1)
> except EmptyPage:
> # If page is out of range deliver last page of results
> posts = paginator.page(paginator.num_pages)
> return render(request,
>   'blog/post/list.html',
>   {'page': page,
>'posts': posts})
>
> # Create your views here.
> def post_detail(request, year, month, day, post):
> post = get_object_or_404(Post, slug=post,
>  status='published',
>  publish__year=year,
>  publish__month=month,
>  publish__day=day)
>
> return render(request,
>   'blog/post/details.html',
>   {'post': post})
>
> class PostListView(ListView):
> queryset = Post.published.all()
> context_object_name = 'posts'
> paginate_by = 3
> template_name = 'blog/post/list.html'
>
> def test_test(request):
> return render(request,'blog/post/test.html')
>
>
> On Tue, Jan 15, 2019 at 12:24 AM Alex Kimeu  wrote:
>
>> Have you configured MySQL correctly?
>>
>> On Mon, Jan 14, 2019 at 9:07 PM tribhuvan kishor <
>> tribhuvankishor...@gmail.com> wrote:
>>
>>> this view is retrieving data with SQlite but not fetching data in
>>> MySQL saying no data found.
>>>
>>>
>>> def post_detail(request, year, month, day, post):
>>> post = get_object_or_404(Post, slug=post,
>>>  status='published',
>>>  publish__year=year,
>>>  publish__month=month,
>>>  publish__day=day)
>>>
>>> return render(request,
>>>   'blog/post/details.html',
>>>   {'post': post})
>>>
>>> --
>>> regards
>>> Tribhuvan Kishor Bhaskar
>>>
>>> --
>>> 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/CACiphSVVyMgpNmgFj16ROZGqpohaq0fYJKV2bES4D1aVeg1LbA%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>>
>>
>> *"It's when nothing happens that anything can happen."*
>> *https://kodenaut.github.io/ **+
>> 254 723494571*
>>
>> --
>> 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/CACYP3VGYe96j6vYWYC8-7GCzODUfu8b5xc1qo2Lh6KhHevKgYQ%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> regards
> Tribhuvan Kishor Bhaskar
>
> --
> 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 

Re: working fine with sqllite but not showing result in mysql

2019-01-14 Thread Danylo K.
I have the same issue. In MySQL, search works fine by the *year part*, but
not by the *month* and *day* *parts*.

Cheers!

On Mon, Jan 14, 2019 at 1:54 PM Alex Kimeu  wrote:

> Have you configured MySQL correctly?
>
> On Mon, Jan 14, 2019 at 9:07 PM tribhuvan kishor <
> tribhuvankishor...@gmail.com> wrote:
>
>> this view is retrieving data with SQlite but not fetching data in
>> MySQL saying no data found.
>>
>>
>> def post_detail(request, year, month, day, post):
>> post = get_object_or_404(Post, slug=post,
>>  status='published',
>>  publish__year=year,
>>  publish__month=month,
>>  publish__day=day)
>>
>> return render(request,
>>   'blog/post/details.html',
>>   {'post': post})
>>
>> --
>> regards
>> Tribhuvan Kishor Bhaskar
>>
>> --
>> 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/CACiphSVVyMgpNmgFj16ROZGqpohaq0fYJKV2bES4D1aVeg1LbA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
>
> *"It's when nothing happens that anything can happen."*
> *https://kodenaut.github.io/ **+
> 254 723494571*
>
> --
> 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/CACYP3VGYe96j6vYWYC8-7GCzODUfu8b5xc1qo2Lh6KhHevKgYQ%40mail.gmail.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/CADnU5JEv4ZfCY8Yk8utBnRvs%3D8fPkd8%3D%3DdhaU_uiJC8_aueAOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Difficulty validating ModelMultipleChoiceField

2007-07-06 Thread danylo

Problem solved thanks to Adrian.

Added:
from django.utils.datastructures import MultiValueDict

and I added the following to the SortedCheckBox widget:

def value_from_datadict(self, data, name):
if isinstance(data, MultiValueDict):
return data.getlist(name)
return data.get(name, None)



On Jul 5, 9:30 pm, danylo <[EMAIL PROTECTED]> wrote:
> I can't get a form to validate and for the life of me, can't figure
> out why.
>
> I keep getting an error on the topics.  Regardless of how many I
> choose, it returns an "Enter a list of values." error.  It looks like
> even though the form returns a list of topics, it doesn't send the
> list to the validator, just a single value.
>
> I've also tried converting the topics bit to a MutlipleChoiceField,
> but didnt' have any mroe luck with it.
>
> Any suggestions of where to look are much appreciated.  Thanks,
>
> dan
>
> class AddBlogForm(forms.Form):
> def __init__( self, *args, **kwargs ):
> super( AddBlogForm, self ).__init__( *args, **kwargs )
> self.fields['location'] =
> GroupedChoiceField(choices=location_drop_tags())
> self.fields['topics'] = forms.ModelMultipleChoiceField(
> queryset=Tags.objects.exclude(location__exact=True).order_by('-
> parent_tag', 'tag'), widget=SortedCheckBox)
> owner = forms.CharField()
> password = forms.CharField(widget=forms.PasswordInput)
> url = forms.URLField(initial='http://', verify_exists=True)
> title = forms.CharField(max_length=100)
> description = forms.CharField(max_length=500, required=False,
> widget=forms.Textarea(attrs={'rows': '3'}))
>
> (this is the widget used for the topic)
> class SortedCheckBox(forms.Select):
> def render(self, name, value, attrs=None, choices=()):
> from django.utils.html import escape
> from django.newforms.util import flatatt, smart_unicode
> final_attrs = self.build_attrs(attrs, name=name)
> output = []
> if value is None:
> value = ''
> str_value = tuple([smart_unicode(v) for v in value])
> for t in
> self.choices.queryset.filter(parent_tag__isnull=True):
> output.append(u'')
> option_value = smart_unicode(t.id)
> option_label = smart_unicode(t.tag)
> selected_html = (option_value in str_value) and u'checked
> ' or ''
> output.append(u' value="%s" %s/>%s' % (option_value, selected_html,
> option_label))
> for t_child in
> self.choices.queryset.filter(parent_tag__tag=t.tag):
> option_value = smart_unicode(t_child.id)
> option_label = smart_unicode(t_child.tag)
> selected_html = (option_value in str_value) and
> u'checked ' or ''
> output.append(u' value="%s" %s/>%s' % (option_value, selected_html,
> option_label))
> output.append(u'')
> return u'\n'.join(output)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Difficulty validating ModelMultipleChoiceField

2007-07-05 Thread danylo


I can't get a form to validate and for the life of me, can't figure
out why.

I keep getting an error on the topics.  Regardless of how many I
choose, it returns an "Enter a list of values." error.  It looks like
even though the form returns a list of topics, it doesn't send the
list to the validator, just a single value.

I've also tried converting the topics bit to a MutlipleChoiceField,
but didnt' have any mroe luck with it.

Any suggestions of where to look are much appreciated.  Thanks,

dan


class AddBlogForm(forms.Form):
def __init__( self, *args, **kwargs ):
super( AddBlogForm, self ).__init__( *args, **kwargs )
self.fields['location'] =
GroupedChoiceField(choices=location_drop_tags())
self.fields['topics'] = forms.ModelMultipleChoiceField(
queryset=Tags.objects.exclude(location__exact=True).order_by('-
parent_tag', 'tag'), widget=SortedCheckBox)
owner = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
url = forms.URLField(initial='http://', verify_exists=True)
title = forms.CharField(max_length=100)
description = forms.CharField(max_length=500, required=False,
widget=forms.Textarea(attrs={'rows': '3'}))



(this is the widget used for the topic)
class SortedCheckBox(forms.Select):
def render(self, name, value, attrs=None, choices=()):
from django.utils.html import escape
from django.newforms.util import flatatt, smart_unicode
final_attrs = self.build_attrs(attrs, name=name)
output = []
if value is None:
value = ''
str_value = tuple([smart_unicode(v) for v in value])
for t in
self.choices.queryset.filter(parent_tag__isnull=True):
output.append(u'')
option_value = smart_unicode(t.id)
option_label = smart_unicode(t.tag)
selected_html = (option_value in str_value) and u'checked
' or ''
output.append(u'%s' % (option_value, selected_html,
option_label))
for t_child in
self.choices.queryset.filter(parent_tag__tag=t.tag):
option_value = smart_unicode(t_child.id)
option_label = smart_unicode(t_child.tag)
selected_html = (option_value in str_value) and
u'checked ' or ''
output.append(u'%s' % (option_value, selected_html,
option_label))
output.append(u'')
return u'\n'.join(output)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



rss problem

2006-01-25 Thread danylo

As part of my first steps into Python and Django, I'm trying to
generate an RSS feed for a group of individual writers. I'm finally
able to generate an RSS feed, but it's incorrect.

This is what I'm getting:



http://www.foo.bar

http://www.foo.bar


The link and guid are correct, but I'm not getting the actual title or
description or other data (publication date, etc).  I'm just not seeing
what I need to do differently to pull in the actual values for title
and description.

Any ideas?

Thanks much,

Dan


This is the feeds.py:

from django.contrib.syndication.feeds import Feed
from django.models.bylines import writers, writerfeeds

class Authors(Feed):
def get_object(self, bits):
 if len(bits) != 1:
 raise ObjectDoesNotExist
return writers.get_object(feed_name__exact=bits[0])

def title(self, obj):
return "Stories by %s" % obj.byline

def link(self, obj):
return "/rss/writers/%s" % obj.feed_name

def description(self, obj):
return "Stories by %s" % obj.byline

def items(self, obj):
return writerfeeds.get_list(writerid__id__exact=obj.id,
limit=25, order_by=['-pub_date'])