Can't update extended user django model

2015-07-21 Thread Info Test
When I save my model, there is no effect in database.
What is the problem?

class Profil(models.Model):
user = models.OneToOneField(User)


in manage.py shell

>>> p = models.Profil.objects.get(user__username='testname')

>>> p.user.is_superuser
False
>>> p.user.is_superuser = True
>>> p.user.is_superuser
True
>>> exit()
>>> p = models.Profil.objects.get(user__username='testname')
>>> p.user.is_superuser

False -> 


-- 
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/df7490d5-108e-4960-b80b-8071662d8db1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread Info Test


Le mardi 21 juillet 2015 10:55:19 UTC+3, Info Test a écrit :
>
> When I save my model, there is no effect in database.
> What is the problem?
>
> class Profil(models.Model):
> user = models.OneToOneField(User)
>
>
> in manage.py shell
>
> >>> p = models.Profil.objects.get(user__username='testname')
>
> >>> p.user.is_superuser
> False
> >>> p.user.is_superuser = True
>
>>> p.save() 

> >>> p.user.is_superuser
> True
> >>> exit()
> >>> p = models.Profil.objects.get(user__username='testname')
> >>> p.user.is_superuser
>
> False -> 
>
>
>

-- 
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/bcdedd95-10fd-4724-93ba-53afb108eff0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread James Schneider
You didn't call p.save() anywhere, so the change you made wasn't committed
to the database. All you've done here is made a change to the object in
memory you pulled out of the database, and then over wrote that change by
pulling another copy out of the database.

-James
 On Jul 21, 2015 12:55 AM, "Info Test"  wrote:

> When I save my model, there is no effect in database.
> What is the problem?
>
> class Profil(models.Model):
> user = models.OneToOneField(User)
>
>
> in manage.py shell
>
> >>> p = models.Profil.objects.get(user__username='testname')
>
> >>> p.user.is_superuser
> False
> >>> p.user.is_superuser = True
> >>> p.user.is_superuser
> True
> >>> exit()
> >>> p = models.Profil.objects.get(user__username='testname')
> >>> p.user.is_superuser
>
> False -> 
>
>
>  --
> 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/df7490d5-108e-4960-b80b-8071662d8db1%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUopSKPF_3HScSwpbZYoHt5PUTT9J5ujXz2WfvhaBOm2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread Info Test
Even with p.save(force_update = True) , it doesn't work

-- 
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/44c307bd-8c0a-4924-810f-ab0f2eb123ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread James Schneider
Are you getting any sort of error when you run save()? Are the changes
reflected in the database after the save() call? Can you perform the same
operation directly on the user object?

Also, this operation shouldn't require any arguments to save().

-James
On Jul 21, 2015 1:43 AM, "Info Test"  wrote:

> Even with p.save(force_update = True) , it doesn't work
>
> --
> 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/44c307bd-8c0a-4924-810f-ab0f2eb123ae%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUFQszrU5vjvxd_HnG3K-MiMtkpenuzDWc5_S1dM9ZbYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread Info Test
Any error appear on console, is it possible that only superuser can do that?

-- 
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/8e3bd42d-da1c-42a1-be11-296c2d49d208%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread Sadaf Noor
Did you "python manage.py migrate"?


2015-07-21 15:07 GMT+06:00 Info Test :

> Any error appear on console, is it possible that only superuser can do
> that?
>
> --
> 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/8e3bd42d-da1c-42a1-be11-296c2d49d208%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
  Md. Sadaf Noor (@sadaf2605 )
 www.sadafnoor.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/CAAJ2eVoGbXqVCXTtc1DbUKm0tRkoJ6MKxu%2BvAmSGsFmJT03LgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't update extended user django model

2015-07-21 Thread Info Test
Thanks for all your answers.
Solution : 
http://stackoverflow.com/questions/31534715/cant-update-extended-user-django-model

-- 
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/4a53a742-9db6-4b16-9208-42bc55ff0674%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.8 + mysql + python 3.2

2015-07-21 Thread Tim Graham
That configuration is not officially supported as we don't run the Django 
test suite with that combination. You could try the unofficial fork of 
MySQLdb that we recommended in the past which clams 3.2 support: 
https://github.com/clelland/MySQL-for-Python-3

On Tuesday, July 21, 2015 at 2:46:18 AM UTC-4, gh224391 wrote:
>
> Hello all, 
> I have this combination, on debian 7 (in openvz, not possible to upgrade). 
> According 
> https://docs.djangoproject.com/en/1.8/ref/databases/#mysql-db-api-drivers, 
>
> i have to use mysqlclient or MySQL Connector/Python provided by Oracle. 
> Unfortunately, mysqlclient failed to work: 
>File 
> "/home/devel/.virtualenvs/python3/lib/python3.2/site-packages/django/db/backends/mysql/base.py",
>  
>
> line 27, in  
>  raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) 
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb 
> module: 
> /home/devel/.virtualenvs/python3/lib/python3.2/site-packages/_
> mysql.cpython-32mu.so: 
> undefined symbol: PyUnicode_AsUTF8 
>
> and MySQL Connector/Python doesn't compile in python 3.2: 
> RuntimeError: Python v3.2 is not supported 
> tested with 2.0.4 and 2.1.2 
>
> Anybody has found a solution in this configuration? 
>
> Thanks in advance for help, 
>
> -- 
> Gérard Henry 
>

-- 
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/b7a891d4-7b7b-41d0-99b6-2efaaf544d7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


SHOP APP

2015-07-21 Thread dravid rahul
Hi can anyone please help me with this.. I am newbie to django.

PLEASE FIND BELOW ATTACHMENT

Thanks in Advance
Dravid

-- 
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/ec9b5f15-4845-46df-9bea-841810ca64b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python Django assessment test 1.pdf
Description: Adobe PDF document


Differences between Django 1.1 and 1.8

2015-07-21 Thread Karthik Reddy
Hi experts,

I am working on book Beginning Django Ecommerce(1.1).Based on this document 
i wanna develop applications in Django(1.8).Please help me getting the 
differences between 1.1 and 1.8

Thanks,
Karthik

-- 
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/10c6bd3e-02cd-4f43-84a2-09d3aebd34f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.8 + mysql + python 3.2

2015-07-21 Thread Aron Podrigal
I've been using *mysql-connector-python==1.2.2* and *django 1.6.x* with no 
problems for the last couple of months. I had some issues before that after 
inactive interval the database connections are becoming invalid and was 
causing a server error.
I added some lines into *django/db/backends/__init__.py *to reconnect in 
that case

diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index ca58bce..79ef138 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -130,6 +130,9 @@ class BaseDatabaseWrapper(object):
 if self.connection is None:
 with self.wrap_database_errors:
 self.connect()
+elif not self.connection.is_connected():
+with self.wrap_database_errors:
+self.connect()
 
 # Backend-specific wrappers for PEP-249 connection methods #
 


