Re: How to find the file / directory which is hidden?

2010-04-12 Thread Pradnya
Hello Praveen,

Thanks for you reply
I tried with following script and it worked

import win32file
import win32con

int a = win32file.GetFileAttributes("C:\\TestFiles\\r.txt") &
win32con.FILE_ATTRIBUTE_HIDDEN

win32file.GetFileAttributes("C:\\TestFiles\\r.txt")  will return 32 if
the file is without any special attributes.
34 in case the file is only hidden
35 if the file is hidden and readonly

finally int a will be 2 if the file is hidden or does not  exist and 0
if the file exists and not readonly.



On Apr 13, 9:48 am, Praveen  wrote:
> There is not a big deal.
> If you want to find the hiddend file on windos there is one command
> attrib -h
> for more info look athttp://commandwindows.com/command2.htmand find
> for "Changing file attributes with "attrib" "
> for unixhttp://www.faqs.org/docs/securing/chap5sec62.html
> you need to write and script to run these commands.
> I just give you small example
>
> import command
> command.getoutput('ls')
>
> which will list you all the dir(s) and file(s).
> regards
> Praveen
>
> On Apr 12, 5:47 pm, Pradnya  wrote:
>
> > Hello,
>
> > I am using Django with Python on windows. I want to list the files
> > from specific directory and want to highlight files / directories
> > which are hidden. How to recognize a file / directory as it's hidden?
>
> > This particular application could be running on Unix / Linux platform.
> > Is there any common method which gives information as the file is
> > hidden? Or if it is possible using file header?
>
> > Please suggest.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Calling the same views, displaying in different templates

2010-04-12 Thread rvidal
Hi,

I have a database of related data connected via foreign keys. One to
many relationships between one table and various other tables.

Random example:
Client
- id
- name
- age

Receipts
- id
- client (fk)
- timestamp

Contacts
- id
- client (fk)
- timestamp

I have my urls.py looking something like this:
urlpatterns = patterns('mysites.shop.views',
(r'^$', 'index'),
(r'^client/(?P\d+)/$', 'details'),
(r'^client/(?P\d+)/receipts/$', 'receipts'),
(r'^client/(?P\d+)/contacts/$', 'contacts'),
)

I have similar data displayed on my details, receipts and contacts
page because they are related. So I show in the main content div the
client details and receipts and contacts in side bar on the details
view, then I swap the relevant section to the main div depending on
the view I want.

The thing here is that I basically just use the same view function,
but move things around in the template. Should I be repeating the
views and creating a template for each situation?

Here's what my views.py looks like (continuing with random example):
from django.shortcuts import render_to_response, get_object_or_404
from lymphoma.ldata.models import Patient, Pathology

def index(request):
client_list = Clients.objects.all().order_by('-timestamp')
return render_to_response('shop/index.html', {'client_list':
client_list})

def details(request, client_id):
c = Clients.objects.get(pk=client_id)
receipt_list = c.receipts_set.all()
contacts_list = c.contacts_set.all()
return render_to_response('shop/details.html', {'client': c,
'receipt_list': receipt_list, 'ccontact_list': contact_list})

def receipts(request, client_id):
c = Clients.objects.get(pk=client_id)
receipt_list = c.receipts_set.all()
contacts_list = c.contacts_set.all()
return render_to_response('shop/receipts.html', {'client': c,
'receipt_list': receipt_list, 'ccontact_list': contact_list})

def receipts(request, client_id):
c = Clients.objects.get(pk=client_id)
receipt_list = c.receipts_set.all()
contacts_list = c.contacts_set.all()
return render_to_response('shop/contacts.html', {'client': c,
'receipt_list': receipt_list, 'ccontact_list': contact_list})


Note that all I change in these views is the template.

So, what am I doing wrong here? What I currently have works, but I'm
sure I'm not proceeding properly.

Any help would be much appreciated. Thank you in advance.

Cheers,
Ricardo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



PyAmf+Django and foreign keys

2010-04-12 Thread Jurassic
Guys, can you please share your approach to handle complex models
where each model has a ForeignKey to another? I am trying to build a
flex app using RemoteObject and [RemoteClass(alias=...)] flex feature
to map flex VO to django data models.
Here's an approximate scenario I'm working with:
---
class Model1(models.Model):
 ...
class Model2(models.Model):
  model1=ForeignKey(Model1)
  ...
class Model3(models.Model):
  model2=ForeignKey(Model2)
  ...
class Model4(models.Model):
  model3=ForeignKey(Model3)
  ...
--
What do I do to save a single object of Model4? Django complains if
"model3" field is null, so I have to have a Model3 object assigned to
it. Same with Model3 - "model2" field must be populated, so far so
forth. So, for saving one object I have to push all related objects
from flex to django. Is there any way around this? All that  django
needs is just an ID of the related model, not the whole darn object.
How do you guys deal with this?

Thank you much in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



complex form

2010-04-12 Thread mu
Hi all,
   I have a question about complex form.
   There are my models:

 class Country(models.Model):
 name = models.CharField(max_length=30)

 class Author(models.Model):
 name = models.CharField(max_length=30)
 age = models.IntegerField()
 email = models.EmailField()
 country = models.ForeignKey(Country)

 class Book(models.Model):
 title = models.CharField(max_length=100)
 author = models.ForeignKey(Author)
 price = models.FloatField()
 publication_date = models.DateField()

   I want to display a page like this:
 display a author input form on top of the page, display a book input
form on bottom of the page.

   Validations:
 When the author's name is 'mbs', the book's price must greater than 12.
 When the author's country is 'japan', the book's publication_date
must be '2010-6-30'

   Now what i do is:
 a form holds all fields of Author and Book, but i found it is
redundant when  set values

   Is there a convenient and Pythonnic way to achieve this?

   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-us...@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: Override Delete Function

2010-04-12 Thread Ian Lewis
Tom,

You could try doing this clear logic in a pre_delete signal. You might have
to test out the timing of when the signals get called but it should call
pre_delete for all deleted models. In this case it would call pre_delete on
model2 before model1 but you should be able to get what you are looking for.

http://docs.djangoproject.com/en/dev/ref/signals/#pre-delete

On Tue, Apr 13, 2010 at 8:21 AM, cootetom  wrote:

> Hi, I'm trying to figure out the way django deletes models so that I
> can clear the correct references that I need to prior to deleting. So
> I have models set up with overrided delete functions so that I can do
> clears before the actual delete. However, it appears the delete
> functions in a model don't get called in the cascade of deletes so not
> each child model gets to do it's clear of linked data before
> deleting.
>
> def model1(models.Model):
>def delete(self):
>self.related_model.clear()
>super(model1, self).delete()
>
> def model2(models.Model):
>model2 = models.ForeignKey(model2)
>
>def delete(self):
>self.another_related_model.clear()
>super(model2, self).delete()
>
>
> So if I do model1.delete() then it will do it's clear but it appears
> it won't do the clear from model2? Am I getting this behaviour right
> or am I doing something wrong here?
>
> The model class seems like the best place to put delete logic in so
> that when it's deleted it clears any data it needs to first.
>
> - Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Django Newbie seeking for advice

2010-04-12 Thread Ian Lewis
Mr. Yu,

On Tue, Apr 13, 2010 at 9:56 AM, Mister Yu  wrote:

>
> 1. can you suggest an up-to-date(django 1.1) book which can guide a
> newbie to a higher level? ebook is ok, free is more than ok  :)
>

I think the semi-official Django book is where most people start. It's
available online and currently covers 1.1 (at least according to chapter 1).

http://www.djangobook.com/en/2.0/



> best practice for the following things under django 1.1, (i tried
> google, but some of the material might not fit for 1.1 anymore), you
> can just name a library or which built-in module is best, as these are
> the features in my mind for my little project
> 2. tags
> 3. open-id
> 4. user avatar
> 5. ajax form
> 6. twitter api
>

The best practices for Django would be to break functionality for these
features into seperate "applications" in Django speak. See: Writing your
first Django app: http://docs.djangoproject.com/en/dev/intro/tutorial01/

The part where you start creating models is where you actually create a
Django "application" using the "startapp" command..
http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3

That said, there are a number of applications that are written by others
that you should be able to use right out of the box for most of your
functionality.

tags: http://code.google.com/p/django-tagging/
open-id: http://github.com/simonw/django-openid
avatar: http://github.com/ericflo/django-avatar
ajax-form: http://github.com/alex/django-ajax-validation
twitter api: http://code.google.com/p/oauth-python-twitter/ (or you can use
my fork with some bug fixes:
http://bitbucket.org/IanLewis/oauth-python-twitter/)

-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0021
東京都渋谷区恵比寿西2-3-2 NSビル6階
email: ianmle...@beproud.jp
TEL:03-6416-9836
FAX:03-6416-9837
http://www.beproud.jp/
===

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django Newbie seeking for advice

2010-04-12 Thread Mister Yu
Hi experts,

i m a newbie and i m self learning django and writing an web app as i
go along. i learn django by following this great screencast tutorial
from here: http://showmedo.com/videotutorials/series?name=PPN7NA155
called Django From the Ground-up.

it's a really great serious of tutorial. however it doesn't cover what
i/everybody else' need. so i come here for some advice from you
experts:

1. can you suggest an up-to-date(django 1.1) book which can guide a
newbie to a higher level? ebook is ok, free is more than ok  :)

best practice for the following things under django 1.1, (i tried
google, but some of the material might not fit for 1.1 anymore), you
can just name a library or which built-in module is best, as these are
the features in my mind for my little project
2. tags
3. open-id
4. user avatar
5. ajax form
6. twitter api

