From ankur at outlook.com Tue Oct 7 10:01:06 2014 From: ankur at outlook.com (Ankur Gupta) Date: Tue, 7 Oct 2014 13:31:06 +0530 Subject: [Django-india] Django and DjangoCon Meetup in Bangalore Message-ID: Hi, I understand there is a django user group in bengaluru. We can have a meetup scheduled along with a meeting for djangocon ?. Cheers,Ankur -------------- next part -------------- An HTML attachment was scrubbed... URL: From arundhaj at gmail.com Fri Oct 17 13:18:03 2014 From: arundhaj at gmail.com (Arun Kumar Dharuman) Date: Fri, 17 Oct 2014 16:48:03 +0530 Subject: [Django-india] striptags messes spaces Message-ID: Hi, using striptags works fine removing html tags, however it adds   for any extra spaces. how to get rid of striptags converting spaces to " "? regards ArunDhaJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gaurav.dadhania at gmail.com Fri Oct 17 14:35:59 2014 From: gaurav.dadhania at gmail.com (Gaurav Dadhania) Date: Fri, 17 Oct 2014 18:05:59 +0530 Subject: [Django-india] striptags messes spaces In-Reply-To: References: Message-ID: Can you please give a concrete example when it is adding the non-breaking space? I'm not seeing this behaviour: https://gist.github.com/GVRV/94479855558ef054ba0c Are you on an older version of Django? Maybe you'll have some luck with using the `bleach` library for this purpose as recommended in the official docs as a better alternative https://docs.djangoproject.com/en/dev/ref/templates/builtins/#striptags Cheers, G On Fri, Oct 17, 2014 at 4:48 PM, Arun Kumar Dharuman wrote: > Hi, > > using striptags works fine removing html tags, however it adds   for > any extra spaces. > how to get rid of striptags converting spaces to " "? > > regards > ArunDhaJ > > _______________________________________________ > Django-india mailing list > Django-india at python.org > https://mail.python.org/mailman/listinfo/django-india > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arundhaj at gmail.com Fri Oct 17 18:39:16 2014 From: arundhaj at gmail.com (Arun Kumar Dharuman) Date: Fri, 17 Oct 2014 22:09:16 +0530 Subject: [Django-india] striptags messes spaces In-Reply-To: References: Message-ID: I'm using Django 1.7.0 (recent version) In my case for a form's textarea I'm using CKEditorWidget. When user feeds input with extra spaces, the widget adds   to the string. > python manage.py shell >>> from django.template import Context, Template >>> t = Template("{{ html_content }}") >>> c = Context({"html_content": "

This is a  sample html

"}) >>> t.render(c) u' This is a  sample html ' Since the source string itself contains   characters, striptags ignores it. you can check the behavior in the below site http://www.bits-junction.in/quiz/1 Regards ArunDhaJ 2014-10-17 18:05 GMT+05:30 Gaurav Dadhania : > Can you please give a concrete example when it is adding the non-breaking > space? > > I'm not seeing this behaviour: > https://gist.github.com/GVRV/94479855558ef054ba0c > > Are you on an older version of Django? Maybe you'll have some luck with > using the `bleach` library for this purpose as recommended in the official > docs as a better alternative > https://docs.djangoproject.com/en/dev/ref/templates/builtins/#striptags > > Cheers, > G > > > On Fri, Oct 17, 2014 at 4:48 PM, Arun Kumar Dharuman > wrote: > >> Hi, >> >> using striptags works fine removing html tags, however it adds   for >> any extra spaces. >> how to get rid of striptags converting spaces to " "? >> >> regards >> ArunDhaJ >> >> _______________________________________________ >> Django-india mailing list >> Django-india at python.org >> https://mail.python.org/mailman/listinfo/django-india >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arundhaj at gmail.com Fri Oct 17 18:57:03 2014 From: arundhaj at gmail.com (Arun Kumar Dharuman) Date: Fri, 17 Oct 2014 22:27:03 +0530 Subject: [Django-india] striptags messes spaces In-Reply-To: References: Message-ID: forgot the mention this line, >>> t = Template("{{ html_content|striptags }}") 2014-10-17 22:09 GMT+05:30 Arun Kumar Dharuman : > I'm using Django 1.7.0 (recent version) > > In my case for a form's textarea I'm using CKEditorWidget. When user feeds > input with extra spaces, the widget adds   to the string. > > > python manage.py shell > >>> from django.template import Context, Template > >>> t = Template("{{ html_content }}") > >>> c = Context({"html_content": "