On Tuesday, July 21, 2015 at 2:46:18 AM UTC-4, gh224391 wrote:
>
> Hello all, 
> I have this combination, on debian 7 (in openvz, not possible to upgrade). 
> According 
> https://docs.djangoproject.com/en/1.8/ref/databases/#mysql-db-api-drivers, 
>
> i have to use mysqlclient or MySQL Connector/Python provided by Oracle. 
> Unfortunately, mysqlclient failed to work: 
>File 
> "/home/devel/.virtualenvs/python3/lib/python3.2/site-packages/django/db/backends/mysql/base.py",
>  
>
> line 27, in  
>  raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) 
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb 
> module: 
> /home/devel/.virtualenvs/python3/lib/python3.2/site-packages/_
> mysql.cpython-32mu.so: 
> undefined symbol: PyUnicode_AsUTF8 
>
> and MySQL Connector/Python doesn't compile in python 3.2: 
> RuntimeError: Python v3.2 is not supported 
> tested with 2.0.4 and 2.1.2 
>
> Anybody has found a solution in this configuration? 
>
> Thanks in advance for help, 
>
> -- 
> Gérard Henry 
>

-- 
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/214179f5-a5bf-48c1-9732-1d7dfbd88bc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Differences between Django 1.1 and 1.8

2015-07-21 Thread Lucas Klassmann
Hi,

You can check the changes between versions in the release notes:
https://docs.djangoproject.com/en/1.8/releases/

If you can, I think you should read a recent book or you will have to read
each every difference between versions( And had many important changes).

Cheers.

On Tue, Jul 21, 2015 at 10:30 AM, Karthik Reddy 
wrote:

> Hi experts,
>
> I am working on book Beginning Django Ecommerce(1.1).Based on this
> document i wanna develop applications in Django(1.8).Please help me getting
> the differences between 1.1 and 1.8
>
> Thanks,
> Karthik
>
> --
> 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/10c6bd3e-02cd-4f43-84a2-09d3aebd34f5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lucas Klassmann
Desenvolvedor de Software

Email: lucasklassm...@gmail.com
Web site: http://www.lucasklassmann.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/CAOz50p%2Bv-Vag5V%3D3fN8unSrp9L6CQFaP_oeukKnJLX3a7%3DF2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Differences between Django 1.1 and 1.8

2015-07-21 Thread Karthik Reddy
Thank you Lucas Klassmann

On Tuesday, July 21, 2015 at 8:16:58 PM UTC+5:30, Lucas Klassmann wrote:
>
> Hi,
>
> You can check the changes between versions in the release notes: 
> https://docs.djangoproject.com/en/1.8/releases/
>
> If you can, I think you should read a recent book or you will have to read 
> each every difference between versions( And had many important changes).
>
> Cheers.
>
> On Tue, Jul 21, 2015 at 10:30 AM, Karthik Reddy  > wrote:
>
>> Hi experts,
>>
>> I am working on book Beginning Django Ecommerce(1.1).Based on this 
>> document i wanna develop applications in Django(1.8).Please help me getting 
>> the differences between 1.1 and 1.8
>>
>> Thanks,
>> Karthik
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/10c6bd3e-02cd-4f43-84a2-09d3aebd34f5%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Lucas Klassmann
> Desenvolvedor de Software
>
> Email: lucaskl...@gmail.com 
> Web site: http://www.lucasklassmann.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/68473ff7-4225-4820-8d3d-e7ee43598fcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Individual form element modification in Django

2015-07-21 Thread Rafer Johnson
Hi Guys,

I would like to know how I can apply unique identifiers to individual form 
elements. Currently I am trying to apply unique classes to individual 
inputs in a form and finding it impossible based on what I know about 
Django form helpers. I was trying to apply a unique background to each of 
two radio buttons and I had to use JQuery combined with the "for" 
information in the radio button to apply the style since I cannot add a 
class to each element.

Would love to hear if there is another solution to this.

-- 
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/557b9695-0da7-469c-beea-659a2dd811a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a plan to modernize Django-admin?

2015-07-21 Thread Lee Hinde
On Sat, Jul 18, 2015 at 12:25 AM, Stuart Longland <
stua...@longlandclan.yi.org> wrote:

> On 18/07/15 11:00, Ezequiel Bertti wrote:
> > Do you already see this project?
> >
> > https://github.com/sshwsfc/django-xadmin
>
> Unfortunately their homepage just swears at me in Chinese.


http://demo.xadmin.io/

-- 
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/CA%2BePoMwk4Jq5%2Bs%2BdVcHGiAR%3DLnXepCZ0jSL0vs0XkJZ6p1gz7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search Engine using Django-Python

2015-07-21 Thread Manoj Bawane
Hi Daniel,

Yes, I read about Haystack and I am implementing it with Solr and Database 
I am using MySQL. While integrating it I am getting error for ManyToMany 
Model field.
I am getting this error and I am not understand what is going wrong or what 
to do:

Traceback (most recent call last):
  File 
"/usr/local/lib/python2.7/dist-packages/haystack/management/commands/update_index.py",
 
line 210, in handle_label
self.update_backend(label, using)
  File 
"/usr/local/lib/python2.7/dist-packages/haystack/management/commands/update_index.py",
 
line 256, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
  File 
"/usr/local/lib/python2.7/dist-packages/haystack/management/commands/update_index.py",
 
line 78, in do_update
backend.update(index, current_qs)
  File 
"/usr/local/lib/python2.7/dist-packages/haystack/backends/solr_backend.py", 
line 49, in update
docs.append(index.full_prepare(obj))
  File "/usr/local/lib/python2.7/dist-packages/haystack/indexes.py", line 
196, in full_prepare
self.prepared_data = self.prepare(obj)
  File 
"/home/manoj/final-s4s-project/search4school/search4schoolapp/search_indexes.py",
 
line 30, in prepare
data = super(CollegeIndex, self).prepare(obj)
  File "/usr/local/lib/python2.7/dist-packages/haystack/indexes.py", line 
187, in prepare
self.prepared_data[field.index_fieldname] = field.prepare(obj)
  File "/usr/local/lib/python2.7/dist-packages/haystack/fields.py", line 
152, in prepare
return self.convert(super(CharField, self).prepare(obj))
  File "/usr/local/lib/python2.7/dist-packages/haystack/fields.py", line 
100, in prepare
return current_object()
  File 
"/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", 
line 843, in __call__
manager = getattr(self.model, kwargs.pop('manager'))
KeyError: u'manager'

On Monday, 6 July 2015 21:36:43 UTC+5:30, daniel.franca wrote:
>
> Hi Manoj, have you tried Haystack? http://haystacksearch.org/
> It's a simple API to make a search engine using Django, and you can attach 
> any of the available backends (Solr, Elasticsearch, Whoosh or Xapian).
>
> Best,
> Daniel
>
>
> Em seg, 6 de jul de 2015 às 18:01, Manoj Bawane  > escreveu:
>
>> Hi All,
>>
>> I am planning to create a search engine for my city. Can you please 
>> suggest me Which technology I should prefer? I am new with Django, before 
>> that I have work with some web application using Java Spring. But now, I 
>> recently working in one project where I found Django is also nice framework 
>> to develop search engine sites. So Please any one suggest me,
>>
>>1. How should I proceed to do this project using Django,
>>2. What other technology associated with Django which helps to make 
>>searching faster.
>>3. Which Open Source database will better
>>4. Where I can deploy my search engine, (will it need dedicated or 
>>shared host server).
>>
>> Please suggest your valuable opinion.
>>
>>
>> Thanks to everyone.
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/564fdc15-391d-4829-bdb2-96d189d73499%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/376a9618-cccd-4d2b-b170-a930cdf60b06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Easy to use graphical reporting tools for SQL