thanks very much in advance for any kind of advice.

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Plugin for Eclipse

2010-04-12 Thread Zbiggy
Hi,
maybe someone would be interested in: http://eclipse.kacprzak.org/

I use Eclipse + PyDev, however Django tags coloring was always sth I
was missing.
However if you found such a plugin already, please let me know.
I'd like to avoid wasting my time in duplicate implementation.

Regards,
Zbiggy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: manage.py loaddata silently fails

2010-04-12 Thread Russell Keith-Magee
On Tue, Apr 13, 2010 at 2:14 AM, Phlip  wrote:
>> How do I access the error message?
>
> In this case, turning on --verbosity=2 reveals a huge dump, and
> tweezering through it reveals the fixture file was not found. (A
> colleague bumped its app from the app list.)
>
> It seems that "fixture not found" should be a fatal error, not a
> silent warning. The fixtures= line also has this bug.

Django 1.2 addresses this; the default verbosity for the "no fixtures
found" message has been decreased, so you should see the message at
the default verbosity.

This change hasn't been backported back to 1.1 because it's not strictly a bug.

Yours,
Russ Magee %-)
> --
>  Phlip
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ORM Query question

2010-04-12 Thread Tim Shaffer
Or, using range:

MyModel.objects.filter( Q(a__range=(1,5)) | Q(b__range=(20,70)) )

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Override Delete Function

2010-04-12 Thread cootetom
Hi, I'm trying to figure out the way django deletes models so that I
can clear the correct references that I need to prior to deleting. So
I have models set up with overrided delete functions so that I can do
clears before the actual delete. However, it appears the delete
functions in a model don't get called in the cascade of deletes so not
each child model gets to do it's clear of linked data before
deleting.

def model1(models.Model):
def delete(self):
self.related_model.clear()
super(model1, self).delete()

def model2(models.Model):
model2 = models.ForeignKey(model2)

def delete(self):
self.another_related_model.clear()
super(model2, self).delete()


So if I do model1.delete() then it will do it's clear but it appears
it won't do the clear from model2? Am I getting this behaviour right
or am I doing something wrong here?

The model class seems like the best place to put delete logic in so
that when it's deleted it clears any data it needs to first.

- Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ORM Query question

2010-04-12 Thread Tim Shaffer
http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

MyModel.objects.filter( ( Q(a__gt=1) & Q(a__lt=5) ) | ( Q(b__gt=20) &
Q(b__lt=70) ) )

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: ORM Query question

2010-04-12 Thread rebus_
On 13 April 2010 01:09, zweb  wrote:
> how do i do this kind of condition in django orm filter:
>
> ( 1 < a < 5)  or ( 20 < b < 70)
>
> select * from table where (a between 1 and 5) or (b between 20 and 70)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

http://docs.djangoproject.com/en/dev/ref/models/querysets/#range

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: django.views.generic.create_update : tags behavior

2010-04-12 Thread m2k1983
To get to the attributes: do this: {{ form.title.field.max_length }}.
Does not seems to see this documented anywhere.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



ORM Query question

2010-04-12 Thread zweb
how do i do this kind of condition in django orm filter:

( 1 < a < 5)  or ( 20 < b < 70)

select * from table where (a between 1 and 5) or (b between 20 and 70)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what lines in the templates are culpable?

2010-04-12 Thread Karen Tracey
On Mon, Apr 12, 2010 at 5:55 PM, Phlip  wrote:

> Or do all of your see filenames and line numbers, for your .html
> templates, at error time?
>
>
I do on debug pages, with the line causing the error highlighted.

I'm still not sure if you are talking about test output or debug pages. (I
didn't suggest posting your actual output someplace so I could help debug
this specific problem, I suggested it so that I could start to get some
context to give me some clue what problem, exactly, you are talking about.)

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-us...@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: MySQLdb setup on snow leopard help

2010-04-12 Thread Bdidi


On Apr 13, 8:07 am, Bdidi  wrote:
> On Apr 12, 8:31 pm, Steven Elliott Jr  wrote:> Did 
> you run the install as sudo?

Yes, the install was run as sudo.

Alex Robbins  wrote
> If you are planning to deploy to linux servers, you might have a nicer
> time developing on a linux vm. I have a mac, but do my development in
> an ubuntu vm. Many difficult installations become a simple "sudo apt-
> get install ".

I have an ubuntu vm already set up on my mac, so I can try this.
Ultimately though, it's more likely that I would be looking to deploy
on mac servers, so I guess I need to get the mac side sorted out. But
thank you for the suggestion.

Brett

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what lines in the templates are culpable?

2010-04-12 Thread bax...@gretschpages.com
Without seeing the traceback, this is all just guessing--stabbing in
the dark. But...

a) posting a traceback allows people to actually help not only solve
the problem, but help show how to read the traceback.

b) commenting out template code may have suppressed the problem, but
that still doesn't mean the problem was actually in the template.
Template tags, for example, can throw errors.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: MySQLdb setup on snow leopard help

2010-04-12 Thread Bdidi


On Apr 12, 8:31 pm, Steven Elliott Jr  wrote:
> Did you run the install as sudo?
>
> -Steven Elliott Jr
>
Hmm, good question - I'd better check that.

Thanks,
Brett

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to pass context with a form?

2010-04-12 Thread BrendanC
Replying to my own message - problem solved - ignore previous posting!

I forgot to include my variables in my response
so expected values were not being passed - I was doing this:

variables = RequestContext(request, {
'form': form,
'caller': caller,
'error': error
})

   return render_to_response('search.html')

instead of:

variables = RequestContext(request, {
'form': form,
'caller': caller,
'error': error
})

return render_to_response('search.html', variables)

Just another brain fart at my end. Sometimes I just can't see the wood
for the trees!



On Apr 12, 1:21 pm, BrendanC  wrote:
> I have a reusable search form and want to display a different form
> header based on where/how the search is called from (I get this from
> the url). In the search template I'd like to test a variable to
> determine which header to display. I need to somehow pass variable
> from the view the template - something like this:
>
>     form = SearchForm({'Retired' :'Retired Staff''})
>
> then in the search template check the Retired variable :
>
> 
>     {% if Retired %}
>           Search Retired Staff List.
>     {% endif %}
> 
>
> The generic search form class is"
> class   SearchForm(forms.Form):
>
>     # Create a Search Form - set form header to value passed by
> caller
>
>     query = forms.CharField(
>             label=u'Search by Employee ID ',
>             widget=forms.TextInput(attrs={'size': 32})
>             )
>
> The catch here is that the variable is not a field on the form. So how
> can Ito pass context info at form creation time? Is this possible?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what lines in the templates are culpable?

2010-04-12 Thread Phlip
> If you posted some specifics of what you are actually seeing, someone might
> be able to help. I mean, actually copy-paste the traceback into your post
> (or put it someplace like dpaste.com and point to it).

I am not asking "oo help I can't get my template working". That part's
done - by clamping out segments with {% comment %} until they isolated
the faulty lines.

I am asking _why_ I had to clamp out segments with {% comment %}. (In
test.)

Or do all of your see filenames and line numbers, for your .html
templates, at error time?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Using properties as filters in the admin

2010-04-12 Thread shane
You could try a custom filter_spec.

Examples @ http://www.djangosnippets.org/tags/filterspec/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: File uploads not held on loaded Form

2010-04-12 Thread Karen Tracey
On Mon, Apr 12, 2010 at 3:28 PM, phoebebright wrote:

> If you edit an item in admin, a files uploaded are displayed above the
> input field.  But if the model form is loaded with an instance, the
> form seems unaware that there may already be an uploaded file.  No
> existing file is displayed and if the form is resaved, the uploaded
> file link is lost.
>

The admin uses a special widget for file fields, see
http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/contrib/admin/widgets.py#L85.
That's what causes the existing value with link to be displayed in admin.


> Am populating the form like this: requestForm =
> RequestForm(instance=comm)
>
> Found a similar question here:
>
> http://groups.google.com/group/django-users/browse_thread/thread/1ba9bd1ae11c4e1a/a0c865b9317626ac?lnk=gst=upload+file#a0c865b9317626ac
> and here
>
> http://groups.google.com/group/django-users/browse_thread/thread/b3de8d6ef3fd8da9/1271517128e75720?lnk=gst=upload+file#1271517128e75720
> with now answers
>
> A partial answer here:http://groups.google.com/group/django-users/
> browse_thread/thread/14922dca454e3782/d3b370cc47fe9ca1?lnk=gst=upload
> +file#d3b370cc47fe9ca1
> To the effect that this behaviour is correct due to security issue. Is
> that the case?
>

Browsers will not render an initial value for a file input, so as to prevent
malicious web sites from pre-filling such fields with values that may cause
upload of sensitive data if an unwitting user just presses OK or something
on a form. Thus if you want a file field to include information about an
already-existing value, you need to have the form display more than just the
plain file input that normally goes with a file field. You need something
like the admin's special widget (possibly you could just use the admin's
special widget directly, I have not looked at it closely enough to tell one
way or the other).

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-us...@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: installing Django / building a website

2010-04-12 Thread Shawn Milochik
First off, you should know Python a bit before you start trying to use Django. 
Otherwise you'll keep asking "how do I do X in Django," when what you really 
want to know is how to do it in Python.
http://docs.python.org/tutorial/index.html

Secondly, start with the official documentation, which is really great:
http://docs.djangoproject.com/en/1.1/
The first two sets of links on the page are installation and the tutorial, 
which will get you started.

Thirdly, you need to be aware of the fact that, while this list contains some 
very generous and very smart people (and sometimes both at once), you're going 
to have to show a lot more effort around here to get help. Coming in and 
basically saying "I don't know how to do X" or "I got an error message" or "I 
have a problem in my code" will get you ignored -- or worse. So when you come 
in with a question, preface that question with what you have tried, what you 
expected and what you got instead of what you expected, and a good description 
of the problem. 

Pet peeve:
Also, don't use subject lines like "help" or "problem." They're worthless for 
others to figure out if they can or want to help you, and you should try to 
make that as easy on them as possible.

ShawnMilo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what lines in the templates are culpable?

2010-04-12 Thread bax...@gretschpages.com
Again, without seeing the trace it's hard to say, but it sounds like
your error is happening well before it ever gets to the template,
making the template irrelevant.

On Apr 12, 4:10 pm, Phlip  wrote:
> > Uusually the first line in the traceback tells you pretty explicitly
> > where the error is. Without the traceback, it's hard to say where your
> > problem lies.
>
> One of the templates is "basket.html", and "basket.html" does not
> appear in the transcript.
>
> All the lines are only django's internal render() calls (including
> inside debug.py), and our action handler itself.
>
> The top line is the test method name.
>
> (Also, manual test does not fail, so that naturally is on us, but I
> think that's where you think the transcript might be more explicit.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what lines in the templates are culpable?

2010-04-12 Thread Karen Tracey
On Mon, Apr 12, 2010 at 5:10 PM, Phlip  wrote:

> > Uusually the first line in the traceback tells you pretty explicitly
> > where the error is. Without the traceback, it's hard to say where your
> > problem lies.
>
> One of the templates is "basket.html", and "basket.html" does not
> appear in the transcript.
>
> All the lines are only django's internal render() calls (including
> inside debug.py), and our action handler itself.
>
> The top line is the test method name.
>
> (Also, manual test does not fail, so that naturally is on us, but I
> think that's where you think the transcript might be more explicit.)
>

If you posted some specifics of what you are actually seeing, someone might
be able to help. I mean, actually copy-paste the traceback into your post
(or put it someplace like dpaste.com and point to it).

I'm not entirely sure if you are talking about a debug page or test output,
for example. If I had some actual output to look at I might have a better
clue where to start.

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-us...@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: what lines in the templates are culpable?

2010-04-12 Thread Phlip
> Uusually the first line in the traceback tells you pretty explicitly
> where the error is. Without the traceback, it's hard to say where your
> problem lies.

One of the templates is "basket.html", and "basket.html" does not
appear in the transcript.

All the lines are only django's internal render() calls (including
inside debug.py), and our action handler itself.

