Django Atom feed Item Category

2011-10-20 Thread ggavy

Hi everyone,
 I'm geting a little confused with the 'item category' section of
Django's atom feed framework. I want to extend each entry in a feed
with a further piece of information beyond the standard title, id,
etc. The only way I see how to do this is to make use of the
'category' element (correct me if I shoudn't be doing things in this
way). For example I want to tag each entry with say
'institution' (without going down the path of breaking out into
seperate feeds for each institution). So I'm hoping for a feed along
the lines of:


  x
  xx
  x
  xxx
  ..
  ...

  
urn:uuid:354ed4ec-e346-11df-9343-00163e9152a5
x

.
.
 My_Institution 
  

At the moment I have the following in my feed class:

def item_categories(self,item):
return [{'term':'Insitution'}]

which generates the element with the attribute correctly. But how do I
get the value embedded, i.e. the 'My_Institution'?

Any help or even advice if I'm using atom feed wrongly here would be
much appreciated.

Thanks,
G

-- 
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.



queryset extension with field from different model

2011-10-26 Thread ggavy
Hi,
this is just a question to help me understand queryset usage a
little better.

If I had two models, unrelated via foreignkey etc, but which shared a
common field, e.g.

class modelOne(models.Model):
a = 
b = 
c = 

class modelTwo(models.Model):
c = 
d = 
e = 

how can I create a queryset pulling in features of both. That is, if I
had

myqueryset = modelOne.objects.all()

how can I append the d value from modelTwo (having worked out the
matching c values) to myqueryset?

For example, I'm assuming this is not the way I should be doing this:

myqueryset = modelOne.objects.all()
for item in myqueryset:
dvalue = 
item.dvalue = dvalue

Any pointers for how I should be doing this? (noting that I have the
use case for ending up with a single queryset)

Many Thanks,
G


-- 
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.



FTP prefic in URL field

2011-07-15 Thread ggavy

Hi all,
I'm using a URLField in a model and form. However the form
validation for this does not accept 'ftp://' type prefixes. What are
my options here? Do I need to write a custom field or is it possible
to modify the 'validate' method on the field itself so that it
includes the default URL requirements and the ftp prefix. My limited
knowledge in this stuff tells me that this latter one is not possible?
Any advice?

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: FTP prefic in URL field

2011-07-15 Thread ggavy

Hi Tim,
I'm getting the 'Enter a valid URL.' error returned. I am however
using Django 1.1, and thought that was the issue (I'm not sure where
to look for the validator.py in this older version, but I think Iread
somewhere that ftp wasn't in the regex at that version). Migrating to
1.2 isn't practical at the moment.

G


On Jul 15, 2:52 pm, Tim Shaffer  wrote:
> It looks like the URLValidator should in fact accept ftp:
>
> https://github.com/django/django/blob/master/django/core/validators.p...
>
> What's the specific error you're getting?

-- 
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: FTP prefic in URL field

2011-07-18 Thread ggavy
Thanks Tim,
  I kinda guessed that would be the case. Thanks for the advice.

G

On Jul 15, 3:12 pm, Tim Shaffer  wrote:
> Yeah, it doesn't look like 1.1 allowed for ftp protocol:
>
> https://github.com/django/django/blob/1.1.X/django/forms/fields.py#L545
>
> Best bet might be to create your own URLField class and overwrite the
> __init__ method to use your own regular expression. Kind of a pain. It's a
> little easier in future versions because you can just overwrite the
> validator instead of the whole field.

-- 
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.



Selecting a directory on a local machine

2011-08-15 Thread ggavy

Hi,
I have a django app running on a webfaction account. I want to be
able to make use of a list of files that I hold locally on my own
machine. Is there a way through forms to allow a user of the webapp to
select a local directory on which files within this directory can then
be uploaded? I have seen people make reference to uploadify, but was
wondering if there wasn't a simpler way?

Thanks in advance,
G

-- 
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.



pgadmin vs schema migration

2011-02-24 Thread ggavy

Hello everyone,
if I have a live app running off a postgres db (containing data)
and I want to make reasonably simple schema (and possibly data
content) changes, are there any dangers in just using pgadmin (e.g
adding a column) as opposed to using some type of migration software,
e.g. south. I'd keep my models.py up-to-date with any changes I make
to the database (in case of future uses of the app). I haven't seen
anything online warning me not to do it, but the separation worries me
slightly

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: pgadmin vs schema migration

2011-02-24 Thread ggavy

Thanks. It's good to get a little second opinion. I'm sure I'll make
the switch to migration tools eventually as things become a little
more involved.

Cheers
gav



On Feb 24, 11:58 am, Mike Ramirez  wrote:
> On Thursday, February 24, 2011 03:48:18 am ggavy wrote:
>
> > Hello everyone,
> >     if I have a live app running off a postgres db (containing data)
> > and I want to make reasonably simple schema (and possibly data
> > content) changes, are there any dangers in just using pgadmin (e.g
> > adding a column) as opposed to using some type of migration software,
> > e.g. south. I'd keep my models.py up-to-date with any changes I make
> > to the database (in case of future uses of the app). I haven't seen
> > anything online warning me not to do it, but the separation worries me
> > slightly
>
> > Thanks
>
> prior to the migration systems (south/evolution) and even after that for
> awhile, it was the defualt way, to manage it manually. The migration tools
> just make it easier.
>
> As long as you keep your table and model definitions, and create/insert/update
> statements all in line, it's safe.
>
> Personally,I'm with all the others and suggest you use migration tools, unless
> this is a one off and not going to be doing this a lot, Then I do find it just
> faster and easier to do it manually.
>
> Mike.
>
> --
> Vermouth always makes me brilliant unless it makes me idiotic.
>                 -- E.F. Benson

-- 
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.