2015-07-21 Thread Stefano Probst
Know the "non-developers" SQL? I guest not, but if you can try MySQL 
workbench ..

-- 
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/6a7f0ba0-137a-4160-8855-a4eb2e04adc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Thumbnails In Django

2015-07-21 Thread divyanshi kathuria
I am using Django Rest framework. I have three fields in my Pin Model : 
image,thumbnail_medium and thumbnail_small. I want to create two thumbnails 
from the image. How to do that? I tried the following code : But it's not 
working.
from django.db import models
from django.contrib.auth.models import User
from thumbs import ImageWithThumbsField
#from taggit.managers import TaggableManager
from PIL import Image
from cStringIO import StringIO
from django.core.files.uploadedfile import SimpleUploadedFile
import os


class Pin(models.Model):

url = models.SlugField(blank=True, null=True)
title = models.TextField(blank=False,null=False,default='Untitled')
description = models.TextField(blank=True, null=True)
is_pro = models.BooleanField(default=False)
is_hidden = models.BooleanField(default=False)
is_for_sale = models.BooleanField(default=False)
is_pro = models.BooleanField(default=False)
price = models.DecimalField(blank=True, null=True, max_digits=10, 
decimal_places=2 ,default=0)
price_in_rs = models.BooleanField(default=False)
size_in_inches = models.BooleanField(default=True)
medium = models.TextField(blank=True, null=True)
length = models.DecimalField(blank=True, null=True, max_digits=10, 
decimal_places=2 ,default=0)
width = models.DecimalField(blank=True, null=True, max_digits=10, 
decimal_places=2 ,default=0)
hearts = models.IntegerField(blank=True, null=True, default=0)
image = models.ImageField(upload_to='pins/pin/originals/')
thumbnail = models.ImageField(upload_to='pins/pin/thumbnails/')
published = models.DateTimeField(auto_now_add=True)
#tags = TaggableManager()

def __unicode__(self):
return self.url

def save(self):
from PIL import Image
from cStringIO import StringIO
from django.core.files.uploadedfile import SimpleUploadedFile

# Set our max thumbnail size in a tuple (max width, max height)
THUMBNAIL_SIZE = (50, 50)

# Open original photo which we want to thumbnail using PIL's Image
# object
image = Image.open(self.image.name)

# Convert to RGB if necessary
# Thanks to Limodou on DjangoSnippets.org
# http://www.djangosnippets.org/snippets/20/
if image.mode not in ('L', 'RGB'):
image = image.convert('RGB')

# We use our PIL Image object to create the thumbnail, which already
# has a thumbnail() convenience method that contrains proportions.
# Additionally, we use Image.ANTIALIAS to make the image look 
better.
# Without antialiasing the image pattern artifacts may result.
image.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS)

# Save the thumbnail
temp_handle = StringIO()
image.save(temp_handle, 'png')
temp_handle.seek(0)

# Save to the thumbnail field
suf = SimpleUploadedFile(os.path.split(self.image.name)[-1],
temp_handle.read(), content_type='image/png')
self.thumbnail.save(suf.name+'.png', suf, save=False)

# Save this photo instance
super(Pin, self).save() 

Can anyone figure out the problem here? Why is it not creating thumbnails?

-- 
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/13e46569-3641-438d-9201-fa079f7f89b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Easy to use graphical reporting tools for SQL

2015-07-21 Thread Vijay Khemlani
I guess any kind of report they want to generate will require some
knowledge of relational databases.

Considering that, I think Jasper Reports is a good tradeoff, It has a
graphical interface to create the queries, and the reports can be accessed
by anyone after it's query and design is done.

On Tue, Jul 21, 2015 at 4:20 PM, Stefano Probst  wrote:

> Know the "non-developers" SQL? I guest not, but if you can try MySQL
> workbench ..
>
> --
> 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/6a7f0ba0-137a-4160-8855-a4eb2e04adc1%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0cG%3DYJDcH_xZVPpi%2B8g6YkP3u%3DpRmTySEUPryVyVNEYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Easy to use graphical reporting tools for SQL

2015-07-21 Thread Lee Hinde
https://github.com/epantry/django-sql-explorer

You can build the queries and they're available to whomever you want to
give access. This assumes they have access to the django app.



On Mon, Jul 20, 2015 at 2:09 PM, Kevin  wrote:

> In our office we have a Django application that uses a MySQL database.
> Often I am asked to produce various reports that can range from being basic
> dumps of query results or aggregate computations on query results. To do
> this I must connect to the Django shell to use the ORM or write the SQL
> directly. The problem is that it is impossible for the non-developers to
> access reports unless they ask a developer to create the queries, run them,
> and send the result back. This adds to lots of communication overhead and
> delays.
>
> Is there a basic free or open-source application that can connect to MySQL
> and allow non-developers to graphically build their own queries?
>
>
>

-- 
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/CA%2BePoMzwo_KD_5NHPd7gtN1b9rrCi0F6b%3Do%3DqPYT%3D%3D2W%3DamwSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Thumbnails In Django

2015-07-21 Thread Sadaf Noor
In one of my projects I used sorl (
https://github.com/mariocesar/sorl-thumbnail) instead, it was super easy
and best fit for my project. Every time it asks for a new thumbnail BUT if
it exists in its cache, then that one is returned. If it doesn't, a new one
is generated and stored, then returned. So ultimately it saves. I don't
know your use case. I am just saying it can be an option.

2015-07-22 1:22 GMT+06:00 divyanshi kathuria :

> I am using Django Rest framework. I have three fields in my Pin Model :
> image,thumbnail_medium and thumbnail_small. I want to create two thumbnails
> from the image. How to do that? I tried the following code : But it's not
> working.
> from django.db import models
> from django.contrib.auth.models import User
> from thumbs import ImageWithThumbsField
> #from taggit.managers import TaggableManager
> from PIL import Image
> from cStringIO import StringIO
> from django.core.files.uploadedfile import SimpleUploadedFile
> import os
>
>
> class Pin(models.Model):
>
> url = models.SlugField(blank=True, null=True)
> title = models.TextField(blank=False,null=False,default='Untitled')
> description = models.TextField(blank=True, null=True)
> is_pro = models.BooleanField(default=False)
> is_hidden = models.BooleanField(default=False)
> is_for_sale = models.BooleanField(default=False)
> is_pro = models.BooleanField(default=False)
> price = models.DecimalField(blank=True, null=True, max_digits=10,
> decimal_places=2 ,default=0)
> price_in_rs = models.BooleanField(default=False)
> size_in_inches = models.BooleanField(default=True)
> medium = models.TextField(blank=True, null=True)
> length = models.DecimalField(blank=True, null=True, max_digits=10,
> decimal_places=2 ,default=0)
> width = models.DecimalField(blank=True, null=True, max_digits=10,
> decimal_places=2 ,default=0)
> hearts = models.IntegerField(blank=True, null=True, default=0)
> image = models.ImageField(upload_to='pins/pin/originals/')
> thumbnail = models.ImageField(upload_to='pins/pin/thumbnails/')
> published = models.DateTimeField(auto_now_add=True)
> #tags = TaggableManager()
>
> def __unicode__(self):
> return self.url
>
> def save(self):
> from PIL import Image
> from cStringIO import StringIO
> from django.core.files.uploadedfile import SimpleUploadedFile
>
> # Set our max thumbnail size in a tuple (max width, max height)
> THUMBNAIL_SIZE = (50, 50)
>
> # Open original photo which we want to thumbnail using PIL's Image
> # object
> image = Image.open(self.image.name)
>
> # Convert to RGB if necessary
> # Thanks to Limodou on DjangoSnippets.org
> # http://www.djangosnippets.org/snippets/20/
> if image.mode not in ('L', 'RGB'):
> image = image.convert('RGB')
>
> # We use our PIL Image object to create the thumbnail, which
> already
> # has a thumbnail() convenience method that contrains proportions.
> # Additionally, we use Image.ANTIALIAS to make the image look
> better.
> # Without antialiasing the image pattern artifacts may result.
> image.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS)
>
> # Save the thumbnail
> temp_handle = StringIO()
> image.save(temp_handle, 'png')
> temp_handle.seek(0)
>
> # Save to the thumbnail field
> suf = SimpleUploadedFile(os.path.split(self.image.name)[-1],
> temp_handle.read(), content_type='image/png')
> self.thumbnail.save(suf.name+'.png', suf, save=False)
>
> # Save this photo instance
> super(Pin, self).save()
>
> Can anyone figure out the problem here? Why is it not creating thumbnails?
>
> --
> 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/13e46569-3641-438d-9201-fa079f7f89b2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
  Md. Sadaf Noor (@sadaf2605 )
 www.sadafnoor.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 disc