The top line is the test method name.

(Also, manual test does not fail, so that naturally is on us, but I
think that's where you think the transcript might be more explicit.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what lines in the templates are culpable?

2010-04-12 Thread bax...@gretschpages.com
Uusually the first line in the traceback tells you pretty explicitly
where the error is. Without the traceback, it's hard to say where your
problem lies.

On Apr 12, 3:25 pm, Phlip  wrote:
> Djangoists:
>
> When code below a template throws an error, we get an insanely
> detailed stack trace of all the lines AROUND the template.
>
> How do I tell what lines INSIDE the templates caused the error?
>
> --
>   Phlip
>  http://c2.com/cgi/wiki?ZeekLand

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: querying on a field equal to a manytomany object

2010-04-12 Thread Nick Serra
Thank you! I was trying to hunt that down but gave up hope and assumed
django didn't handle that. Saves me several lines, thanks again

On Apr 12, 3:18 pm, Ian Struble  wrote:
> I think you are looking for the 'in' field lookup:
>
>    http://docs.djangoproject.com/en/dev/ref/models/querysets/#in
>
> Item.objects.filter(genre__in=some_video.genre.all())
>
> On Apr 12, 10:03 am, Nick Serra  wrote:
>
>
>
> > Hey everyone, thanks for looking. I couldn't think of a good title for
> > this one. I have a question on queries on manytomany relations. Here
> > is an example:
>
> > class Item:
> >     genre = models.ForeignKey(Genre)
>
> > class Genre:
> >     name = models.CharField()
>
> > class Video:
> >     genre = models.ManyToManyField(Genre)
>
> > Heres the situation.. I want to do a get() on item and find any items
> > where the item.genre is equal to one of the video's genres. A video
> > can have many genres.
>
> > My first thought was Item.objects.get(genre=video.genre.all()), but
> > this only works when there is only one genre selected for the video.
> > Is there any way to do this without doing an iteration on the videos
> > selected genres and testing each case?
>
> > I feel like i've accomplished this before, but I may just be having an
> > off day. 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-us...@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.



installing Django / building a website

2010-04-12 Thread codecub
hey guys im a noob @ django/python i still dont understand the concept
of django and python

i know django is a framework for pytohn and python is a scripting
language but i dont know exactly what django does and even if i did i
still cant figure out how to install Django with python i tried and by
the time i get to creating an application it messes up somehow

i basically want to make a website like whalesalad.com for myself
because its made out of django and thats why i want to learn django

thanks

- codecub

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



what lines in the templates are culpable?

2010-04-12 Thread Phlip
Djangoists:

When code below a template throws an error, we get an insanely
detailed stack trace of all the lines AROUND the template.

How do I tell what lines INSIDE the templates caused the error?

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



How to pass context with a form?

2010-04-12 Thread BrendanC
I have a reusable search form and want to display a different form
header based on where/how the search is called from (I get this from
the url). In the search template I'd like to test a variable to
determine which header to display. I need to somehow pass variable
from the view the template - something like this:

form = SearchForm({'Retired' :'Retired Staff''})

then in the search template check the Retired variable :


{% if Retired %}
  Search Retired Staff List.
{% endif %}


The generic search form class is"
class   SearchForm(forms.Form):

# Create a Search Form - set form header to value passed by
caller

query = forms.CharField(
label=u'Search by Employee ID ',
widget=forms.TextInput(attrs={'size': 32})
)

The catch here is that the variable is not a field on the form. So how
can Ito pass context info at form creation time? Is this possible?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



generic comments

2010-04-12 Thread bax...@gretschpages.com
Probably a dumb question, but can the comments system handle generic
comments? In other words, if I just have  a general "comments" page,
can I have comments that aren't attached to any particular object?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: get_comment_count templatetag

2010-04-12 Thread bax...@gretschpages.com
I'm not saying it's the best way, but I would either define my own
get_comment_count in my application's models.py that looped through
the ojbects comments (and their comments) to get an accurate count.

OR

I would store comment_count locally on the object and send a signal
when a comment is saved, something like (and excuse the pseudo-code)
if this.parent = object or this.parent.parent = object: comment.count
+= 1



On Apr 12, 2:18 pm, fuxter  wrote:
> hey everyone,
> i'm a young django user and need some advice or opinions on the way of
> general use.
>
> in my application (blog-like site) i have objects and they can have
> comments. i also decided to implement limited comment reply feature.
> so the objects can have comments, and those comments can have comments
> as well. it turn out to be one level nested comments. comments for
> comments can't have replies.
>
> at this point i'm stuck with get_comment_count template tag that
> returns only object's comments count, naturally. and i need to count
> all the replies altogether.
>
> so my question is how would you do that? should i add a method to
> commented object that would count all the replies? maybe i could hack
> the comments/templatetags framework? or should i write my own
> templatetag?
>
> i guess all the options are pretty usable and they don't cross the
> django way, which is very liberal. i just wanted to know you opinion,
> what would you prefer?
>
> ps: pardon my russian =)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Problems with comment form customization ?

2010-04-12 Thread bax...@gretschpages.com
There are several ways you can do it, but probably the most
straightforward is how django does it in the first place:

{% for field in form %}
{% if field.is_hidden %}
  {{ field }}
{% else %}
  {% if field.errors %}{{ field.errors }}{% endif %}
  
{{ field.label_tag }} {{ field }}
  
{% endif %}
  {% endfor %}

Looping through the fields, and if the field is honeypot, setting
display:none

That's all in django/contrib/comments/templates/comments/form.html


On Apr 12, 2:35 pm, Ariel  wrote:
> Hi everybody:
>
> I am implementing comments functionalities in my web application, I am
> making the documentation examples.
> I have customized my comment form exaxtly like the documentation:
>
> {% get_comment_form for document as form %}
> 
>   {{ form }}
>   
>      value="Preview">
>   
> 
>
> But the thing is that a field that is suppossed to be hidden is
> visible and that is what I don't want, the field name is 'honeypot'
> This is a normal behavior ?
> Do anyone of you know how to make that field hidden again ???
> Thanks in advance.
> Ariel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Problems with comment form customization ?

2010-04-12 Thread Ariel
Hi everybody:

I am implementing comments functionalities in my web application, I am
making the documentation examples.
I have customized my comment form exaxtly like the documentation:

{% get_comment_form for document as form %}

  {{ form }}
  

  


But the thing is that a field that is suppossed to be hidden is
visible and that is what I don't want, the field name is 'honeypot'
This is a normal behavior ?
Do anyone of you know how to make that field hidden again ???
Thanks in advance.
Ariel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



File uploads not held on loaded Form

2010-04-12 Thread phoebebright
If you edit an item in admin, a files uploaded are displayed above the
input field.  But if the model form is loaded with an instance, the
form seems unaware that there may already be an uploaded file.  No
existing file is displayed and if the form is resaved, the uploaded
file link is lost.

Am populating the form like this: requestForm =
RequestForm(instance=comm)

Found a similar question here:
http://groups.google.com/group/django-users/browse_thread/thread/1ba9bd1ae11c4e1a/a0c865b9317626ac?lnk=gst=upload+file#a0c865b9317626ac
and here
http://groups.google.com/group/django-users/browse_thread/thread/b3de8d6ef3fd8da9/1271517128e75720?lnk=gst=upload+file#1271517128e75720
with now answers

A partial answer here:http://groups.google.com/group/django-users/
browse_thread/thread/14922dca454e3782/d3b370cc47fe9ca1?lnk=gst=upload
+file#d3b370cc47fe9ca1
To the effect that this behaviour is correct due to security issue. Is
that the case?

Have I missed something or is there a way around this without hard
coding the form?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



get_comment_count templatetag

2010-04-12 Thread fuxter
hey everyone,
i'm a young django user and need some advice or opinions on the way of
general use.

in my application (blog-like site) i have objects and they can have
comments. i also decided to implement limited comment reply feature.
so the objects can have comments, and those comments can have comments
as well. it turn out to be one level nested comments. comments for
comments can't have replies.

at this point i'm stuck with get_comment_count template tag that
returns only object's comments count, naturally. and i need to count
all the replies altogether.

so my question is how would you do that? should i add a method to
commented object that would count all the replies? maybe i could hack
the comments/templatetags framework? or should i write my own
templatetag?

i guess all the options are pretty usable and they don't cross the
django way, which is very liberal. i just wanted to know you opinion,
what would you prefer?

ps: pardon my russian =)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: querying on a field equal to a manytomany object

2010-04-12 Thread Ian Struble
I think you are looking for the 'in' field lookup:

http://docs.djangoproject.com/en/dev/ref/models/querysets/#in

Item.objects.filter(genre__in=some_video.genre.all())

On Apr 12, 10:03 am, Nick Serra  wrote:
> Hey everyone, thanks for looking. I couldn't think of a good title for
> this one. I have a question on queries on manytomany relations. Here
> is an example:
>
> class Item:
>     genre = models.ForeignKey(Genre)
>
> class Genre:
>     name = models.CharField()
>
> class Video:
>     genre = models.ManyToManyField(Genre)
>
> Heres the situation.. I want to do a get() on item and find any items
> where the item.genre is equal to one of the video's genres. A video
> can have many genres.
>
> My first thought was Item.objects.get(genre=video.genre.all()), but
> this only works when there is only one genre selected for the video.
> Is there any way to do this without doing an iteration on the videos
> selected genres and testing each case?
>
> I feel like i've accomplished this before, but I may just be having an
> off day. 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-us...@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: Queryset causes error on form validation

2010-04-12 Thread Alastair Campbell
To answer my own question, it looks like you can't do this:
class LinkForm(ModelForm):
   event = 
forms.ModelChoiceField(queryset=Event.objects.filter(start_date__lte=today).order_by('-start_date')[:15])

The limit (of 15) will be counted as another 'slice' when the form is validated.

I got around it by adding another (time based) filter, rather than
limiting by number.

Cheers,

-Alastair

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Installing Djnajo/Python on IIS6

2010-04-12 Thread Sohrab Hejazi
We are currently installing the latest version of Django and Python on
IIS6. We have followed the instructions on the following site:

 http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer
We are receiving a 403 error when trying to access our Django
application via the IIS server. We have verified the python
installation on IIS6 and it is working property. We have also verified
the Django installation. Our application runs fine under the built-in
Django server, but we are having difficulties getting it to run under
IIS.

We presume we could be getting errors from "Linking Django to
PyISAPIe" section of the instructions provided on the link above.

Thank.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Need Example/Tutorial - building a datagrid into a django app built on Google AppEngine

2010-04-12 Thread codingJoe
Rookie programmer here, so please excuse if this is the wrong forum.

I have a simple app on Google Appengine that uses the built in django
template system.   This displays the data great, the forms, work etc.

What I really want is a way to edit the data within a table interface,
like a datagrid.  I have no idea how to do this, or where to begin.
The key is that it needs to display and modify objects in Google's
db.Model.

Advice?  Can someone point me to an example/or tutorial on how to do
this?

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-us...@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 2 different filtered inline formsets of the same table

2010-04-12 Thread Tim Langeman
I'd like to display 2 inline forms on the same page, which are
different filtered versions of the same table.

Screenshot of the page: 
http://static.mftransparency.org/media/misc/2-inline-filtered-formsets.png

I filter the queryset to limit the form to a subset of the table:

class DisbursementProductFeesFormSet(BaseInlineFormSet):
def get_queryset(self):
return
ProductFees.objects.filter(product=self.instance).filter(assessedAt=1)

class ContinuingProductFeesFormSet(BaseInlineFormSet):
   def get_queryset(self):
   return
ProductFees.objects.filter(product=self.instance).filter(assessedAt=2)

I am able to get the form to display using the following controller
code:

ProductFeesFormSet = inlineformset_factory(Product, ProductFees,
formset=DisbursementProductFeesFormSet, extra=2, max_num=2)
disbursementFeesFormset = ProductFeesFormSet(instance=data)

ContinuingFormset = inlineformset_factory(Product, ProductFees,
formset= ContinuingProductFeesFormSet, extra=2, max_num=2)
continuingFeesFormset = ContinuingFormset(instance=data)

But I have problems saving saving the forms individually, which I
theorize is because the fields on both forms are created with the same
field ids, as seen by this example for the description field:

  disbursement inline form:
id_productfees_set-0-description

  continuing inline form:
id_productfees_set-0-description

Is there a way that I can setup the two forms so that their field
names are different, or is there a better way to display two different
versions of the same table on the same form?

-Tim Langeman
Akron, PA

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: manage.py loaddata silently fails

2010-04-12 Thread Phlip
> How do I access the error message?

In this case, turning on --verbosity=2 reveals a huge dump, and
tweezering through it reveals the fixture file was not found. (A
colleague bumped its app from the app list.)

It seems that "fixture not found" should be a fatal error, not a
silent warning. The fixtures= line also has this bug.

--
  Phlip

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



manage.py loaddata silently fails

2010-04-12 Thread Phlip
Djangoists:

(Under version 1.1.1) loaddata (and the fixtures= line in tests)
silently fails if the data cannot load.

How do I access the error message?

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: determining if a one-to-many relation exists

2010-04-12 Thread Nick Serra
Welcome! You might just want to incorporate the answer into the
question model, and then do a boolean field for is_answered for quick
reference. The thought of multiple answers for one question seems odd,
and use of one-to-one fields isn't recommended, so i'd just keep it in
one model l)

