Re: Using Model Object Data in views.py

2009-07-22 Thread rpupkin77

Yes, I actually had an error elsewhere apologies.

I understand objects fine, BTW but am new to Django (beyond the
tutorials).

It was odd to me that the error was happening it seemed like i should
have had access to the data.All set now.

On Jul 22, 4:01 pm, Daniel Roseman  wrote:
> On Jul 22, 8:54 pm, rpupkin77  wrote:
>
>
>
> > Hi,
>
> > this is probably a  really basic question, but i can't find the answer
> > anywhere.
>
> > I need to get data from a model and use it in the view (views.py),
> > before I pass it to the template. However, the result I get back (when
> > i examine the local vars) has only the value returned by the __unicode
> > function, in this instance, the "title" column.
>
> > I need the title to continue to be what is returned by unicode but i
> > need access to a different field in that model  and pass it to a third
> > party api.
>
> > essentially my code would looks like this:
>
> > from models import Video
>
> > def get_video_ids:
> >  vids = Video.objects.all()
>
> >  for vids in vid
> >   do stuff
>
> > the vids variable contains a list like this: [Video: vid title one,
> > Video: vid title two]
>
> > I essentially need the id.
>
> > I have tried different ways of extracting, but they fail.
>
> > Thanks.
>
> You don't just get the unicode, you get the whole object. If you just
> type 'vid' into the console, of course you'll just see the unicode
> representation (actually it's the value of __repr__, which in turn
> calls __unicode__) but the whole object is there. You access other
> attributes like you would any other object - vid.id, vid.field1, etc.
>
> It sounds like you don't really understand objects in Python, or maybe
> objects at all. I recommend you read a basic beginner's guide to
> programming in Python - there's a list 
> here:http://wiki.python.org/moin/BeginnersGuide/NonProgrammers
> I haven't read any of them (I learned from Dive Into Python, which is
> aimed at people who already know programming from other languages) but
> I've heard "How to think like a computer scientist" is good.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using Model Object Data in views.py

2009-07-22 Thread rpupkin77

Hi,

this is probably a  really basic question, but i can't find the answer
anywhere.

I need to get data from a model and use it in the view (views.py),
before I pass it to the template. However, the result I get back (when
i examine the local vars) has only the value returned by the __unicode
function, in this instance, the "title" column.

I need the title to continue to be what is returned by unicode but i
need access to a different field in that model  and pass it to a third
party api.

essentially my code would looks like this:

from models import Video

def get_video_ids:
 vids = Video.objects.all()

 for vids in vid
  do stuff

the vids variable contains a list like this: [Video: vid title one,
Video: vid title two]

I essentially need the id.

I have tried different ways of extracting, but they fail.

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom File Handling Through admin

2009-05-12 Thread rpupkin77

Thanks, I'll take a look, Brightcove is an enterprise video service
based in Cambridge, MA, Quite impressive API if you have the money and
don't want to use a traditional CDN.

http://www.brightcove.com

On May 12, 10:44 am, Karen Tracey  wrote:
> On Mon, May 11, 2009 at 5:45 PM, rpupkin77  wrote:
>
> > Hi,
>
> > I need to have a FileField from a model handled differently than the
> > out of the box functionality, In short I need to add it to the a
> > Brightcove account through their API, can someone give me a really
> > brief rundown of how I would do this?
>
> > I know it is a broad question, but I am a little confused about saving
> > admin data and handling outside of the Admin panel, and the api file
> > upload complicates stuff.
>
> I've not heard of Brightcove before, but it sounds like a custom storage
> backend for it may be what you need to find/write.  Have you read these bits
> of the docs:
>
> http://docs.djangoproject.com/en/dev/topics/files/http://docs.djangoproject.com/en/dev/howto/custom-file-storage/
>
> ?
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



two models, 1 table

2009-05-11 Thread rpupkin77

Hi, can I use the same table in two different models and surface
different data in each, model, particularly in the admin panel?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom File Handling Through admin

2009-05-11 Thread rpupkin77

NOTE:

I don't need help with the Brightcove API, I have a Python library
written for that, I need to intercept the file handler and use my BC
logic and then insert the rest of the Meta Data into our DB.

On May 11, 5:45 pm, rpupkin77  wrote:
> Hi,
>
> I need to have a FileField from a model handled differently than the
> out of the box functionality, In short I need to add it to the a
> Brightcove account through their API, can someone give me a really
> brief rundown of how I would do this?
>
> I know it is a broad question, but I am a little confused about saving
> admin data and handling outside of the Admin panel, and the api file
> upload complicates stuff.
>
> Thanks in advance
>
> (I am using new forms w/ Python25)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom File Handling Through admin

2009-05-11 Thread rpupkin77

Hi,

I need to have a FileField from a model handled differently than the
out of the box functionality, In short I need to add it to the a
Brightcove account through their API, can someone give me a really
brief rundown of how I would do this?

I know it is a broad question, but I am a little confused about saving
admin data and handling outside of the Admin panel, and the api file
upload complicates stuff.

Thanks in advance

(I am using new forms w/ Python25)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Customizing Admin Save Functionality

2009-05-11 Thread rpupkin77

Hi,

Is there a list of admin blocks ie (form_top) somewhere, all I know
are form_top and extra_head.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---