Re: Differences between Django 1.1 and 1.8

2015-07-21 Thread aCHIAO
I am reading this book too

2015-07-21 23:08 GMT+08:00 Karthik Reddy :

> Thank you Lucas Klassmann
>
> On Tuesday, July 21, 2015 at 8:16:58 PM UTC+5:30, Lucas Klassmann wrote:
>>
>> Hi,
>>
>> You can check the changes between versions in the release notes:
>> https://docs.djangoproject.com/en/1.8/releases/
>>
>> If you can, I think you should read a recent book or you will have to
>> read each every difference between versions( And had many important
>> changes).
>>
>> Cheers.
>>
>> On Tue, Jul 21, 2015 at 10:30 AM, Karthik Reddy 
>> wrote:
>>
>>> Hi experts,
>>>
>>> I am working on book Beginning Django Ecommerce(1.1).Based on this
>>> document i wanna develop applications in Django(1.8).Please help me getting
>>> the differences between 1.1 and 1.8
>>>
>>> Thanks,
>>> Karthik
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@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/10c6bd3e-02cd-4f43-84a2-09d3aebd34f5%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Lucas Klassmann
>> Desenvolvedor de Software
>>
>> Email: lucaskl...@gmail.com
>> Web site: http://www.lucasklassmann.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/68473ff7-4225-4820-8d3d-e7ee43598fcb%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAByAZ57PeiGTsRL_fizHbr%3DQeJq%2B1LcqkyYyP3qRApjMhqCbDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Thumbnails In Django

2015-07-21 Thread Robin Lery
Yes. I would like to add easy-thumbnails too. Both are great!
On 22 Jul 2015 01:05, "Sadaf Noor"  wrote:

> In one of my projects I used sorl (
> https://github.com/mariocesar/sorl-thumbnail) instead, it was super easy
> and best fit for my project. Every time it asks for a new thumbnail BUT
> if it exists in its cache, then that one is returned. If it doesn't, a
> new one is generated and stored, then returned. So ultimately it saves. I
> don't know your use case. I am just saying it can be an option.
>
> 2015-07-22 1:22 GMT+06:00 divyanshi kathuria 
> :
>
>> I am using Django Rest framework. I have three fields in my Pin Model :
>> image,thumbnail_medium and thumbnail_small. I want to create two thumbnails
>> from the image. How to do that? I tried the following code : But it's not
>> working.
>> from django.db import models
>> from django.contrib.auth.models import User
>> from thumbs import ImageWithThumbsField
>> #from taggit.managers import TaggableManager
>> from PIL import Image
>> from cStringIO import StringIO
>> from django.core.files.uploadedfile import SimpleUploadedFile
>> import os
>>
>>
>> class Pin(models.Model):
>>
>> url = models.SlugField(blank=True, null=True)
>> title = models.TextField(blank=False,null=False,default='Untitled')
>> description = models.TextField(blank=True, null=True)
>> is_pro = models.BooleanField(default=False)
>> is_hidden = models.BooleanField(default=False)
>> is_for_sale = models.BooleanField(default=False)
>> is_pro = models.BooleanField(default=False)
>> price = models.DecimalField(blank=True, null=True, max_digits=10,
>> decimal_places=2 ,default=0)
>> price_in_rs = models.BooleanField(default=False)
>> size_in_inches = models.BooleanField(default=True)
>> medium = models.TextField(blank=True, null=True)
>> length = models.DecimalField(blank=True, null=True, max_digits=10,
>> decimal_places=2 ,default=0)
>> width = models.DecimalField(blank=True, null=True, max_digits=10,
>> decimal_places=2 ,default=0)
>> hearts = models.IntegerField(blank=True, null=True, default=0)
>> image = models.ImageField(upload_to='pins/pin/originals/')
>> thumbnail = models.ImageField(upload_to='pins/pin/thumbnails/')
>> published = models.DateTimeField(auto_now_add=True)
>> #tags = TaggableManager()
>>
>> def __unicode__(self):
>> return self.url
>>
>> def save(self):
>> from PIL import Image
>> from cStringIO import StringIO
>> from django.core.files.uploadedfile import SimpleUploadedFile
>>
>> # Set our max thumbnail size in a tuple (max width, max height)
>> THUMBNAIL_SIZE = (50, 50)
>>
>> # Open original photo which we want to thumbnail using PIL's Image
>> # object
>> image = Image.open(self.image.name)
>>
>> # Convert to RGB if necessary
>> # Thanks to Limodou on DjangoSnippets.org
>> # http://www.djangosnippets.org/snippets/20/
>> if image.mode not in ('L', 'RGB'):
>> image = image.convert('RGB')
>>
>> # We use our PIL Image object to create the thumbnail, which
>> already
>> # has a thumbnail() convenience method that contrains proportions.
>> # Additionally, we use Image.ANTIALIAS to make the image look
>> better.
>> # Without antialiasing the image pattern artifacts may result.
>> image.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS)
>>
>> # Save the thumbnail
>> temp_handle = StringIO()
>> image.save(temp_handle, 'png')
>> temp_handle.seek(0)
>>
>> # Save to the thumbnail field
>> suf = SimpleUploadedFile(os.path.split(self.image.name)[-1],
>> temp_handle.read(), content_type='image/png')
>> self.thumbnail.save(suf.name+'.png', suf, save=False)
>>
>> # Save this photo instance
>> super(Pin, self).save()
>>
>> Can anyone figure out the problem here? Why is it not creating thumbnails?
>>
>> --
>> 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/13e46569-3641-438d-9201-fa079f7f89b2%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>   Md. Sadaf Noor (@sadaf2605 )
>  www.sadafnoor.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop re

Re: Thumbnails In Django

2015-07-21 Thread Ezequiel Bertti
easy-thumbnails +1


-- 
Ezequiel Bertti
E-Mail: eber...@gmail.com
Cel: (21) 99188-4860

-- 
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/CACrQMYqe5jTcMV%2BWJ-Y%3DSY7PrMKyXAnR2Yeo4uc_MSpDbK86ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHOP APP

2015-07-21 Thread Russell Keith-Magee
On Tue, Jul 21, 2015 at 7:11 PM, dravid rahul  wrote:

> Hi can anyone please help me with this.. I am newbie to django.
>
> PLEASE FIND BELOW ATTACHMENT
>
> Thanks in Advance
> Dravid
>

Dravid - we're not going to do your homework for you. You've been given a
task for assessment purposes - the whole point is that you do the work
yourself.

We're happy to answer questions, but they need to be specific questions
about usage, not "can you do this for me".

Yours,
Russ Magee %-)

-- 
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/CAJxq84-tBeir0qSbARb0Djg%3D%2BsZoM%2BXK6rat85e22D%3DtZ00Liw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHOP APP

2015-07-21 Thread Cesar Mojarro
hahaha!
Can you do my homework?

On Tue, Jul 21, 2015 at 4:59 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

>
> On Tue, Jul 21, 2015 at 7:11 PM, dravid rahul  wrote:
>
>> Hi can anyone please help me with this.. I am newbie to django.
>>
>> PLEASE FIND BELOW ATTACHMENT
>>
>> Thanks in Advance
>> Dravid
>>
>
> Dravid - we're not going to do your homework for you. You've been given a
> task for assessment purposes - the whole point is that you do the work
> yourself.
>
> We're happy to answer questions, but they need to be specific questions
> about usage, not "can you do this for me".
>
> Yours,
> Russ Magee %-)
>
>
>  --
> 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/CAJxq84-tBeir0qSbARb0Djg%3D%2BsZoM%2BXK6rat85e22D%3DtZ00Liw%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHXGZtqGTZt33HBH-GAY84X4EStrb4Ts3-iujA96YGGXXit_sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHOP APP

2015-07-21 Thread Gergely Polonkai
…anyways, I'm not really sure it can be done in mere 6 hours. Or if so, I
wouldn't dare to deploy it to production :)
On 22 Jul 2015 00:06, "Cesar Mojarro"  wrote:

> hahaha!
> Can you do my homework?
>
> On Tue, Jul 21, 2015 at 4:59 PM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>>
>> On Tue, Jul 21, 2015 at 7:11 PM, dravid rahul 
>> wrote:
>>
>>> Hi can anyone please help me with this.. I am newbie to django.
>>>
>>> PLEASE FIND BELOW ATTACHMENT
>>>
>>> Thanks in Advance
>>> Dravid
>>>
>>
>> Dravid - we're not going to do your homework for you. You've been given a
>> task for assessment purposes - the whole point is that you do the work
>> yourself.
>>
>> We're happy to answer questions, but they need to be specific questions
>> about usage, not "can you do this for me".
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>>  --
>> 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/CAJxq84-tBeir0qSbARb0Djg%3D%2BsZoM%2BXK6rat85e22D%3DtZ00Liw%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHXGZtqGTZt33HBH-GAY84X4EStrb4Ts3-iujA96YGGXXit_sQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJqX1_t-Va2JJ5ty15%2B-YLSqVycXWBzhPxuTNAibfV1OQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Individual form element modification in Django

2015-07-21 Thread Russell Keith-Magee
Hi Rafer,

I think what you're looking for is the "attrs" argument on a form widget.

https://docs.djangoproject.com/en/1.8/ref/forms/widgets/#django.forms.Widget.attrs

That page has some examples showing adding a class to a field as a specific
example:

class CommentForm(forms.Form):
name = forms.CharField(widget=forms.TextInput(attrs={'class':
'special'}))
url = forms.URLField()
comment = forms.CharField(widget=forms.TextInput(attrs={'size': '40'}))

Yours,
Russ Magee %-)


On Wed, Jul 22, 2015 at 12:05 AM, Rafer Johnson  wrote:

> Hi Guys,
>
> I would like to know how I can apply unique identifiers to individual form
> elements. Currently I am trying to apply unique classes to individual
> inputs in a form and finding it impossible based on what I know about
> Django form helpers. I was trying to apply a unique background to each of
> two radio buttons and I had to use JQuery combined with the "for"
> information in the radio button to apply the style since I cannot add a
> class to each element.
>
> Would love to hear if there is another solution to this.
>
> --
> 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/557b9695-0da7-469c-beea-659a2dd811a3%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84-R21sFvdCTBpCFHT%2BZJU73FVJ4n9sYFi6OV2mheMAszw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Using Django FormPreview the right way

2015-07-21 Thread Steve SanPietro
Hi All,

I have a Django project with a form, and I want to display a preview page 
before the user submits.  I can display a preview page using a Django 
FormPreview, but not all form data is displayed properly. Specifically, if 
I have a model field with choices, the string values of these choices 
aren't displayed properly when I use the get_FOO_display method - they 
display as blanks instead.  I'm also having problems applying template 
filters to date fields. The end result is that some data on the preview 
page is visible but other data is blank:

I've posted a question about this topic on StackOverflow here 
,
 
but so far, no one has been able to answer it.  I'm not sure if it's 
considered good etiquette to link to StackOverflow questions on this 
mailing list, so if this is inappropriate, please let me know.  If not, I'd 
greatly appreciate it if anyone here would be able to answer this question.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/db450332-06ea-4414-b67a-1d2356d56051%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Okay so has nothing to do with programming, and everything to do with the future of Humanity

2015-07-21 Thread JJ Zolper
Brandon,

I think we may be talking about different aspects of running a website. 
Using a CMS is another topic in relation to what I was aiming for.

I'm referring to the skills involved in managing the server infrastructure 
of a live website, not managing the content of a live website. I'm talking 
about things like Amazon Web Services, load balancing, caching, and so on.

I got railed big time before because I suggest the community leverage the 
skills of: https://highperformancedjango.com/.

Okay sure I get it the guy's at Lincoln Loop wrote the book and they are 
best friends with the Django community, but I don't think that should stop 
the community from either writing out own interpretation of what it takes 
to be the sys admin of a live website at the technology level. We need to 
begin working together to create consensus and sharing knowledge. We need 
to begin learning from each other in the public eye. If we want Django to 
be the best it can be we need to have a real discussion about how we can go 
about writing docs on the tools and skills needed for running a live Django 
website. I don't care how the Django higher ups want to do it but I think 
it's something we need to at least get the ball rolling on. I know it's 
more work but it's something we can just keep iterating on as a community 
slowly but surely.

Brandon, the only part I see being relevant to what this thread is about is 
running a server for a game. For client vs server side you would use AJAX / 
Javascript on the client and Django on the server side. The scores thing is 
something you will have to do some research on first. Learn the basics 
before you try to run.

JJ

-- 
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/d605b9bd-be4e-456d-8610-df444b26fbd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Okay so has nothing to do with programming, and everything to do with the future of Humanity

2015-07-21 Thread JJ Zolper
I do want to append to my remarks that I am very appreciative of some of 
the new documentation under performance, optimization, etc. I just think if 
say we could bring in some big guns that have dealt with big time websites 
in the wild that would be super dynamic for our community. People who know 
first hand what to do with subjects such as load balancing, sharding, 
server crashes, scaling, monitoring, and every other fun thing one must 
deal with out in the wild.