On Apr 12, 1:32 pm, Jim N  wrote:
> Yes!  That's it!  Thank you.
>
> On Apr 12, 1:21 pm, Nick Serra  wrote:
>
>
>
> > You could query like this:
>
> > Question.objects.filter(answer__isnull=False)
>
> > This would give you a set of questions where an answer exists. Setting
> > it to True would give you a set where answers don't exist.
>
> > On Apr 12, 12:20 pm, Jim N  wrote:
>
> > > Just to clarify, I'm trying to filter questions that have an answer,
> > > but I don't know the particular answer.  I just want to determine
> > > whether or not an answer object exists, with the foreign key of this
> > > question.
>
> > > I could do
>
> > >   Answer.objects.filter(question = my_question)
>
> > > but I am filtering questions on a number of parameters, such as text
> > > of the question.
>
> > > Thanks,
> > > Jim
>
> > > On Apr 12, 11:50 am, Jim N  wrote:
>
> > > > Hi Djangoists,
>
> > > > I have a model "question" which has a one-to-many relationship with
> > > > "answer".
>
> > > > class Question(models.Model):
> > > >     text = models.TextField()
>
> > > > class Answer(models.Model):
> > > >     text = models.TextField()
> > > >     question = models.ForeignKey(Question)
>
> > > > I can't figure out how to construct a filter that will give me
>
> > > > - just questions where there isn't an answer
> > > > - just questions where there is an answer
>
> > > > Is this really easy and I'm just not seeing it?
>
> > > > Thanks,
> > > > Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Populating fields from the admin section

2010-04-12 Thread wizard
I think this can help you, it allows you to make choices for django
admin fields.

http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.choices
http://www.djangoproject.com/documentation/models/choices/

-Francis

