Re: Django 1.8 tutorial-Chapter4: ValueError at /polls/1/vote/

2015-05-14 Thread Charito Romeo
Hi Alasdair,

Thanks a lot for the help. It's working now. Cheers :)

Charito

On Thu, May 14, 2015 at 7:57 PM, Alasdair Nicol  wrote:

> On 14/05/15 02:50, charito.romeo wrote:
>
>> |
>>  > value="{{
>>  choice.id }}"/>
>> |
>>
>
> The problem is that there is a new line in the middle of
>
> "{{ choice.id }}".
>
> Change it to:
>
>  value="{{ choice.id }}"/>
>
> Cheers,
> Alasdair
>
> --
> Alasdair Nicol
> Developer, MEMSET
>
> mail: alasd...@memset.com
>  web: http://www.memset.com/
>
> Memset Ltd., registration number 4504980.
> Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK
>
> --
> 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/55548D93.3000701%40memset.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/CAM9Y-vv9jZi%3DqwXuh5KkF3sEVyh8H4DvvXq5iO%3D6rht6Phs6Cg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Regarding Learning Django with collaboration

2015-07-17 Thread Charito Romeo
I'm in.

On Fri, Jul 17, 2015 at 4:00 PM,  wrote:

> I'm interested in learning python and django, I'm pretty new... Tanx
>
> John.
> Sent from my BlackBerry wireless device from MTN
>
> -Original Message-
> From: Rohit kumar 
> Sender: django-users@googlegroups.com
> Date: Fri, 17 Jul 2015 13:06:22
> To: 
> Reply-To: django-users@googlegroups.com
> Subject: Regarding Learning Django with collaboration
>
> Hi People,
>
> Are there any people who are learning Python and even planning to
> learn Django and keen interested to form a group as such towards this
> learning curve
>
> I am interested to form a group where we interested folks, will start
> learning Python alongside Django by working on a concept to building a
> website probably which helps for more people. May be if someone comes
> up something we can group together share knowledge and build something
>
> I have a concept like this collaborative platform to form groups and
> share concepts and learn anything online by multiple sources joining
> one to another to help people learn various things; mostly technology.
> So kindly connect whoever if interested
>
> Regards
>
> Rohit
>
> --
> 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/CAB2L%2Bg8n99yJxewoDD%2Bx2puWm%2BwPPJrqTrM0ZAyH%3DM8iFtB7Tw%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/1417613211-1437120003-cardhu_decombobulator_blackberry.rim.net-518515480-%40b3.c4.bise7.blackberry
> .
> 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/CAM9Y-vtLTLpO7nDXp5KfHomTF0OJR%2BJ6y_qrU6HZdviuvOj7BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem rendering media files in template during development

2015-07-20 Thread Charito Romeo
Oh, I forgot to include the MEDIA_ROOT = os.path.join(BASE_DIR, 'media') in
settings.py.

On Mon, Jul 20, 2015 at 3:16 PM, 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/66cb760a-96d3-4998-beec-1f6a947b9259%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/CAM9Y-vsz6iYQzhQgukzeLdSMNCK39%2B9W8kpKSgOsUX2qa3%3DiMA%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
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