Thanks to all.

<3 JJ

-- 
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/49d1ed20-6901-4c47-8405-4115810175c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Okay so has nothing to do with programming, and everything to do with the future of Humanity

2015-07-21 Thread Brandon Keith Biggs

Hello,
I am talking about even more basic than this.

◾ Should I use Apache, Gunicorn, uWSGI or something else?

Honestly I have only heard of Apache and have only seen Gunicorn in 
relation to Mezzanine. I have no idea what Gunicorn is!


◾ Where should I use caching to make things faster?

I know this because I've been building WordPress websites for about a 
year now, so sometimes I need to worry about caching, but how to do this 
with Django, I have no idea.


◾ How do I know if my database has the right indexes or if it needs more 
resources?


Frankly, I know nothing about DBs other than sqlite is a nice place to 
store data and is an alternative to pickling if one wishes to save lots 
of data across sessions. I know most places use My SQL, but I've never 
seen any reason to go away from sqlite and I just do it because people 
say I should.


◾ Do I need a NoSQL database like MongoDB?

What is MongoDB?

◾ The site runs great on my laptop. Why is it so slow in production?

Erm because you either are running off your home computer which needs to 
send data through your personal router or because your server is horrible.


◾ How many servers does my site need? How big should they be?

I never considered a site would need to have more than 1...

◾ What is the 20% effort that will solve 80% of my performance problems?

Probably using python and brython rather than PHP and Javascript...

So I know python really well, I just know nothing about web development. 
The most difficult parts of django are figuring out how get and post 
work, writing templates, dealing with the DB API and deploying.


The building your first app in django tutorial is great, but I kind of 
would like a couple more completely different apps. I just don't 
understand how the web works from such a short tutorial.
Django claims that it is not magic, but for me, most of it is magic at 
this point. Sometimes the connections are really difficult to follow. 
Sometimes I don't want to know some of the connections, I just want to 
know what they do and why. It is like event queues in a game engine. One 
doesn't need to know what kind of event queue the engine is running in 
order to capture the different events or how they use different threads 
to grab input, but I do need to know that when the user hits enter my 
on_input or my on_keydown function will run.


But when people throw around terms like Ajax, caching, Gunicorn, uWSGI, 
database, URI, canonical request or anything like that, people who have 
never worked with the web kind of nod and say oh yeah, yep! What ever 
you say!
So I would say the tutorial you pointed to looks like an intermediate or 
advanced newbie tutorial. Not really basic at all.

Thanks,

Brandon Keith Biggs 
On 7/22/2015 5:04 AM, JJ Zolper wrote:

Brandon,

I think we may be talking about different aspects of running a 
website. Using a CMS is another topic in relation to what I was aiming 
for.


I'm referring to the skills involved in managing the server 
infrastructure of a live website, not managing the content of a live 
website. I'm talking about things like Amazon Web Services, load 
balancing, caching, and so on.


I got railed big time before because I suggest the community leverage 
the skills of: https://highperformancedjango.com/.


Okay sure I get it the guy's at Lincoln Loop wrote the book and they 
are best friends with the Django community, but I don't think that 
should stop the community from either writing out own interpretation 
of what it takes to be the sys admin of a live website at the 
technology level. We need to begin working together to create 
consensus and sharing knowledge. We need to begin learning from each 
other in the public eye. If we want Django to be the best it can be we 
need to have a real discussion about how we can go about writing docs 
on the tools and skills needed for running a live Django website. I 
don't care how the Django higher ups want to do it but I think it's 
something we need to at least get the ball rolling on. I know it's 
more work but it's something we can just keep iterating on as a 
community slowly but surely.


Brandon, the only part I see being relevant to what this thread is 
about is running a server for a game. For client vs server side you 
would use AJAX / Javascript on the client and Django on the server 
side. The scores thing is something you will have to do some research 
on first. Learn the basics before you try to run.


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

Re: Differences between Django 1.1 and 1.8

2015-07-21 Thread Karthik Reddy
Hi Achiao,

I am a little bit confused with small task given to me . Which is related
to e-commerce shopping app.If you can do it i will give you the document



On Wed, Jul 22, 2015 at 2:49 AM, aCHIAO  wrote:

> I am reading this book too
>
> 2015-07-21 23:08 GMT+08:00 Karthik Reddy :
>
>> Thank you Lucas Klassmann
>>
>> On Tuesday, July 21, 2015 at 8:16:58 PM UTC+5:30, Lucas Klassmann wrote:
>>>
>>> Hi,
>>>
>>> You can check the changes between versions in the release notes:
>>> https://docs.djangoproject.com/en/1.8/releases/
>>>
>>> If you can, I think you should read a recent book or you will have to
>>> read each every difference between versions( And had many important
>>> changes).
>>>
>>> Cheers.
>>>
>>> On Tue, Jul 21, 2015 at 10:30 AM, Karthik Reddy 
>>> wrote:
>>>
 Hi experts,

 I am working on book Beginning Django Ecommerce(1.1).Based on this
 document i wanna develop applications in Django(1.8).Please help me getting
 the differences between 1.1 and 1.8

 Thanks,
 Karthik

 --
 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...@googlegroups.com.
 To post to this group, send email to django...@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/10c6bd3e-02cd-4f43-84a2-09d3aebd34f5%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> --
>>> Lucas Klassmann
>>> Desenvolvedor de Software
>>>
>>> Email: lucaskl...@gmail.com
>>> Web site: http://www.lucasklassmann.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/68473ff7-4225-4820-8d3d-e7ee43598fcb%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/YftXKFxSkeY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAByAZ57PeiGTsRL_fizHbr%3DQeJq%2B1LcqkyYyP3qRApjMhqCbDg%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH6_U_YU_U7PnQNBU69cxLntzQ_Q_TJDvbjfNVHdmv0RT2GqXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHOP APP

2015-07-21 Thread dravid rahul
Hi Russ,

I am not asking to do my homework.But the thing is i cant find any document
related to develop such application.If you can just help me how to approach
the solution.

Thanks
Dravid

On Wed, Jul 22, 2015 at 3:29 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

>
> On Tue, Jul 21, 2015 at 7:11 PM, dravid rahul  wrote:
>
>> Hi can anyone please help me with this.. I am newbie to django.
>>
>> PLEASE FIND BELOW ATTACHMENT
>>
>> Thanks in Advance
>> Dravid
>>
>
> Dravid - we're not going to do your homework for you. You've been given a
> task for assessment purposes - the whole point is that you do the work
> yourself.
>
> We're happy to answer questions, but they need to be specific questions
> about usage, not "can you do this for me".
>
> Yours,
> Russ Magee %-)
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/hSh_Ob6Du1w/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAJxq84-tBeir0qSbARb0Djg%3D%2BsZoM%2BXK6rat85e22D%3DtZ00Liw%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADhc5u1ZA3FPstJ1uwPn3Fbkt2LLBWpfs%2B2XS36w%3Dd_sf9_dKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHOP APP

2015-07-21 Thread dravid rahul
Hi Naco,

I cant do your homework but i can tell you how to workout a problem if i am 
experienced