On Apr 12, 10:58 am, Daxal  wrote:
> Hey,
>
> I am wondering on how to populate list of items for a specific field
> on model from the admin section of Django?
>
> For ex,
>
> class  cvdb(models.Model):
> language = models.ManyToManyField(Language,
> db_table='cm_cvdb_language',
>                                     verbose_name="languages")
>
> I would like to populate "language" field options on the template.
> Please advise me on how to do this. I am new to Django...I looked up
> on forums outside of here but I cannot seem to find anything.
>
> Please advise.
>
> Thank you! (:  <3

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: determining if a one-to-many relation exists

2010-04-12 Thread Jim N
Yes!  That's it!  Thank you.

On Apr 12, 1:21 pm, Nick Serra  wrote:
> You could query like this:
>
> Question.objects.filter(answer__isnull=False)
>
> This would give you a set of questions where an answer exists. Setting
> it to True would give you a set where answers don't exist.
>
> On Apr 12, 12:20 pm, Jim N  wrote:
>
> > Just to clarify, I'm trying to filter questions that have an answer,
> > but I don't know the particular answer.  I just want to determine
> > whether or not an answer object exists, with the foreign key of this
> > question.
>
> > I could do
>
> >   Answer.objects.filter(question = my_question)
>
> > but I am filtering questions on a number of parameters, such as text
> > of the question.
>
> > Thanks,
> > Jim
>
> > On Apr 12, 11:50 am, Jim N  wrote:
>
> > > Hi Djangoists,
>
> > > I have a model "question" which has a one-to-many relationship with
> > > "answer".
>
> > > class Question(models.Model):
> > >     text = models.TextField()
>
> > > class Answer(models.Model):
> > >     text = models.TextField()
> > >     question = models.ForeignKey(Question)
>
> > > I can't figure out how to construct a filter that will give me
>
> > > - just questions where there isn't an answer
> > > - just questions where there is an answer
>
> > > Is this really easy and I'm just not seeing it?
>
> > > Thanks,
> > > Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: determining if a one-to-many relation exists

2010-04-12 Thread Nick Serra
You could query like this:

Question.objects.filter(answer__isnull=False)

This would give you a set of questions where an answer exists. Setting
it to True would give you a set where answers don't exist.

On Apr 12, 12:20 pm, Jim N  wrote:
> Just to clarify, I'm trying to filter questions that have an answer,
> but I don't know the particular answer.  I just want to determine
> whether or not an answer object exists, with the foreign key of this
> question.
>
> I could do
>
>   Answer.objects.filter(question = my_question)
>
> but I am filtering questions on a number of parameters, such as text
> of the question.
>
> Thanks,
> Jim
>
> On Apr 12, 11:50 am, Jim N  wrote:
>
>
>
> > Hi Djangoists,
>
> > I have a model "question" which has a one-to-many relationship with
> > "answer".
>
> > class Question(models.Model):
> >     text = models.TextField()
>
> > class Answer(models.Model):
> >     text = models.TextField()
> >     question = models.ForeignKey(Question)
>
> > I can't figure out how to construct a filter that will give me
>
> > - just questions where there isn't an answer
> > - just questions where there is an answer
>
> > Is this really easy and I'm just not seeing it?
>
> > Thanks,
> > Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Why would the {{new_password}} be blank in the reset password email?

2010-04-12 Thread phoebebright
I'm using the standard reset password option and all the other fields
are filled in but the {{new_password}} field is blank.
Here is the email:

You're receiving this e-mail because you requested a password reset
for your user account at nwlc

Your new password is:

Feel free to change this password by going to this page:

http://nwlegalconsortium.com/password_change/

Your username, in case you've forgotten: phoebe


Any suggests on why the new password is coming up blank?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



querying on a field equal to a manytomany object

2010-04-12 Thread Nick Serra
Hey everyone, thanks for looking. I couldn't think of a good title for
this one. I have a question on queries on manytomany relations. Here
is an example:

class Item:
genre = models.ForeignKey(Genre)

class Genre:
name = models.CharField()

class Video:
genre = models.ManyToManyField(Genre)



Heres the situation.. I want to do a get() on item and find any items
where the item.genre is equal to one of the video's genres. A video
can have many genres.

My first thought was Item.objects.get(genre=video.genre.all()), but
this only works when there is only one genre selected for the video.
Is there any way to do this without doing an iteration on the videos
selected genres and testing each case?

I feel like i've accomplished this before, but I may just be having an
off day. 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-us...@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: determining if a one-to-many relation exists

2010-04-12 Thread Jim N
Just to clarify, I'm trying to filter questions that have an answer,
but I don't know the particular answer.  I just want to determine
whether or not an answer object exists, with the foreign key of this
question.

I could do

  Answer.objects.filter(question = my_question)

but I am filtering questions on a number of parameters, such as text
of the question.

Thanks,
Jim

On Apr 12, 11:50 am, Jim N  wrote:
> Hi Djangoists,
>
> I have a model "question" which has a one-to-many relationship with
> "answer".
>
> class Question(models.Model):
>     text = models.TextField()
>
> class Answer(models.Model):
>     text = models.TextField()
>     question = models.ForeignKey(Question)
>
> I can't figure out how to construct a filter that will give me
>
> - just questions where there isn't an answer
> - just questions where there is an answer
>
> Is this really easy and I'm just not seeing it?
>
> Thanks,
> Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: code repetition in views

2010-04-12 Thread zweb
To Summarize, two options are,

1) Template method pattern which Thierry suggested
http://en.wikipedia.org/wiki/Template_method_pattern

2) Django Decorators


On Apr 10, 11:38 pm, Thierry Chich  wrote:
> I have written my functions as méthods of classes. Then it allow to  
> use inheritance.
>
> Le 11 avr. 2010 à 05:58, ydjango  a écrit :
>
> > I find all my view method have identical code in start and in end:
>
> > anyway to avoid repetition...?
>
> > Example:
>
> > def typical_view_method(request):
>
> >   Check if user is authenticated.
> >   Get user and group
> >   Get some session variables
>
> >   try:
> >         Method specific logic
> >   except Exception, e:
> >         view_logger.error('error in typical_view_method:%s', e)
>
> >    response = HttpResponse(json_data, mimetype = 'application/json')
> >    response.__setitem__('Cache-Control', 'no-store,no-cache')
> >    response.__setitem__('Pragma', 'no-cache')
> >    response.__setitem__('Expires', '-1')
> >    return response
>
> > --
> > You received this message because you are subscribed to the Google  
> > Groups "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en
> > .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



determining if a one-to-many relation exists

2010-04-12 Thread Jim N
Hi Djangoists,

I have a model "question" which has a one-to-many relationship with
"answer".

class Question(models.Model):
text = models.TextField()

class Answer(models.Model):
text = models.TextField()
question = models.ForeignKey(Question)

I can't figure out how to construct a filter that will give me

- just questions where there isn't an answer
- just questions where there is an answer

Is this really easy and I'm just not seeing it?

Thanks,
Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django Sphinx Foreign key search

2010-04-12 Thread urukay

Hi,

I'm trying to create full text search on model, everything goes fine when
searching TextFields but I have a problem with ForeignKey field.

How can i do that? Can anyone point me to the right direction?

Thanks

Model example:

class Model1(models.Model):

 text_field =models.TextField(max_length=250)
 fek_field = models.ForeignKey('Model2')

class Model2(models.Model):
 text_field = models.TextField(max_length=250)

-- 
View this message in context: 
http://old.nabble.com/Django-Sphinx-Foreign-key-search-tp28219147p28219147.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Request to the list owner

2010-04-12 Thread Thierry CHICH

> On Mon, Apr 12, 2010 at 1:58 PM, Omer Barlas  wrote:
> > Can you please add a prefix to the email subject? I am reading my mail
> > mostly from my BB Bold, but I cannot filter mail like Thunderbird
> > does, it would be much simpler if there was a prefix like [django] or
> > such.
> 


It is true that mobile email client are not doing a very good job with 
filtering. Some of them don't do any job at all.

> No.
> 
> This has been proposed and rejected *many* times in the past. For example:
> 
> http://groups.google.com/group/django-users/browse_thread/thread/685617964e
> fab5f4
>  http://groups.google.com/group/django-users/browse_thread/thread/6207286aa
> 908f9b5
>  http://groups.google.com/group/django-users/browse_thread/thread/d8cc4b2f2
> 324d91b
>  http://groups.google.com/group/django-users/browse_thread/thread/6614ad241
> b3921f1
>  http://groups.google.com/group/django-users/browse_thread/thread/42a92e48c
> ec5c7c2
> 
> No offense, but if your mail client can't filter mail, then you need
> to get a better mail client.
> 
> Yours,
> Russ Magee %-)
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 Admin Form for ManyToMany, missing Green Plus Sign?

2010-04-12 Thread Timothy.Broder
Thanks this helped me with a similar problem

On Feb 16, 8:18 am, Matt Schinckel  wrote:
> On Feb 14, 3:49 pm, john  wrote:
>
>
>
> > Yes, the Items model data can be accessed through another part of the
> > Admin interface, but I think the purpose of the Green Plus Sign was to
> > alleviate this extra step.
>
> Try registering the model of that type with the admin. The green plus
> will only appear if the model is registered - otherwise it is unable
> to find a change_form to allow for adding/editing the initial values.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: How to find the file / directory which is hidden?

2010-04-12 Thread bruno desthuilliers

On 12 avr, 14:47, Pradnya  wrote:
> Hello,
>
> I am using Django with Python on windows. I want to list the files
> from specific directory and want to highlight files / directories
> which are hidden. How to recognize a file / directory as it's hidden?

This is highly platform-specific, and by no way specific to Django
(IOW: should have post this to comp.lang.python).

On most unices, the convention is to prefix the file or directory name
with a dot, so it's quite easy. On Windows, I guess you'll have to use
the Win32 extensions (I failed to spot anything about this in the
stdlib).

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Populating fields from the admin section

2010-04-12 Thread Daxal
Hey,

I am wondering on how to populate list of items for a specific field
on model from the admin section of Django?

For ex,

class  cvdb(models.Model):
language = models.ManyToManyField(Language,
db_table='cm_cvdb_language',
verbose_name="languages")

I would like to populate "language" field options on the template.
Please advise me on how to do this. I am new to Django...I looked up
on forums outside of here but I cannot seem to find anything.

Please advise.

Thank you! (:  <3

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



[UPDATED] Re: django.views.generic.create_update : tags behavior

2010-04-12 Thread m2k1983
Hello,  I kind of found the answer;  for create_update generic view,
the framework create a ModelForm object 'form', but in package form,
class Field only has the following instance attributes. In particular,
why attribute label worked and others did not, can be explained.

In further tracing, why widget method worked is because the max_length
attribute of the CharField of the model has a special widget method,
which copies the max_length attribute into a 'attr' dictionary, which
is in turn used by the widget's render method.

Conclusion is (as of Django 1.1.1):  within a template,  variable tags
can access fields, but not their attributes, except for the label
attribute.

Question: Is this the intended behavior?

incl: excerpts of  /site-packages/django/forms/fields.py

class Field(object):
def __init__(self, required=True, widget=None, label=None,
initial=None,
 help_text=None, error_messages=None,
show_hidden_initial=False):
  """
   # required -- Boolean that specifies whether the field is
required.
# True by default.
# widget -- A Widget class, or instance of a Widget class,
that should
#   be used for this Field when displaying it. Each
Field has a
#   default Widget that it'll use if you don't specify
this. In
#   most cases, the default widget is TextInput.
# label -- A verbose name for this field, for use in
displaying this
#  field in a form. By default, Django will use a
"pretty"
#  version of the form field name, if the Field is
part of a
#  Form.
# initial -- A value to use in this Field's initial display.
This value
#is *not* used as a fallback if data isn't given.
# help_text -- An optional string to use as "help text" for
this Field.
# show_hidden_initial -- Boolean that specifies if it is
needed to render a
#hidden widget with initial value
after widget.
   """

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to use IPC in Django??

2010-04-12 Thread vishwanath
thanks for your reply i will try python socket programming in views and if i
have any problems will post it

On Mon, Apr 12, 2010 at 4:41 PM, Javier Guerra Giraldez
wrote:

> On Mon, Apr 12, 2010 at 5:19 AM, vishwanath b 
> wrote:
> > tom i know  the programming language is python but the framework is
> > djangoso i want to know how to use the python socket code in this
> > framework that is what my question is?
>
> - there's no IPC code in Django
> - there are lots of IPC in Python
>
> that's why you should look for Python, not Django
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Pattern for filtering based on user input

2010-04-12 Thread wizard
I have a simple filter that takes input based upon the url.

urlpatterns = patterns('ahrlty.listings.views',
(r'^(?P.*)$', 'index'),
)

In the view I do a simple validation against a tuple in my listings
model that I use for choices in a field.

if dict(Listing.listing_types).has_key(listing_type) == False:
listing_type = None

And finally I get my data filtering on the listing_type if it exists,
otherwise I just want all the data. (Instead of none of it.)

if listing_type:
data = Listing.objects.filter(is_published = True,
listing_type = listing_type)
else:
data = Listing.objects.filter(is_published = True)

That last if statement works for this situation but I can see a
situation where I'm passing a few optional arguments in and an if
statement would get unwieldy.

I was thinking of chaining the filters for each optional field.

data = Listing.objects.filter(is_published = True)
if listing_type:
data = data.filter(listing_type = listing_type)

Is there a better way to construct the filter?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: New User - Writing your first Django app part 1 crashed

2010-04-12 Thread Jeremy Dunck
On Sat, Mar 27, 2010 at 10:40 PM, Paul Harouff  wrote:
> On Sat, Mar 27, 2010 at 2:45 AM, Thierry Chich  
> wrote:
>> Are you sure that the postgres driver of your jython is installed ?
>>
>
> Yes. But I don't believe Jython is seeing it.
>
> I might have to switch to python. I was hoping to use jython so the
> application would be easier to port to laptops using a CDROM. The
> documentation said django was 100% compatible with jython.

It should be, but using Django under jython is a minority case; your
bug reports would be a valuable community contribution.

We lean pretty heavily on Oracle-using for continued Oracle support --
jython support would be no different.

In this case, it sounds like an issue specific to jython and its
postgres driver, so you may have better luck asking their user group
for help:
https://lists.sourceforge.net/lists/listinfo/jython-users

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: MySQLdb setup on snow leopard help

2010-04-12 Thread Alex Robbins
If you are planning to deploy to linux servers, you might have a nicer
time developing on a linux vm. I have a mac, but do my development in
an ubuntu vm. Many difficult installations become a simple "sudo apt-
get install ".
YMMV,
Alex

On Apr 12, 2:09 am, Bdidi  wrote:
> I reinstalled XCode to include 10.4 support and tried again, and
> MySQLdb is now installed, but now I get this:
>
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
> site-packages/django/db/backends/mysql/base.py", line 13, in 
>     raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: dlopen(/Users/bduncan/.python-eggs/MySQL_python-1.2.3c1-py2.6-
> macosx-10.3-fat.egg-tmp/_mysql.so, 2): Symbol not found:
> _mysql_affected_rows
>
> Can anyone point in the right direction on this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Giving up PHP. ...Can't decide between Django & Rails

2010-04-12 Thread Andy Mikhailenko
Hi,

> I'm a little concerned by django error handling.

you could try the Werkzeug debugger[1], it really does save time a
lot. Or, by the way, you could try Werkzeug without Django, in some
cases it's a good idea.
There are many good frameworks, I suggest that you pick the language
first and then settle down with the tools written in it.

[1] http://dev.pocoo.org/projects/werkzeug/wiki/UsingDebuggerWithDjango

Cheers,
Andy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



django.views.generic.create_update : tags behavior

2010-04-12 Thread m2k1983
Hello,

I am new to Django. I tried experimenting with create_update generic
view, exploring the template tags, especially concerning widgets.

 From my reading of the documentation, within the
_form.html is passed the model form (either
passed in, or the framework create one), and therefore, the model
fields are accessible, and can be used as tags.  QUESTION: How about
the attributes of the field?

If I use widget, it works nicely. That is, the attribute 'max_length'
is properly rendered as maxlength.

However,  if the tags try access to attributes within the model
fields, it does *not* work for all attributes, except label.

Can I be enlighten on :Is this the right approach ?  Are tags like
{{ form.title.max_length }} is syntactically correct?

___ model.py ___

class Example(models.Model):
"""An Example"""
title = models.CharField(blank=True, max_length=30)

___ example_form.html ___





This is OKAY:  {{ form.title.label }} :

This is NOT okay: {{ form.title.max_length }}


===

p/s: usefulness :  explore doing sway with widgets, and exploring
using some kind of javascript ui library, extracting attributes like
max_length as arguments to javascript function call).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Giving up PHP. ...Can't decide between Django & Rails

2010-04-12 Thread Brian Morton
This is a tough question for sure.

If you prefer Ruby syntax, then to me it seems clear.  If it feels
clunky, it won't flow properly and you won't code as well.

Then again, you point out that you built a finished product quickly
and you're happy with it compared to what you built with Rails.  Isn't
that the point ;)

If you perceive that more Rails work is available, I would suggest
going down that path and maintaining your "hobbyist" interest in
Django.  It just depends on your goals.

On Apr 9, 12:06 pm, UnclaimedBaggage  wrote:
> Hi folks,
>
> I'm a long-term (8 years) PHP developer who's recently started
> dabbling with Rails & Django. I REALLY like what I've seen from both
> frameworks and quite frankly, am a little miffed I didn't jump on the
> bandwagon earlier.
>
> I'm trying to decide between the two frameworks, but I'm
> struggling to get out of stalemate. If anyone can offer advice, I'd be
> very appreciative. Here are my current thoughts:
>
> WHAT I LIKE ABOUT DJANGO
> * I LOVE django-admin . For the sort of work I do, which is a lot of
> customised cart/cms stuff, this would save a lot of time.
> * Code reusability seems superior. Opinions?
> * Better perfomance?
> * I've half-built a shopping cart app in Django that I'm happy with. A
> quick dabble in Rails made this task seem a little more time-
> consuming, and I'm not comfortable with drop-in solutions
> * Server seems more stable. Using the rails dev server on a local
> linux box twice threw errors I couldn't trace, then worked fine again
> the next time I restarted my computer (having previously restarted the
> server with no result). Is this a common problem?
>
> WHAT I LIKE ABOUT RAILS
> * I prefer the syntax
> * There seems to be a lot more work for rails...with better pay
> * "Agile Rails" is a damn fantastic book. I haven't found much Django
> documentation I've enjoyed as much
> * Seems to be a little simpler
> * Seems to have a greater depth of features
> * Better AJAX integration from what I've seen
>
> Obviously I expect some django-tilted opinions here, but if anyone
> with
> experience in both can offer a balanced perspective on pros-n-cons of
> each it would be a big help.
>
> Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 properties as filters in the admin

2010-04-12 Thread filias
Hi,

I would like to know if it is possible to use properties as filters in
the admin site.

I have a model with a property and would like to use this property as
a filter. As far as I read in the documentation one can only use
attributes as filters but I would like to know if there is any
workaround or any advices in this topic.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



How to find the file / directory which is hidden?

2010-04-12 Thread Pradnya
Hello,

I am using Django with Python on windows. I want to list the files
from specific directory and want to highlight files / directories
which are hidden. How to recognize a file / directory as it's hidden?

This particular application could be running on Unix / Linux platform.
Is there any common method which gives information as the file is
hidden? Or if it is possible using file header?

Please suggest.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to achieve the break tag in django template

2010-04-12 Thread David De La Harpe Golden

On 09/04/10 12:42, CCC wrote:

now i have a finished template which wrote by j2ee,like this:


Your template stuff (FreeMarker I think?), well, it is not Django.


And Now i want to changeit,write by django,anyone know how to achieve
the "<#break>"
in this tenplate
thanks!



Well, you can't (IIRC)... but N.B. you probably only think you need it.

This isn't some strange oversight, it'd be fairly easy for django 
developers to add if they actually wanted it in*.  Admittedly, template 
languages do have a way of slowly growing in complexity until they do 
all sorts of stuff not originally envisaged, but it's a design decision 
to deliberately leave things out in template languages as they're not 
"for" general programming - complex loop control logic in the template 
is kind of a sign you're straying into things more properly handled 
elsewhere.


* note how e.g. jinja2 has a break and continue as an extension 
(jinja2.ext.loopcontrols) to its django-like "for" construct - but an 
extension that you have to explicitly enable so you know you're being 
naughty.