This is a  sample > html

"}) > >>> t.render(c) > u' This is a  sample html ' > > Since the source string itself contains   characters, striptags > ignores it. > > you can check the behavior in the below site > http://www.bits-junction.in/quiz/1 > > > Regards > ArunDhaJ > > 2014-10-17 18:05 GMT+05:30 Gaurav Dadhania : > >> Can you please give a concrete example when it is adding the non-breaking >> space? >> >> I'm not seeing this behaviour: >> https://gist.github.com/GVRV/94479855558ef054ba0c >> >> Are you on an older version of Django? Maybe you'll have some luck with >> using the `bleach` library for this purpose as recommended in the official >> docs as a better alternative >> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#striptags >> >> Cheers, >> G >> >> >> On Fri, Oct 17, 2014 at 4:48 PM, Arun Kumar Dharuman >> wrote: >> >>> Hi, >>> >>> using striptags works fine removing html tags, however it adds   >>> for any extra spaces. >>> how to get rid of striptags converting spaces to " "? >>> >>> regards >>> ArunDhaJ >>> >>> _______________________________________________ >>> Django-india mailing list >>> Django-india at python.org >>> https://mail.python.org/mailman/listinfo/django-india >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gaurav.dadhania at gmail.com Fri Oct 17 23:34:59 2014 From: gaurav.dadhania at gmail.com (Gaurav Dadhania) Date: Sat, 18 Oct 2014 03:04:59 +0530 Subject: [Django-india] striptags messes spaces In-Reply-To: References: Message-ID: That's not the Django strip_tags function that's escaping HTML, as you can see here: https://gist.github.com/GVRV/9d392691b7452dc4e0c1 That's just the default Django templates which HTML escaping of variables. See: https://gist.github.com/GVRV/c3d4af2fbac4322e922c Cheers, G On Fri, Oct 17, 2014 at 10:27 PM, Arun Kumar Dharuman wrote: > forgot the mention this line, > >>> t = Template("{{ html_content|striptags }}") > > 2014-10-17 22:09 GMT+05:30 Arun Kumar Dharuman : > >> I'm using Django 1.7.0 (recent version) >> >> In my case for a form's textarea I'm using CKEditorWidget. When user >> feeds input with extra spaces, the widget adds   to the string. >> >> > python manage.py shell >> >>> from django.template import Context, Template >> >>> t = Template("{{ html_content }}") >> >>> c = Context({"html_content": "

This is a  sample >> html

"}) >> >>> t.render(c) >> u' This is a  sample html ' >> >> Since the source string itself contains   characters, striptags >> ignores it. >> >> you can check the behavior in the below site >> http://www.bits-junction.in/quiz/1 >> >> >> Regards >> ArunDhaJ >> >> 2014-10-17 18:05 GMT+05:30 Gaurav Dadhania : >> >>> Can you please give a concrete example when it is adding the >>> non-breaking space? >>> >>> I'm not seeing this behaviour: >>> https://gist.github.com/GVRV/94479855558ef054ba0c >>> >>> Are you on an older version of Django? Maybe you'll have some luck with >>> using the `bleach` library for this purpose as recommended in the official >>> docs as a better alternative >>> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#striptags >>> >>> Cheers, >>> G >>> >>> >>> On Fri, Oct 17, 2014 at 4:48 PM, Arun Kumar Dharuman >> > wrote: >>> >>>> Hi, >>>> >>>> using striptags works fine removing html tags, however it adds   >>>> for any extra spaces. >>>> how to get rid of striptags converting spaces to " "? >>>> >>>> regards >>>> ArunDhaJ >>>> >>>> _______________________________________________ >>>> Django-india mailing list >>>> Django-india at python.org >>>> https://mail.python.org/mailman/listinfo/django-india >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arundhaj at gmail.com Sat Oct 18 08:59:06 2014 From: arundhaj at gmail.com (Arun Kumar Dharuman) Date: Sat, 18 Oct 2014 12:29:06 +0530 Subject: [Django-india] striptags messes spaces In-Reply-To: References: Message-ID: yes, i've solved it by using >>> t = Template("{{ html_content|safe|striptags }}") thanks Gaurav for the hint :-) Regards ArunDhaJ 2014-10-18 3:04 GMT+05:30 Gaurav Dadhania : > That's not the Django strip_tags function that's escaping HTML, as you can > see here: https://gist.github.com/GVRV/9d392691b7452dc4e0c1 > > That's just the default Django templates which HTML escaping of variables. > See: https://gist.github.com/GVRV/c3d4af2fbac4322e922c > > Cheers, > G > > On Fri, Oct 17, 2014 at 10:27 PM, Arun Kumar Dharuman > wrote: > >> forgot the mention this line, >> >>> t = Template("{{ html_content|striptags }}") >> >> 2014-10-17 22:09 GMT+05:30 Arun Kumar Dharuman : >> >>> I'm using Django 1.7.0 (recent version) >>> >>> In my case for a form's textarea I'm using CKEditorWidget. When user >>> feeds input with extra spaces, the widget adds   to the string. >>> >>> > python manage.py shell >>> >>> from django.template import Context, Template >>> >>> t = Template("{{ html_content }}") >>> >>> c = Context({"html_content": "