On Wednesday, July 22, 2015 at 3:36:57 AM UTC+5:30, Naco wrote:
>
> hahaha!
> Can you do my homework?
>
> On Tue, Jul 21, 2015 at 4:59 PM, Russell Keith-Magee <
> rus...@keith-magee.com > wrote:
>
>>
>> On Tue, Jul 21, 2015 at 7:11 PM, dravid rahul > > wrote:
>>
>>> Hi can anyone please help me with this.. I am newbie to django.
>>>
>>> PLEASE FIND BELOW ATTACHMENT
>>>
>>> Thanks in Advance
>>> Dravid
>>>
>>
>> Dravid - we're not going to do your homework for you. You've been given a 
>> task for assessment purposes - the whole point is that you do the work 
>> yourself.
>>
>> We're happy to answer questions, but they need to be specific questions 
>> about usage, not "can you do this for me".
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/CAJxq84-tBeir0qSbARb0Djg%3D%2BsZoM%2BXK6rat85e22D%3DtZ00Liw%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75e93b48-7fa9-4a7f-90ac-633495c8edb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a plan to modernize Django-admin?

2015-07-21 Thread Ezequiel

On Monday, July 20, 2015 at 3:58:31 AM UTC-3, Derek wrote:
>
> You can also look at http://djangosuit.com/ - works very well.  Free for 
> non-commercial projects.  In the middle of an upgrade to Bootstrap 3.
>

Looks very good, but it is not responsive and suitable for mobile, right?
Regards
http://flickrock.com/mikelpierre 

-- 
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/f708fdb5-5c79-4775-9cd3-496d99ca6316%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a plan to modernize Django-admin?

2015-07-21 Thread Ezequiel Bertti
I use djangosuit.

It's great. I recommend.

But is better skin with some new features for django admin. Not a new
"django admin"



On Wed, Jul 22, 2015 at 1:46 AM, Ezequiel  wrote:

>
> On Monday, July 20, 2015 at 3:58:31 AM UTC-3, Derek wrote:
>>
>> You can also look at http://djangosuit.com/ - works very well.  Free for
>> non-commercial projects.  In the middle of an upgrade to Bootstrap 3.
>>
>
> Looks very good, but it is not responsive and suitable for mobile, right?
> Regards
> http://flickrock.com/mikelpierre
>
> --
> 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/f708fdb5-5c79-4775-9cd3-496d99ca6316%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Ezequiel Bertti
E-Mail: eber...@gmail.com
Cel: (21) 99188-4860

-- 
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/CACrQMYqL%2B7mZqawEdq9ksZ41-XE-E5eR9XOQKpiR7xe%2Bnu3vXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem rendering media files in template during development

2015-07-21 Thread charito.romeo
Never mind. I figured it out. For some reason, {{ MEDIA_URL }} doesn't work 
 but {{ media_url }} does. Now all my movies and images are rendered. 
Cheers. :)

On Monday, July 20, 2015 at 3:16:52 PM UTC+8, charito.romeo wrote:
>
> Hi django folks, 
>
> I ran into a hiccup when I was rendering media files in templates during 
> development. I wanted to render the image and the video that was uploaded 
> by the user BUT instead of the contents of the image and the video being 
> rendered,  the name of the file was rendered instead.
>
> I am using python 2.7.9 and django 1.8.3. Here are my  codes relevant to 
> the question I'm asking:
>
> settings.py
>
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>
> STATIC_URL = '/static/'
>
> STATIC_PATH = (os.path.join(BASE_DIR, 'static'),
>'/var/www/static/',)
>
> STATICFILES_DIRS = (
> STATIC_PATH,
> )
> MEDIA_URL = '/media/'
>
>
>
>
> my models.py:
>
> class Entry(models.Model):
> VIDEO_ENTRY_TYPE = (
> ('SEMINAR', 'Seminar'),
> ('LECTURE', 'Lecture'),
> ('TALK', 'Talk'),   
> )
> user = models.ForeignKey(User)
> video = models.FileField(upload_to='video_entries')
> entry_type = models.CharField(max_length=100, choices=VIDEO_ENTRY_TYPE)
> title = models.CharField(max_length=250)
>
>
> class EntryForm(ModelForm):   
> class Meta:
> model = Entry
> fields = ['video', 'entry_type', 'title']
>  
>
> my views.py:
> from django.shortcuts import render
> from django.http import HttpResponseRedirect
> from django.http import HttpResponse
> from django.views.generic import ListView
>
> from . models import User, Entry, EntryForm
>
> class IndexView(ListView):
> template_name = 'pi_app/index.html'
> context_object_name = 'latest_seminars'
> 
> def get_queryset(self):
> return 
> Entry.objects.filter(entry_type='SEMINAR').order_by('-pub_date') [:10]
>  
> def get_context_data(self, **kwargs):
> context = super(IndexView, self).get_context_data(**kwargs)
> context['latest_lectures'] = 
> Entry.objects.filter(entry_type='LECTURE').order_by('-pub_date') [:10]
> context['latest_talks'] = 
> Entry.objects.filter(entry_type='TALK').order_by('-pub_date') [:10]
>
> my urls.py:
>
> from django.conf.urls import url
> from django.conf import settings
> from django.conf.urls.static import static
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.IndexView.as_view(), name='index'),
> url(r'^upload_file/$', views.upload_file, name='upload_file')
> ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
>
> my template.py:
> 
>
> {% load staticfiles %}
>
> 
> 
> Homepage
> 
> 
> 
>  Welcome {{ user }} 
> 
>  
> 
> {% block seminar %}
> 
> 
> Most Recent Seminars
> 
> {% if latest_seminars %}
> 
> {% for seminar in latest_seminars %}
> 
> 
> 
> 
> {{ seminar.title }} by {{ seminar.user }}
> {% endfor %}
> 
> {% endif %}
> 
> {% endblock seminar %}
> 
>
>
> Normally, the video or the image will be rendered. In my case, its not 
> rendered. What is rendered instead is the name of the movie file 
> (media/video_entries/name_of _movie_file)  or the name of the image file 
>  (media/video_entries/name_of _image_file). All the other variables are 
> rendered correctly  except the media files. What am I missing? Please 
> enligthen me. Your help is hightly appreciated.  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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6168e60f-a22c-404c-afd6-0e96e077d1a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem rendering media files in template during development

2015-07-21 Thread ltc.hotspot
Hi Charito,


What tool did you use to insert your python codes into the marked  fields 
below, i.e., settings.py, my models.py, etc?


Regards,

Hal






Sent from Surface





From: charito.romeo
Sent: ‎Tuesday‎, ‎July‎ ‎21‎, ‎2015 ‎10‎:‎20‎ ‎PM
To: django-users@googlegroups.com





Never mind. I figured it out. For some reason, {{ MEDIA_URL }} doesn't work  
but {{ media_url }} does. Now all my movies and images are rendered. Cheers. :)

On Monday, July 20, 2015 at 3:16:52 PM UTC+8, charito.romeo wrote:

Hi django folks, 



I ran into a hiccup when I was rendering media files in templates during 
development. I wanted to render the image and the video that was uploaded by 
the user BUT instead of the contents of the image and the video being rendered, 
 the name of the file was rendered instead.




I am using python 2.7.9 and django 1.8.3. Here are my  codes relevant to the 
question I'm asking:




settings.py




BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


STATIC_URL = '/static/'




STATIC_PATH = (os.path.join(BASE_DIR, 'static'),

   '/var/www/static/',)




STATICFILES_DIRS = (

STATIC_PATH,

)

MEDIA_URL = '/media/'









my models.py:






class Entry(models.Model):

VIDEO_ENTRY_TYPE = (

('SEMINAR', 'Seminar'),

('LECTURE', 'Lecture'),

('TALK', 'Talk'),   

)

user = models.ForeignKey(User)

video = models.FileField(upload_to='video_entries')

entry_type = models.CharField(max_length=100, choices=VIDEO_ENTRY_TYPE)

title = models.CharField(max_length=250)




class EntryForm(ModelForm):   

class Meta:

model = Entry

fields = ['video', 'entry_type', 'title']

 


my views.py:





from django.shortcuts import render

from django.http import HttpResponseRedirect

from django.http import HttpResponse

from django.views.generic import ListView




from . models import User, Entry, EntryForm

class IndexView(ListView):
template_name = 'pi_app/index.html'

context_object_name = 'latest_seminars'



def get_queryset(self):

return Entry.objects.filter(entry_type='SEMINAR').order_by('-pub_date') 
[:10]

 

def get_context_data(self, **kwargs):

context = super(IndexView, self).get_context_data(**kwargs)

context['latest_lectures'] = 
Entry.objects.filter(entry_type='LECTURE').order_by('-pub_date') [:10]

context['latest_talks'] = 
Entry.objects.filter(entry_type='TALK').order_by('-pub_date') [:10]

my urls.py:






from django.conf.urls import url

from django.conf import settings

from django.conf.urls.static import static




from . import views




urlpatterns = [

url(r'^$', views.IndexView.as_view(), name='index'),

url(r'^upload_file/$', views.upload_file, name='upload_file')

]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)




my template.py:








{% load staticfiles %}








Homepage







 Welcome {{ user }} 


 



{% block seminar %}





Most Recent Seminars



{% if latest_seminars %}



{% for seminar in latest_seminars %}









{{ seminar.title }} by {{ seminar.user }}

{% endfor %}



{% endif %}



{% endblock seminar %}






Normally, the video or the image will be rendered. In my case, its not 
rendered. What is rendered instead is the name of the movie file 
(media/video_entries/name_of _movie_file)  or the name of the image file  
(media/video_entries/name_of _image_file). All the other variables are rendered 
correctly  except the media files. What am I missing? Please enligthen me. Your 
help is hightly appreciated.  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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6168e60f-a22c-404c-afd6-0e96e077d1a3%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msg

Re: Problem rendering media files in template during development

2015-07-21 Thread Charito Romeo
Hi Hal,

I'm using the code icon right on top of the gmail textbox. Click on the { }
icon which is last icon on the top right of your text box.

On Wed, Jul 22, 2015 at 1:26 PM,  wrote:

>  Hi Charito,
>
> What tool did you use to insert your python codes into the marked  fields
> below, i.e., settings.py, my models.py, etc?
>
> Regards,
> Hal
>
> Sent from Surface
>
> *From:* charito.romeo 
> *Sent:* ‎Tuesday‎, ‎July‎ ‎21‎, ‎2015 ‎10‎:‎20‎ ‎PM
> *To:* django-users@googlegroups.com
>
> Never mind. I figured it out. For some reason, {{ MEDIA_URL }} doesn't
> work  but {{ media_url }} does. Now all my movies and images are rendered.
> Cheers. :)
>
> On Monday, July 20, 2015 at 3:16:52 PM UTC+8, charito.romeo wrote:
>>
>> Hi django folks,
>>
>> I ran into a hiccup when I was rendering media files in templates during
>> development. I wanted to render the image and the video that was uploaded
>> by the user BUT instead of the contents of the image and the video being
>> rendered,  the name of the file was rendered instead.
>>
>> I am using python 2.7.9 and django 1.8.3. Here are my  codes relevant to
>> the question I'm asking:
>>
>> settings.py
>>
>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>
>> STATIC_URL = '/static/'
>>
>> STATIC_PATH = (os.path.join(BASE_DIR, 'static'),
>>'/var/www/static/',)
>>
>> STATICFILES_DIRS = (
>> STATIC_PATH,
>> )
>> MEDIA_URL = '/media/'
>>
>>
>>
>>
>> my models.py:
>>
>> class Entry(models.Model):
>> VIDEO_ENTRY_TYPE = (
>> ('SEMINAR', 'Seminar'),
>> ('LECTURE', 'Lecture'),
>> ('TALK', 'Talk'),
>> )
>> user = models.ForeignKey(User)
>> video = models.FileField(upload_to='video_entries')
>> entry_type = models.CharField(max_length=100,
>> choices=VIDEO_ENTRY_TYPE)
>> title = models.CharField(max_length=250)
>>
>>
>> class EntryForm(ModelForm):
>> class Meta:
>> model = Entry
>> fields = ['video', 'entry_type', 'title']
>>
>>
>> my views.py:
>> from django.shortcuts import render
>> from django.http import HttpResponseRedirect
>> from django.http import HttpResponse
>> from django.views.generic import ListView
>>
>> from . models import User, Entry, EntryForm
>>
>> class IndexView(ListView):
>> template_name = 'pi_app/index.html'
>> context_object_name = 'latest_seminars'
>>
>> def get_queryset(self):
>> return
>> Entry.objects.filter(entry_type='SEMINAR').order_by('-pub_date') [:10]
>>
>> def get_context_data(self, **kwargs):
>> context = super(IndexView, self).get_context_data(**kwargs)
>> context['latest_lectures'] =
>> Entry.objects.filter(entry_type='LECTURE').order_by('-pub_date') [:10]
>> context['latest_talks'] =
>> Entry.objects.filter(entry_type='TALK').order_by('-pub_date') [:10]
>>
>> my urls.py:
>>
>> from django.conf.urls import url
>> from django.conf import settings
>> from django.conf.urls.static import static
>>
>> from . import views
>>
>> urlpatterns = [
>> url(r'^$', views.IndexView.as_view(), name='index'),
>> url(r'^upload_file/$', views.upload_file, name='upload_file')
>> ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>>
>>
>> my template.py:
>> 
>>
>> {% load staticfiles %}
>>
>> 
>> 
>> Homepage
>> 
>>
>> 
>>  Welcome {{ user }} 
>>
>>  
>>
>> {% block seminar %}
>> 
>>
>> Most Recent Seminars
>>
>> {% if latest_seminars %}
>> 
>> {% for seminar in latest_seminars %}
>>
>> 
>> 
>> 
>> {{ seminar.title }} by {{ seminar.user }}
>> {% endfor %}
>> 
>> {% endif %}
>> 
>> {% endblock seminar %}
>>
>>
>>
>> Normally, the video or the image will be rendered. In my case, its not
>> rendered. What is rendered instead is the name of the movie file
>> (media/video_entries/name_of _movie_file)  or the name of the image file
>>  (media/video_entries/name_of _image_file). All the other variables are
>> rendered correctly  except the media files. What am I missing? Please
>> enligthen me. Your help is hightly appreciated.  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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6168e60f-a22c-404c-afd6-0e96e077d1a3%40googlegroups.com
> 
> .
> For more options, visit