Reformatting for readability and commenting (^^^) -

<#list  dailyStarList as dailyS>

^^^ this could conceivably  become something like
^^^ {% for daily_star in daily_star_list %}

 
   class="list_color_w"
 <#else>
   class="list_color"
 
>

^^^ django has cycle (actually FreeMarker might too for all I know),
^^^ allowing a verbosity reduction
^^^ 

 
   <#list chatAvatarList as cal>
 <#if dailyS.avatarid == cal.id>
   ${(cal.name[0..1])!''}之星
   <#break>
 
   
 

^^^ This is why you _think_ you need break. But chances are
^^^ you wouldn't do it this way in the first place. This is (ab)using
^^^ a looping construct to iterate over the avatar list until
^^^ you find a matching avatar to the current daily_star in the outer
^^^ loop - when your
^^^ daily star instances presumably could just have a related avatar,
^^^ or at least a method returning the relevant avatar.
^^^ So this should probably
^^^ just be something like (n.b. I'm vague on the precise meaning of
^^^ some FreeMarker operators but that's incidental):
^^^
^^^ {{ daily_star.avatar.name|slice:":2"|default:"" }}之星
^^^
^^^ (aside: even if you did still want to do what you are
^^^ doing but left out the break, think about it - it probably wouldn't
^^^ matter much:
^^^ it'd just pointlessly continue iterating through the list until the
^^^ end, and computers operating at the speed they do, you mightn't
^^^ notice unless your list was enormous...)

 
   <#if (dailyMemberList)??>
 <#list  dailyMemberList as dm>
   <#if dailyS.idx == dm.idx>
 ${(dm.myname)!''}
 <#break>
   
 
  
 

^^^ Again you're apparently (ab)using list/if/break to do some sort
^^^ of a related object lookup.
^^^  {{ daily_star.daily_member.myname|default:"" }}
^^^

 
   ${(dailyS.dailyNum)?c!''}
 

^^^ {{ daily_star.daily_num|stringformat:"d"|default:"" }}
^^^ or something like that, with the caveat that FreeMarker c and
^^^ %d probably aren't exact equivalents.

  



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: Django Generic List Views & models.Manager

2010-04-12 Thread 10000angrycats
Here's the (simple) solution:
http://stackoverflow.com/questions/2621440/generic-list-view-raises-attribute-error-function-object-has-no-attribute-c

Change  .filter(pub_date__lte=datetime.datetime.now())
to  .filter(pub_date__lte=datetime.datetime.now)

On Apr 12, 11:46 am, QC  wrote:
> An odd error here, perhaps someone can help track down source as it's
> attempting to extend the Django CMS & attempts to use uses some logic
> written as part of that project. In short, using:
>
> urls.py
> ==
> from django.conf.urls.defaults import *
> from cmsplugin_flat_news.models import News
>
> '''RETURNING _CLONE ERROR WHEN IMPLEMENTED
> def get_news():
>         return News.published.all()
>
> news_dict = {
>         'queryset': get_news,
>
> }
>
> news_list_dic = {
>         'queryset': get_news,
>         'paginate_by': 50,}
>
> '''
> # NEXT SECTION FUNCTIONS BUT NEEDS SERVER RESTART TO SEE NEW POSTS.
> SEE:http://docs.djangoproject.com/en/dev/topics/db/queries/#caching-and-q...
> & EXAMPLE 
> HERE:http://docs.djangoproject.com/en/dev/topics/generic-views/#adding-ext...
>
> news_dict = {
>         'queryset': News.published.all(),
>
> }
>
> news_list_dic = {
>         'queryset': News.published.all(),#SAME ISSUE
>         'paginate_by': 50,
>
> }
>
> urlpatterns = patterns('django.views.generic.list_detail',
>         (r'^$', 'object_list', news_list_dic),
>         (r'^(?P[0-9]+)/$', 'object_list', dict(news_list_dic)),
>         url(r'^(?P[-\w]+)/$', 'object_detail', news_dict,
> name='news_view'),
> )
>
> models.py
> ==
> class PublishedNewsManager(models.Manager):
>         #Filters out all unpublished news and news with a publication date in
> the future
>         def get_query_set(self):
>                 return super(PublishedNewsManager, self).get_query_set() \
>                                         .filter(is_published=True) \
>                                         
> .filter(pub_date__lte=datetime.datetime.now())
>
> class News(models.Model):
>         title                   = models.CharField(_('Title'), max_length=255)
>         slug                    = models.SlugField(_('Slug'), 
> unique_for_date='pub_date')
>         author                  = models.ForeignKey(User)
>         description             = models.TextField(_('Description'), 
> blank=True)
>         image                   = generic.GenericRelation('NewsImage', 
> blank=True, null=True)
>         content                 = models.TextField(_('Content'), blank=True)
>         tags                    = TagField()
>         is_published    = models.BooleanField(_('Published'), default=False)
>         pub_date                = models.DateTimeField(_('Publication date'),
> default=datetime.datetime.now())
>         created                 = models.DateTimeField(auto_now_add=True, 
> editable=False)
>         updated                 = models.DateTimeField(auto_now=True, 
> editable=False)
>         published               = PublishedNewsManager()
>         objects                 = models.Manager()
>
> ===
> See issue in comments: basically, error raised by implementing the
> 'correct' solution to add extra context to the views. Error is
> Attribute Error: "'function' object has no attribute '_clone'"
>
> Trying: News.published.all instead of News.published.all() raises the
> error whether used as part of a wrapper function or directly in the
> queryset part of the urlpattern.
>
> Must be missing something obvious? Think it is to do with the
> PublishedNewsManager not returning objects as a dictionary, or
> tweaking the code to correctly return the objects to the view.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: dumping data in utf-8

2010-04-12 Thread Andrey Torba
Thanks, Peter, this is what i want.

Now the question is how to customize django to use 'allow_unicode=True' and
'default_flow_style=False'?

I found quick and dirty solution.
in Django-1.1.1-py2.5.egg/django/core/serializers/pyyaml.py

i changed a little:

def end_serialization(self):
self.options.pop('stream', None)
self.options.pop('fields', None)
yaml.dump(self.objects, self.stream, Dumper=DjangoSafeDumper*,
allow_unicode=True,* **self.options)

Now it dump readable data.

How can customize django yaml serializer?

-- 
Regards, Andrey

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Admin issues

2010-04-12 Thread Karen Tracey
On Mon, Apr 12, 2010 at 4:41 AM, Sheena  wrote:

> Still no luck...
> I've run syncdb and I can talk to my db through the interpreter easily
> so I don't think there's a problem with that.
> When i log in i get add and change options for Groups, Users, Comments
> and Sites but not for anything relating to my application (as created
> in chapter 5 of the Django Book 2, it looks to me like there should be
> an option to add and change stuff in my little database.
> I included the class admin stuff as a last ditch effort to get the
> thing to work, I found it on an older tutorial, just thought I'd see
> if it changed anything.
> Besides that, I'm using runserver when looking at my sites and i
> always restart it whenever i make changes that could alter my admin
> site.
>

So it sounds like the issue has something to do with your admin.py file --
that is where the admin registration calls for your own models are, and that
appears to be the only thing that isn't working. It is in your application
directory alongside models.py, right, not anywhere else? That is where it
needs to be in order to be found by the admin.autodiscover() in urls.py. You
might try putting some prints into it and seeing if it is getting loaded at
all.

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



Django Generic List Views & models.Manager

2010-04-12 Thread QC
An odd error here, perhaps someone can help track down source as it's
attempting to extend the Django CMS & attempts to use uses some logic
written as part of that project. In short, using:

urls.py
==
from django.conf.urls.defaults import *
from cmsplugin_flat_news.models import News

'''RETURNING _CLONE ERROR WHEN IMPLEMENTED
def get_news():
return News.published.all()

news_dict = {
'queryset': get_news,
}

news_list_dic = {
'queryset': get_news,
'paginate_by': 50,
}
'''
# NEXT SECTION FUNCTIONS BUT NEEDS SERVER RESTART TO SEE NEW POSTS.
SEE: 
http://docs.djangoproject.com/en/dev/topics/db/queries/#caching-and-querysets
& EXAMPLE HERE: 
http://docs.djangoproject.com/en/dev/topics/generic-views/#adding-extra-context

news_dict = {
'queryset': News.published.all(),
}

news_list_dic = {
'queryset': News.published.all(),#SAME ISSUE
'paginate_by': 50,
}

urlpatterns = patterns('django.views.generic.list_detail',
(r'^$', 'object_list', news_list_dic),
(r'^(?P[0-9]+)/$', 'object_list', dict(news_list_dic)),
url(r'^(?P[-\w]+)/$', 'object_detail', news_dict,
name='news_view'),
)

models.py
==
class PublishedNewsManager(models.Manager):
#Filters out all unpublished news and news with a publication date in
the future
def get_query_set(self):
return super(PublishedNewsManager, self).get_query_set() \
.filter(is_published=True) \

.filter(pub_date__lte=datetime.datetime.now())

class News(models.Model):
title   = models.CharField(_('Title'), max_length=255)
slug= models.SlugField(_('Slug'), 
unique_for_date='pub_date')
author  = models.ForeignKey(User)
description = models.TextField(_('Description'), blank=True)
image   = generic.GenericRelation('NewsImage', 
blank=True, null=True)
content = models.TextField(_('Content'), blank=True)
tags= TagField()
is_published= models.BooleanField(_('Published'), default=False)
pub_date= models.DateTimeField(_('Publication date'),
default=datetime.datetime.now())
created = models.DateTimeField(auto_now_add=True, 
editable=False)
updated = models.DateTimeField(auto_now=True, 
editable=False)
published   = PublishedNewsManager()
objects = models.Manager()

===
See issue in comments: basically, error raised by implementing the
'correct' solution to add extra context to the views. Error is
Attribute Error: "'function' object has no attribute '_clone'"

Trying: News.published.all instead of News.published.all() raises the
error whether used as part of a wrapper function or directly in the
queryset part of the urlpattern.

Must be missing something obvious? Think it is to do with the
PublishedNewsManager not returning objects as a dictionary, or
tweaking the code to correctly return the objects to the view.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to use IPC in Django??

2010-04-12 Thread Javier Guerra Giraldez
On Mon, Apr 12, 2010 at 5:19 AM, vishwanath b  wrote:
> tom i know  the programming language is python but the framework is
> djangoso i want to know how to use the python socket code in this
> framework that is what my question is?

- there's no IPC code in Django
- there are lots of IPC in Python

that's why you should look for Python, not Django

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Why is django returning only naive datetimes?

2010-04-12 Thread David De La Harpe Golden

On 09/04/10 19:05, Paweł Roman wrote:

I've noticed that django always fetches 'naive' datetimes from the
database. Tzinfo property on a datetime object is always set to null,
even if the database stores a value WITH a timezone.

This is a bit tedious because such datetime cannot be later converted
to any timezone. Each time I want to display a datetime on the screen
(converted to user's time zone) I have to copy it applying UTC as a
tzinfo (this is how it is stored in the database) and then convert to
relevant timezone with astimezone(). OK, that's one line of code :)
but I have a feeling that this line should be somewhere inside in the
django code.




I recommend using django settings.TIME_ZONE = 'UTC', then use:

http://github.com/brosner/django-timezones

to localize time for presentation.

N.B. Among other things it has a
LocalizedDateTimeField for use on models. If you use it and tell
it UTC, you should get a non-naive pytz UTC datetime.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: TemplateDoesNotExistError makes no sense

2010-04-12 Thread Dexter
AAh, Why didn't I think of that ><,

Well, thank you very much. It works now.

Grtz, Dexter

On Mon, Apr 12, 2010 at 1:16 AM, Sam Lai  wrote:

> On 12 April 2010 07:41, Dexter  wrote:
> > I have problem's with 2 templates, the newest, it is in the same dir as
> my
> > index.html template (Which does work).
> > The runserver runs with the same settings.py, so there should be no
> > difference
>
> I'd check file permissions on the inaccessible templates. I'm guessing
> your Apache user is different to the user you're running runserver
> with.
>
> > On Sun, Apr 11, 2010 at 11:24 PM, Shawn Milochik 
> wrote:
> >>
> >> On Apr 11, 2010, at 5:22 PM, David Zhou wrote:
> >>
> >> > On Sun, Apr 11, 2010 at 4:26 PM, Dexter  wrote:
> >> >
> >> >> I have a server running with primarily nginx and secundary apache2,
> >> >> And I am getting an template error trying to browse an app. It seems
> it
> >> >> cannot find a template, but it is certainly there, the runserver just
> >> >> works
> >> >> fine.
> >> >
> >> > Everything in programming makes sense, it's just a matter of figuring
> >> > out why something makes sense.
> >> >
> >> > Examine your trace -- there should be a list of directories of where
> >> > its looking for templates.  Verify that your template is actually in
> >> > one of those paths.
> >> >
> >> > -- dz
> >>
> >> Also, are you getting that error when you try to browse a page defined
> in
> >> one specific template, or all of your templates?
> >>
> >> The answer to that will also give you more information to use in solving
> >> the problem -- really big clues.
> >>
> >> Shawn
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@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.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@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.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: MySQLdb setup on snow leopard help

2010-04-12 Thread Steven Elliott Jr

Did you run the install as sudo?

-Steven Elliott Jr

On Apr 12, 2010, at 3:09 AM, Bdidi  wrote:


I reinstalled XCode to include 10.4 support and tried again, and
MySQLdb is now installed, but now I get this:

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
site-packages/django/db/backends/mysql/base.py", line 13, in 
   raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: dlopen(/Users/bduncan/.python-eggs/MySQL_python-1.2.3c1-py2.6-
macosx-10.3-fat.egg-tmp/_mysql.so, 2): Symbol not found:
_mysql_affected_rows

Can anyone point in the right direction on this?

--  
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@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 
.




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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: how to use IPC in Django??

2010-04-12 Thread vishwanath b
tom i know  the programming language is python but the framework is
djangoso i want to know how to use the python socket code in this
framework that is what my question is?

On Apr 12, 12:08 am, "Tom X. Tobin"  wrote:
> On Sun, Apr 11, 2010 at 12:45 PM, vishwanath b  wrote:
> > as i searched the net a lot django+IPCbut i
> > couldnt get any code
>
> This is your problem; stop searching for *Django* and start searching
> for *Python*.  The programming language is Python, not Django.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to achieve the break tag in django template

2010-04-12 Thread CCC
Thanks for reply
I know waht's you mean.
But in the template inside the for loop,there are some 'css',not only
just put the result in the template
That's  the difficult i can't solved out

On Apr 12, 4:41 pm, Jirka Vejrazka  wrote:
> >  the syntax you're using is not standard Django template syntax, so
> > unless someone has replaced the default Django tempating system with
> > the same one as you did (and is familiar with it and read your email),
> > you are unlikely to get a response from this list.
>
>   Oops - sorry. I misread your email (another proof I should not reply
> to anyone before my first cup of coffee ;-)
>
>   I'm not very familiar with j2ee syntax, but the logic seems a bit
> too heavy for a template, you might be better off implementing the
> logic in a view (hence, standard Python+Django), put the result in the
> context and only display the context in a template.
>
>   Just my 2 cents.
>
>     Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to achieve the break tag in django template

2010-04-12 Thread Jirka Vejrazka
>  the syntax you're using is not standard Django template syntax, so
> unless someone has replaced the default Django tempating system with
> the same one as you did (and is familiar with it and read your email),
> you are unlikely to get a response from this list.

  Oops - sorry. I misread your email (another proof I should not reply
to anyone before my first cup of coffee ;-)

  I'm not very familiar with j2ee syntax, but the logic seems a bit
too heavy for a template, you might be better off implementing the
logic in a view (hence, standard Python+Django), put the result in the
context and only display the context in a template.

  Just my 2 cents.

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Admin issues

2010-04-12 Thread Sheena
Still no luck...
I've run syncdb and I can talk to my db through the interpreter easily
so I don't think there's a problem with that.
When i log in i get add and change options for Groups, Users, Comments
and Sites but not for anything relating to my application (as created
in chapter 5 of the Django Book 2, it looks to me like there should be
an option to add and change stuff in my little database.
I included the class admin stuff as a last ditch effort to get the
thing to work, I found it on an older tutorial, just thought I'd see
if it changed anything.
Besides that, I'm using runserver when looking at my sites and i
always restart it whenever i make changes that could alter my admin
site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: how to achieve the break tag in django template

2010-04-12 Thread Jirka Vejrazka
>> now i have a finished template which wrote by j2ee,like this:
>>         <#list  dailyStarList as dailyS>
>>                > 0>class="list_color_w"<#else>class="list_color"><#list

  Hi,

  the syntax you're using is not standard Django template syntax, so
unless someone has replaced the default Django tempating system with
the same one as you did (and is familiar with it and read your email),
you are unlikely to get a response from this list.

  Sorry

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: MySQLdb setup on snow leopard help

2010-04-12 Thread Bdidi
I reinstalled XCode to include 10.4 support and tried again, and
MySQLdb is now installed, but now I get this:

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
site-packages/django/db/backends/mysql/base.py", line 13, in 
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: dlopen(/Users/bduncan/.python-eggs/MySQL_python-1.2.3c1-py2.6-
macosx-10.3-fat.egg-tmp/_mysql.so, 2): Symbol not found:
_mysql_affected_rows

Can anyone point in the right direction on this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: MySQLdb setup on snow leopard help

2010-04-12 Thread Bdidi
I'm also having problems with this. Installing setuptools was no
problem, but I still get errors trying to install MYSQLdb - this:

dyld: Library not loaded: /usr/local/lib/libintl.3.dylib
  Referenced from: /usr/local/bin/gnused
  Reason: image not found

which is odd since  libintl.3.dylib  is definitely there; and this:

building '_mysql' extension
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/
MacOSX10.4u.sdk

That squares with the fact that when I check where XCode is installed,
I find SDKs for 10.6 and 10.5 but not 10.4, but does this mean I need
the 10.4 SDK in order to install MYSQLdb?

Thx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Request to the list owner

2010-04-12 Thread Russell Keith-Magee
On Mon, Apr 12, 2010 at 1:58 PM, Omer Barlas  wrote:
> Can you please add a prefix to the email subject? I am reading my mail
> mostly from my BB Bold, but I cannot filter mail like Thunderbird
> does, it would be much simpler if there was a prefix like [django] or
> such.

No.

This has been proposed and rejected *many* times in the past. For example:

http://groups.google.com/group/django-users/browse_thread/thread/685617964efab5f4
http://groups.google.com/group/django-users/browse_thread/thread/6207286aa908f9b5
http://groups.google.com/group/django-users/browse_thread/thread/d8cc4b2f2324d91b
http://groups.google.com/group/django-users/browse_thread/thread/6614ad241b3921f1
http://groups.google.com/group/django-users/browse_thread/thread/42a92e48cec5c7c2

No offense, but if your mail client can't filter mail, then you need
to get a better mail client.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.