This is a  sample >>> html

"}) >>> >>> t.render(c) >>> u' This is a &nbsp;sample html ' >>> >>> Since the source string itself contains   characters, striptags >>> ignores it. >>> >>> you can check the behavior in the below site >>> http://www.bits-junction.in/quiz/1 >>> >>> >>> Regards >>> ArunDhaJ >>> >>> 2014-10-17 18:05 GMT+05:30 Gaurav Dadhania : >>> >>>> Can you please give a concrete example when it is adding the >>>> non-breaking space? >>>> >>>> I'm not seeing this behaviour: >>>> https://gist.github.com/GVRV/94479855558ef054ba0c >>>> >>>> Are you on an older version of Django? Maybe you'll have some luck with >>>> using the `bleach` library for this purpose as recommended in the official >>>> docs as a better alternative >>>> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#striptags >>>> >>>> Cheers, >>>> G >>>> >>>> >>>> On Fri, Oct 17, 2014 at 4:48 PM, Arun Kumar Dharuman < >>>> arundhaj at gmail.com> wrote: >>>> >>>>> Hi, >>>>> >>>>> using striptags works fine removing html tags, however it adds   >>>>> for any extra spaces. >>>>> how to get rid of striptags converting spaces to " "? >>>>> >>>>> regards >>>>> ArunDhaJ >>>>> >>>>> _______________________________________________ >>>>> Django-india mailing list >>>>> Django-india at python.org >>>>> https://mail.python.org/mailman/listinfo/django-india >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arundhaj at gmail.com Mon Oct 20 14:57:54 2014 From: arundhaj at gmail.com (Arun Kumar Dharuman) Date: Mon, 20 Oct 2014 18:27:54 +0530 Subject: [Django-india] migration files in SCM Message-ID: Hi, While adding django (v1.7) project to a SCM (GIT), should we even add migration files? or should we have to run the *makemigrations* command in production servers? $ python manage.py makemigrations $ python manage.py migrate Regards ArunDhaJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gaurav.dadhania at gmail.com Mon Oct 20 15:21:09 2014 From: gaurav.dadhania at gmail.com (Gaurav Dadhania) Date: Mon, 20 Oct 2014 18:51:09 +0530 Subject: [Django-india] migration files in SCM In-Reply-To: References: Message-ID: Yep, you commit the migration files. Think of it as the same workflow as when you were using South before migrations were introduced to Django core. There are several reasons to do this: * When you check out a project and run `manage.py migrate`, your database schema should be ready to run the app ? ease of getting started * Committing the migrations means, every developer will have a consistent migration history and it will lead to less conflicts in history when everyone is working on their feature branches as you're using a distributed version control system * You're not only going to have schema migrations that can be generated with a simple `manage.py makemigrations `, you'll have custom data migrations as well as the project matures ? these cannot be generated automatically in production. Cheers, G On Mon, Oct 20, 2014 at 6:27 PM, Arun Kumar Dharuman wrote: > Hi, > > While adding django (v1.7) project to a SCM (GIT), should we even add > migration files? > > or should we have to run the *makemigrations* command in production > servers? > $ python manage.py makemigrations > $ python manage.py migrate > > > Regards > ArunDhaJ > > _______________________________________________ > Django-india mailing list > Django-india at python.org > https://mail.python.org/mailman/listinfo/django-india > > -------------- next part -------------- An HTML attachment was scrubbed... URL: