Re: how should reusable apps handle url namespace?

2010-06-04 Thread Daniel Roseman
On Jun 4, 5:06 am, HARRY POTTRER  wrote:
> I'm writing a forum app that I want to be reusable. All of my urls I
> have named. Some of them are named like "index" and "thread" which are
> generic and will likely collide with existing project's urls. I don't
> want to do something like name all my urls "forum_index" and
> "forum_thread" either.
>
> I think the best way is to use the new namespace feature, but I'm not
> quite sure how to do it for reusuable apps. The docs make it seem like
> the only purpose of namespace urls is when you have two or more
> instances of an app.

You don't need to do anything with it. You don't define the namespace
in the application's urlconf, the end developer does it when they
include your application's urlconf in their project-level one. See the
docs on defining namespaces:
http://docs.djangoproject.com/en/1.2/topics/http/urls/#defining-url-namespaces
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Manager.Raw() + Pagination

2010-06-04 Thread huw_at1
Ah I solved this now by realising I simply needed to cast the
RawQuerySet as a list.

On Jun 2, 7:52 am, huw_at1  wrote:
> Hi all,
>
> I'm trying to use Djangos new Raw feature to run a custom SQL and
> return back a list of objects. This works fine however I then want to
> paginate to present the results as a list. The RawQuerySet has no
> length value it seems to be able to paginate. Is there a recognised
> way of achieving this? Do I also need to run a "SELECT COUNT(*)" or
> should I look at writing my own pagination?
>
> Many 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.



danymic attributes in template

2010-06-04 Thread ChuanRen
for example:
keys=[item1,item2]
obj={item1:1,item2:2}

the template:
{%for key in keys%}
{{obj.key}}
{%endfor%}

In this example, the key in template will resolved to item1 and item2,
I thought:
{{obj.{{key
will work, but it output a error.

Any approach can solve this problem?

-- 
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: danymic attributes in template

2010-06-04 Thread Tom Evans
On Fri, Jun 4, 2010 at 10:15 AM, ChuanRen  wrote:
> for example:
> keys=[item1,item2]
> obj={item1:1,item2:2}
>
> the template:
> {%for key in keys%}
>    {{obj.key}}
> {%endfor%}
>
> In this example, the key in template will resolved to item1 and item2,
> I thought:
> {{obj.{{key
> will work, but it output a error.
>
> Any approach can solve this problem?
>

http://djangosnippets.org/snippets/1412/

Cheers

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.



Getting all the concrete model classes inheriting from a certain abstract model class

2010-06-04 Thread Vasil Vangelovski
Hi

I have around 30 models inheriting from one abstract model class and
the number may grow (there's a specific reason for this design
decision, involving making the database easy for people to make
reports from the data with other tools, namely ms access, and making
it easier to make changes to specific models ). I want to
programmaticaly set permissions to all these models for specific
groups in a management command (since dumping permissions wont work,
and setting them by hand takes a lot of time). So what I want to do is
get a list of all the concrete model classes inheriting  from a
certain abstract (or not) base class. Is there a specific way to do
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: Django sessions issue

2010-06-04 Thread Tom Evans
On Thu, Jun 3, 2010 at 9:06 PM, aa56280  wrote:
> Django's docs say: "When a user logs in, Django adds a row to the
> django_session database table. Django updates this row each time the
> session data changes. If the user logs out manually, Django deletes
> the row. But if the user does not log out, the row never gets
> deleted."
>
> I'm logging out of my app but I notice that the row DOES NOT get
> deleted. Is there something I'm missing here?
>

How are you logging out? Are you sure you are calling
django.contrib.auth.logout() ?

Cheers

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: Directory structuring

2010-06-04 Thread Dmitry Dulepov
Hi!

Mike Dewhirst wrote:
> a) It's not the standard.  I've looked around at subversion repository
> tutorials but can't seem to wrap my head around applying that to our
> software.

Why not the standard? Many large companies do it the same way as you do.

> b) Sometimes we need to change something on one site, but can't as the
> file is under version control and may cause a clash when I try to
> update it for a different fix later.

This is exactly why you have version control :) Commit it and update from
svn on the development workstations. Take a habit of updating 2-3 times a
day from SVN.

> c) If I'm working on a large job on a certain file on my development
> site, I can't commit that file to roll out a quick bug fix.

Here is where branches and tags come into work :) You can use one of two
workflows:
- use tags for "stable" versions and update production from a tag. Thus you
will have a tag for each stable version and can update to any of them if
you have to
- work in a branch and merge it to trunk when it is stable. This is harder
and you cannot update to a previous version or see its content if you have to

In both cases overwrite files in production unconditionally. Apache will
not see these changes until you restart it (or touch wsgi file), so you
have time to fix any conflicts. But if you force overwrite, you should not
have any conflicts.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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.



How to dynamically set limit_choices_to for ManyToManyField using values from an instance?

2010-06-04 Thread Massimiliano della Rovere
When displayed in the Admin interfaces, I'd like to filter the values
of n, so that instances of N already linked to other instances of A
sharing the same instance of o are not shown:
so when you edit an instance of A (let's call it "a"), you see only
the instances of n in use by a and the unsed ones (in the context of
o).

The problem is that I am not allowd to write self.choices_for_n()

Does anybody know any solution for this?

class A(models.Model):
o = models.ForeignKey(O)
p = models.ManyToManyField(P)
n = models.ManyToManyField(N, limit_choices_to=self.choices_for_n())

def choices_for_n(self):
unwanted = []
for z in self.o.z_set.all():
if z.id == self.id:
continue
unwanted += [z.id for z in z.n]
for n in N.objects.exclude(id__in=unwanted):
yield n.id

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



Multiples connections

2010-06-04 Thread Badio Nadae Ivar

Hi

i have one question i 'm new in django and on my appalication , i want 
to put one security.
that means i want if one user it's connected to block anymore client who 
want to connected with the same user at that time one the server.


Thanks

Sorry for my english

--
Nadae Ivar Badio

+221773018068

--
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 Upload with Progress Bar

2010-06-04 Thread Venkatraman S
Anyone who wants to work on this problem with me? We can probably
collaborate and release it over this weekend.


On Fri, Jun 4, 2010 at 3:16 AM, Brad Pitcher  wrote:

> Some versions of flash have a bug that causes the entire browser to
> freeze while uploading.  I am afflicted by the bug, running Flash 10.0
> r45 on Ubuntu 10.04.  It seems that there is no good solution at the
> moment.  My host is Webfaction and I just discovered that they have a
> non-configurable nginx server in front of everything that caches
> uploads before sending them on to apache/django making it impossible
> to do upload progress bars at the moment.  They are aware of the
> problem, but who knows when it will be fixed.
>
> On Jun 3, 8:31 am, Venkatraman S  wrote:
> > Oh yes! I was referring to a stand alone app. I heard someone complain
> > #django that filebrowser aint working right after uploadify was
> introduced.
> > Is that True?
> >
> > On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:
> > >http://code.google.com/p/django-filebrowser/
> >
> > > cheers,
> > > patrick
> >
> > > On 3 Jun., 16:10, Venkatraman S  wrote:
> > > > Hi Patrick,
> >
> > > > Can you share a simple django app which uses Uploadify?  Did you use
> > > vanilla
> > > > Uploadify or 
> > > > django-uploadify(github.com/tstone/django-uploadify*)*
> 
> > > ?
> > > > I have been simply unable to make it run.  I also tried a
> > > django-uploadify,
> > > > but no results! Frustrating it is.
> >
> > > > If you can share the code, i would rather use it along with some
> other
> > > > experiments that I have been doing and publish it in the public
> domain.
> >
> > > > Regards.
> >
> > > > On Thu, Jun 3, 2010 at 5:39 PM, patrickk 
> wrote:
> > > > > you could use uploadify, seehttp://www.uploadify.com/.
> >
> > > > > of course, it´s not an ideal solution since its flash-based.
> > > > > we´ve been using uploadify with django and the filebrowser for
> about a
> > > > > year now and it works quite well.
> >
> > > > > regards,
> > > > > patrick
> >
> > > > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > > > Tell me about it! Its quite insane that there is no
> single-standard
> > > > > solution
> > > > > > for this.
> > > > > > I have been hanging around in #django for sometime and there is
> still
> > > > > > opposition to flash based solution. Also, i have not been to get
> it
> > > > > working
> > > > > > inspite of it being not an ideal solution.
> > > > > > I hear that there are some issues with filebrowser since it uses
> > > > > Uploadify.
> > > > > > Also, i dont see any solution which works in both dev server and
> also
> > > in
> > > > > the
> > > > > > production using httpd/apache.
> >
> > > > > > Going insane! Let me know if you get anything working.
> >
> > > > > > PS: As i said, html5 is cool and works, but the client does not
> want
> > > to
> > > > > use
> > > > > > it!
> >
> > > > > > -V-http://twitter.com/venkasub
> >
> > > > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher <
> bradpitc...@gmail.com>
> > > > > wrote:
> > > > > > > Sort of, that's what the default is in the demo, but now I've
> > > noticed I
> > > > > > > have the same problem with apache progress reporting as I did
> using
> > > > > django
> > > > > > > progress reporting.  It's behaving like it's not multi-threaded
> or
> > > > > > > something.  It seems like I don't get any progress reports
> until
> > > the
> > > > > file
> > > > > > > has finished uploading.  It's actually driving me a bit crazy
> so
> > > I'm
> > > > > going
> > > > > > > to have to move on to something else for a while.
> >
> > > > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S <
> venka...@gmail.com>
> > > > > wrote:
> >
> > > > > > >> Does this work with the Django development server?
> >
> > > > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> > > bradpitc...@gmail.com
> > > > > >wrote:
> >
> > > > > > >>> Since I just spent much longer than it should have taken
> figuring
> > > > > this
> > > > > > >>> out, I will try and help you out.  I followed the
> instructions at
> > > the
> > > > > > >>> provided link and it sort of worked.  Not quite as well as I
> > > liked.
> > > > >  I
> > > > > > >>> used Apache for the progress reporting, which the author
> doesn't
> > > > > > >>> mention in the article but it is discussed here:
> >
> > > > >
> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
> > > ..
> > > > > > >>> (it involves compiling and installing an apache module).
> > > > > > >>> The author also doesn't mention changes needed in
> settings.py:
> > > > > > >>> from django.conf import global_settings
> >
> > > > > > >>> FILE_UPLOAD_HANDLERS =
> ('path.to.UploadProgressCachedHandler', )
> > > +
> > > > > > >>> \<-- change path here
> > > > > > >>>global_settings.FILE_UPLOAD_HANDLERS
> >
> > > > > > >>> If you are using nginx or apache for the server side instead
> o

RE: Re: utf8-problems

2010-06-04 Thread Henrik Genssen
no,

developing on macos, testing and production on debian

regards

Henrik

>reply to message:
>date: 03.06.2010 12:05:02
>from: "kirian" 
>to: "Django users" 
>subject: Re: utf8-problems
>
>just guessing.. are you developing on a windows machine and your
>encoding problems occure on a linux machine?
>did you tried the smart_str and smart_unicode functions!? these solved
>all my encoding problems..
>
>from django.utils.encoding import smart_str, smart_unicode
>
>On 3 Jun., 11:18, "Henrik Genssen"  wrote:
>> Hi,
>>
>> I do have utf-8 problems again.
>> My dev-system works, my stage system works, too - but production does not. 
>> And I do not see the error :-(
>> As I think, it is a misconfiguration problem, do we have a checklist, what 
>> and where to search for or test?
>> I have seen utf problems several times on the list - maybe such a checklist 
>> could help others, too?
>>
>> My problem is searching data with german umlaute using mysql backend - 
>> something like 'f r' ('for' in english)
>>
>> regards
>>
>> Henrik
>
>-- 
>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.



hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason of my

2010-06-04 Thread kanniga sivasubramanian
def bookmark_save_page(request):
  if request.method == 'POST':
form = BookmarkSaveForm(request.POST)
if form.is_valid():
  # Create or get link.
  link, dummy = Link.objects.get_or_create(
   url=form.cleaned_data['url']
  )
  # Create or get bookmark.
  bookmark, created = Bookmark.objects.get_or_create(
user=request.user,
link=link
  )
  # Update bookmark title.
  bookmark.title = form.cleaned_data['title']
  # If the bookmark is being updated, clear old tag list.
  If not created:
bookmark.tag_set.clear()
  # Create new tag list.
  tag_names = form.cleaned_data['tags'].split()
  for tag_name in tag_names:
tag, dummy = Tag.objects.get_or_create(name=tag_name)
bookmark.tag_set.add(tag)
  # Save bookmark to database.
  bookmark.save()
  return HttpResponseRedirect(
'/user/%s/' % request.user.username
  )
  else:
 form = BookmarkSaveForm()
  variables = RequestContext(request, {
'form': form
  })
  return render_to_response('bookmark_save.html', variables)

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

def bookmark_save_page(request):
  if request.method == 'POST':
form = BookmarkSaveForm(request.POST)
if form.is_valid():
  # Create or get link.
  link, dummy = Link.objects.get_or_create(
   url=form.cleaned_data['url']
  )
  # Create or get bookmark.
  bookmark, created = Bookmark.objects.get_or_create(
user=request.user,
link=link
  )
  # Update bookmark title.
  bookmark.title = form.cleaned_data['title']
  # If the bookmark is being updated, clear old tag list.
  If not created:
bookmark.tag_set.clear()
  # Create new tag list.
  tag_names = form.cleaned_data['tags'].split()
  for tag_name in tag_names:
tag, dummy = Tag.objects.get_or_create(name=tag_name)
bookmark.tag_set.add(tag)
  # Save bookmark to database.
  bookmark.save()
  return HttpResponseRedirect(
'/user/%s/' % request.user.username
  )
  else:
 form = BookmarkSaveForm()
  variables = RequestContext(request, {
'form': form
  })
  return render_to_response('bookmark_save.html', variables)


Re: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread Dj Gilcrease
syntax error is because of capitol 'I' in if

-- 
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: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread kanniga sivasubramanian
Thank for your(Dj Gilcrease) answer sir. I got the correct answer for
the problem.

On Fri, Jun 4, 2010 at 5:28 PM, Dj Gilcrease  wrote:
> syntax error is because of capitol 'I' in if
>
> --
> 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: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread Venkatraman S
Please do not send the email in teh subject line :)

-- 
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: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread Vinicius Mendes
I guess it is because the 'I' is uppercase. Try all the line in lowercase.

Atenciosamente,
Vinicius Mendes
Solucione Sistemas
vinic...@solucione.info


On Fri, Jun 4, 2010 at 8:54 AM, kanniga sivasubramanian <
kskanniga...@gmail.com> wrote:

> def bookmark_save_page(request):
>  if request.method == 'POST':
>form = BookmarkSaveForm(request.POST)
>if form.is_valid():
>  # Create or get link.
>  link, dummy = Link.objects.get_or_create(
>   url=form.cleaned_data['url']
>  )
>  # Create or get bookmark.
>  bookmark, created = Bookmark.objects.get_or_create(
>user=request.user,
>link=link
>  )
>  # Update bookmark title.
>  bookmark.title = form.cleaned_data['title']
>  # If the bookmark is being updated, clear old tag list.
>  If not created:
>bookmark.tag_set.clear()
>  # Create new tag list.
>  tag_names = form.cleaned_data['tags'].split()
>  for tag_name in tag_names:
>tag, dummy = Tag.objects.get_or_create(name=tag_name)
>bookmark.tag_set.add(tag)
>  # Save bookmark to database.
>  bookmark.save()
>  return HttpResponseRedirect(
>'/user/%s/' % request.user.username
>  )
>  else:
> form = BookmarkSaveForm()
>  variables = RequestContext(request, {
>'form': form
>  })
>  return render_to_response('bookmark_save.html', variables)
>
> --
> 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: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread kanniga sivasubramanian
hello Vinicius Mendes  sir,
   You are right. I had done the certain mistake only. I corrected
that. Thankyou for your acknowledgement.

On Fri, Jun 4, 2010 at 5:36 PM, Vinicius Mendes  wrote:
> I guess it is because the 'I' is uppercase. Try all the line in lowercase.
> Atenciosamente,
> Vinicius Mendes
> Solucione Sistemas
> vinic...@solucione.info
>
>
> On Fri, Jun 4, 2010 at 8:54 AM, kanniga sivasubramanian
>  wrote:
>>
>> def bookmark_save_page(request):
>>  if request.method == 'POST':
>>    form = BookmarkSaveForm(request.POST)
>>    if form.is_valid():
>>      # Create or get link.
>>      link, dummy = Link.objects.get_or_create(
>>       url=form.cleaned_data['url']
>>      )
>>      # Create or get bookmark.
>>      bookmark, created = Bookmark.objects.get_or_create(
>>        user=request.user,
>>        link=link
>>      )
>>      # Update bookmark title.
>>      bookmark.title = form.cleaned_data['title']
>>      # If the bookmark is being updated, clear old tag list.
>>      If not created:
>>        bookmark.tag_set.clear()
>>      # Create new tag list.
>>      tag_names = form.cleaned_data['tags'].split()
>>      for tag_name in tag_names:
>>        tag, dummy = Tag.objects.get_or_create(name=tag_name)
>>        bookmark.tag_set.add(tag)
>>      # Save bookmark to database.
>>      bookmark.save()
>>      return HttpResponseRedirect(
>>        '/user/%s/' % request.user.username
>>      )
>>  else:
>>     form = BookmarkSaveForm()
>>  variables = RequestContext(request, {
>>    'form': form
>>  })
>>  return render_to_response('bookmark_save.html', variables)
>>
>> --
>> 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: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread kanniga sivasubramanian
hello Venkatraman sir,
 I accept your suggestion. I will send only my questions
in body. Thankyou for your acknowledgement.

On Fri, Jun 4, 2010 at 5:36 PM, Venkatraman S  wrote:
> Please do not send the email in teh subject line :)
>
> --
> 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 dynamically set limit_choices_to for ManyToManyField using values from an instance?

2010-06-04 Thread Scott Gould
Create a ModelForm for your model (A), set the queryset to what you
want on the appropriate field (n), and then register that ModelForm
for admin use in your admins.py.

Regards
Scott


On Jun 4, 6:14 am, Massimiliano della Rovere
 wrote:
> When displayed in the Admin interfaces, I'd like to filter the values
> of n, so that instances of N already linked to other instances of A
> sharing the same instance of o are not shown:
> so when you edit an instance of A (let's call it "a"), you see only
> the instances of n in use by a and the unsed ones (in the context of
> o).
>
> The problem is that I am not allowd to write self.choices_for_n()
>
> Does anybody know any solution for this?
>
> class A(models.Model):
>         o = models.ForeignKey(O)
>         p = models.ManyToManyField(P)
>         n = models.ManyToManyField(N, limit_choices_to=self.choices_for_n())
>
>         def choices_for_n(self):
>                 unwanted = []
>                 for z in self.o.z_set.all():
>                         if z.id == self.id:
>                                 continue
>                         unwanted += [z.id for z in z.n]
>                 for n in N.objects.exclude(id__in=unwanted):
>                         yield n.id

-- 
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 ORM memory leaks in standalone script

2010-06-04 Thread yakovenko
Hello guys,

I use django ORM in standalone daemon. And It sucks more and more
memory.
I have created small script for testing:
---
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings'
sys.path.append('/md/lib')
from django.db import close_connection, reset_queries
from md.mddata.models import Info
def test():
 for i in Info.objects.all():
  pass

test()
reset_queries()
close_connection()
---
This script sucks about 400 Mb and doesn't return theirs.

Additional info: I use Debian 2.6.26-2-amd64. DEBUG is False in
settings.py.
What do I do wrong?
Could this be due to not properly configure the connection?
Setting of db is
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'md'
DATABASE_USER = 'md'
DATABASE_PASSWORD = 'md'
DATABASE_HOST = ''
DATABASE_PORT = ''

-- 
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 ORM memory leaks in standalone script

2010-06-04 Thread Dj Gilcrease
On Fri, Jun 4, 2010 at 6:44 AM, yakovenko  wrote:
> import os
> import sys
> os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings'
> sys.path.append('/md/lib')
> from django.db import close_connection, reset_queries
> from md.mddata.models import Info
> def test():
>  for i in Info.objects.all():
>  pass

do

for i in Info.objects.all().iterator(): #or just .iterator() forget which

and you wont leak

-- 
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 dynamically set limit_choices_to for ManyToManyField using values from an instance?

2010-06-04 Thread Massimiliano della Rovere
Thanks Scott,
I have one doubt though: I need a bound form to properly set the queryset.
Using your method I'd use an unbound form, am I wrong?

On Fri, Jun 4, 2010 at 14:33, Scott Gould  wrote:
> Create a ModelForm for your model (A), set the queryset to what you
> want on the appropriate field (n), and then register that ModelForm
> for admin use in your admins.py.
>
> Regards
> Scott
>
>
> On Jun 4, 6:14 am, Massimiliano della Rovere
>  wrote:
>> When displayed in the Admin interfaces, I'd like to filter the values
>> of n, so that instances of N already linked to other instances of A
>> sharing the same instance of o are not shown:
>> so when you edit an instance of A (let's call it "a"), you see only
>> the instances of n in use by a and the unsed ones (in the context of
>> o).
>>
>> The problem is that I am not allowd to write self.choices_for_n()
>>
>> Does anybody know any solution for this?
>>
>> class A(models.Model):
>>         o = models.ForeignKey(O)
>>         p = models.ManyToManyField(P)
>>         n = models.ManyToManyField(N, limit_choices_to=self.choices_for_n())
>>
>>         def choices_for_n(self):
>>                 unwanted = []
>>                 for z in self.o.z_set.all():
>>                         if z.id == self.id:
>>                                 continue
>>                         unwanted += [z.id for z in z.n]
>>                 for n in N.objects.exclude(id__in=unwanted):
>>                         yield n.id
>
> --
> 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: hello django users, I have one doubt. I am doing one django project. It shows one SyntaxError in the line(if not created:) in views.py file.I attached the particular in that. I want the reason o

2010-06-04 Thread Karen Tracey
On Fri, Jun 4, 2010 at 7:54 AM, kanniga sivasubramanian <
kskanniga...@gmail.com> wrote:

> If not created:
>

Don't uppercase the I in if.

Karen
-- 
http://tracey.org/kmt/

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



limit choices in the drop down of subcategory based on related category in Django admin

2010-06-04 Thread vikk
Hi,

I have three models as

class Category(models.Model):

name = models.CharField(max_length=128)


class SubCategory(models.Model):
category = models.ForeignKey(Category)
name = models.CharField(max_length = 400)

class Document(models.Model):
category = models.ForeignKey(Category, null=True, blank=True,
help_text=_('Required'))
subcategory = models.ForeignKey(SubCategory, null=True, blank=True,
help_text=_('Required'))
title = models.CharField(max_length=300)

Now in Admin interface I have category, subcategory and title field.
If a user is trying to select any subcategory then only that
subcategory item should be displayed which are related to Category.
A simple example is Country, state dropdown.
I am trying to get it from Modelform like

class DocumentAdminModelForm(ModelForm):

def __init__(self, *args, **kwargs):
super(DocumentAdminModelForm, self).__init__(*args,
**kwargs)
self.fields['sub_category'] =
forms.ModelChoiceField(queryset =
SubCategory.objects.filter(category__id = self.fields['category'] ))

but it is not working. Should I use some ajax and jquery for this or
is there any other way you can suggest ??

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: How to dynamically set limit_choices_to for ManyToManyField using values from an instance?

2010-06-04 Thread Scott Gould
Bound/unbound shouldn't affect things. See the docs on the subject of
ModelMultipleChoiceFields:

http://docs.djangoproject.com/en/1.2/ref/forms/fields/#modelmultiplechoicefield

and have your queryset parameter point to a callable that performs
whatever filtering logic you require.

On Jun 4, 8:50 am, Massimiliano della Rovere
 wrote:
> Thanks Scott,
> I have one doubt though: I need a bound form to properly set the queryset.
> Using your method I'd use an unbound form, am I wrong?
>
>
>
> On Fri, Jun 4, 2010 at 14:33, Scott Gould  wrote:
> > Create a ModelForm for your model (A), set the queryset to what you
> > want on the appropriate field (n), and then register that ModelForm
> > for admin use in your admins.py.
>
> > Regards
> > Scott
>
> > On Jun 4, 6:14 am, Massimiliano della Rovere
> >  wrote:
> >> When displayed in the Admin interfaces, I'd like to filter the values
> >> of n, so that instances of N already linked to other instances of A
> >> sharing the same instance of o are not shown:
> >> so when you edit an instance of A (let's call it "a"), you see only
> >> the instances of n in use by a and the unsed ones (in the context of
> >> o).
>
> >> The problem is that I am not allowd to write self.choices_for_n()
>
> >> Does anybody know any solution for this?
>
> >> class A(models.Model):
> >>         o = models.ForeignKey(O)
> >>         p = models.ManyToManyField(P)
> >>         n = models.ManyToManyField(N, 
> >> limit_choices_to=self.choices_for_n())
>
> >>         def choices_for_n(self):
> >>                 unwanted = []
> >>                 for z in self.o.z_set.all():
> >>                         if z.id == self.id:
> >>                                 continue
> >>                         unwanted += [z.id for z in z.n]
> >>                 for n in N.objects.exclude(id__in=unwanted):
> >>                         yield n.id
>
> > --
> > 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.



Multiple languages question about /jsi18n/

2010-06-04 Thread Stodge
I think I have basic internationalisation working for english and
french. I can switch languages and change the page's title
accordingly. However, if I visit:

/jsi18n/

I see the catalog definition and a few gettext related functions etc.
However, these are defaults and the translations in the catalog are
not mine and are always french, regardless of the language.

What are these translations in the catalog and why are they always
french? Any ideas? 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.



my own error handler

2010-06-04 Thread Henrik Genssen
hi,

I have written my own error handler mddleware sending my own formatted mail 
instead of
Djangos build in.
How do I now disable the default mail, as I now get 2 for every error.

looking into handle_uncaught_exception() of django.core.handlers.base I can not 
find any usefull
var, that disables it - so is it called anyway?

my version of error handling is basically copy of that function adding more 
info like hostname, raw_post_data
and so on...

regards

Henrik

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



XML database updates

2010-06-04 Thread Nick
I am working on a project that requires me to grab an XML feed and use
it to update entries in a DB that will also be updated by some people
doing data entry. I have the workflow for the data entry side all set
up but I'm having a hard time finding a resource that can help me
write some functions to grab the XML, pull out some information and
update the DB with those elements. I have been playing with
ElementTree and BeautifulSoup but there is just something I'm not
getting. If you know of a good resource or a really quick example that
can get me acquainted with the different services I'll be needing to
utilize I would be most appreciative.

-- 
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: XML database updates

2010-06-04 Thread Venkatraman S
On Fri, Jun 4, 2010 at 9:40 PM, Nick  wrote:

> I have been playing with
> ElementTree and BeautifulSoup but there is just something I'm not
> getting.
>

What is the problem that you are facing? if your XML is well defined, then
parse it, extract the data, convert that into objects and good to go ?
Right?
Or am i missing something?

-V-
http://twitter.com/venkasub

-- 
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: XML database updates

2010-06-04 Thread Nick
 That's exactly what I'm looking to do, but as I have never done it
before I am having trouble gaining the base of knowledge needed to
accomplish the task.
Your series of questions actually helps in that it offers a quick map
of the process for doing what it is I'd like to do.

Here is my first thought for how to do this:

feed = urllib.urlopen('http://example.xml/data.xml')
tree = ElementTree.parse(feed)

for obj in serializers.deserialize(feed, data):
obj.save()



On Jun 4, 11:14 am, Venkatraman S  wrote:
> On Fri, Jun 4, 2010 at 9:40 PM, Nick  wrote:
> > I have been playing with
> > ElementTree and BeautifulSoup but there is just something I'm not
> > getting.
>
> What is the problem that you are facing? if your XML is well defined, then
> parse it, extract the data, convert that into objects and good to go ?
> Right?
> Or am i missing something?
>
> -V-http://twitter.com/venkasub

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



Custom tag weird behaviour

2010-06-04 Thread __alex__
Hi all,

I've been trying to figure this out for hours and hours, but I simply
can't understand how to make it work.

Now, we have a very simple custom template tag. Let's say that we want
the template tag to take as a parameter a filtered variable. A very
simple implementation of my template tag is :

register = template.Library()

class Test(template.Node):
def __init__(self,val):
self.val = val
def render(self,context):
print("VALUE=%s" % self.val)
if self.val.__class__.__name__ == "FilterExpression":
self.val = self.val.resolve(context)
return self.val

@register.tag('test')
def test(parser,token):

print("Test is executed")

val = token.split_contents()1
val = parser.compile_filter(val)

return Test(val)

This just gets the value and resolves the filter. A simple template to
test this is :

{% for p in test_list %}
{% test p|first %} - {%test p|last%} --- {{p}}
{% endfor %}

The test_list is :
(("First1","Last1"),("First2","Last2"),("First3","Last3"))

So from the code I've written so far I would expect this silly
template tag to iterate through and print out the first and last
element of the tuples.

Though, this is the output of the template :

First1 - Last1 --- ('First1', 'Last1')
First1 - Last1 --- ('First2', 'Last2')
First1 - Last1 --- ('First3', 'Last3')

And this is what I get in my console:

Test is executed
Test is executed
VALUE=p|first
VALUE=p|last
VALUE=First1
VALUE=Last1
VALUE=First1
VALUE=Last1

OK, so what I understand so far is that the template player calls the
test template tag the first two times. Then, somehow it creates new
Test objects and feeds them with the result of the first execution.

I am certainly not a django expert, so could someone be kind enough to
explain me what on earth is this thing doing and how to get around it
please ? :)

-- 
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 ORM memory leaks in standalone script

2010-06-04 Thread Кирилл Яковенко
I have tried this method, but it didn't give any results.
I suspect that this is due to incorrect settings of the database or connect
to it.

2010/6/4 Dj Gilcrease 

> On Fri, Jun 4, 2010 at 6:44 AM, yakovenko  wrote:
> > import os
> > import sys
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings'
> > sys.path.append('/md/lib')
> > from django.db import close_connection, reset_queries
> > from md.mddata.models import Info
> > def test():
> >  for i in Info.objects.all():
> >  pass
>
> do
>
> for i in Info.objects.all().iterator(): #or just .iterator() forget which
>
> and you wont leak
>
> --
> 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: Custom tag weird behaviour

2010-06-04 Thread Bill Freeman
I don't know if you have other problems, but the following is invalid python:

   val = token.split_contents()1

You may have meant:

   val = token.split_contents()[1]

Which gets you the second element of the list returned by split_contents().
If you wanted the first element, change the 1 to a 0.

Bill


On Fri, Jun 4, 2010 at 12:42 PM, __alex__  wrote:
> Hi all,
>
> I've been trying to figure this out for hours and hours, but I simply
> can't understand how to make it work.
>
> Now, we have a very simple custom template tag. Let's say that we want
> the template tag to take as a parameter a filtered variable. A very
> simple implementation of my template tag is :
>
> register = template.Library()
>
> class Test(template.Node):
>        def __init__(self,val):
>                self.val = val
>        def render(self,context):
>                print("VALUE=%s" % self.val)
>                if self.val.__class__.__name__ == "FilterExpression":
>                        self.val = self.val.resolve(context)
>                return self.val
>
> @register.tag('test')
> def test(parser,token):
>
>        print("Test is executed")
>
>        val = token.split_contents()1
>        val = parser.compile_filter(val)
>
>        return Test(val)
>
> This just gets the value and resolves the filter. A simple template to
> test this is :
>
> {% for p in test_list %}
>        {% test p|first %} - {%test p|last%} --- {{p}}
> {% endfor %}
>
> The test_list is :
> (("First1","Last1"),("First2","Last2"),("First3","Last3"))
>
> So from the code I've written so far I would expect this silly
> template tag to iterate through and print out the first and last
> element of the tuples.
>
> Though, this is the output of the template :
>
> First1 - Last1 --- ('First1', 'Last1')
> First1 - Last1 --- ('First2', 'Last2')
> First1 - Last1 --- ('First3', 'Last3')
>
> And this is what I get in my console:
>
> Test is executed
> Test is executed
> VALUE=p|first
> VALUE=p|last
> VALUE=First1
> VALUE=Last1
> VALUE=First1
> VALUE=Last1
>
> OK, so what I understand so far is that the template player calls the
> test template tag the first two times. Then, somehow it creates new
> Test objects and feeds them with the result of the first execution.
>
> I am certainly not a django expert, so could someone be kind enough to
> explain me what on earth is this thing doing and how to get around it
> please ? :)
>
> --
> 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.



*Immediate* session expiration problem/bug in IE

2010-06-04 Thread Shawn Milochik
I've been having an infuriating problem. Less than 1% of our users, all on IE, 
had this symptom:

1. They log in.
2. They are redirected to the main screen (logged in successfully).
3. They click any link or refresh, and they're redirected to the login page 
because Django sees request.user as AnonymousUser.

This has been on-going for weeks, but it only effected about three people in 
total. It can be fixed by using Firefox.

Today I hit upon a major clue: 
I'm currently setting session expiration for 15 minutes. If I stop doing that, 
the problem goes away.

We want to continue to have sessions expire in a fairly brief period for 
security reasons, so this isn't an acceptable long-term solution. 

Do any of you have an idea as to where the problem is? I've spent a long time 
changing just about every setting in IE to do with cookies, security, temp 
files, etc., disabling all the add-ons, deleting temp files, changing and 
customizing security zones, adding our domain to the allowed list, setting IE 
to "always allow session cookies," etc.

Clue #2: This could be a red herring, but it seems that this only happens to 
people in the Pacific US time zone. We are in the Eastern time zone.

Tech details:

Django 1.1.1 running on Python 2.6.4 with fcgi w/nginx on Cent OS

I'm setting request.session.set_expiry(900) in a context processor. Commenting 
out that line "fixes" the problem.

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



Template issue, maybe?

2010-06-04 Thread Vectar
Hello all,

New to Django, I have been through all the tutorials and verified
things appeared to be working. I am running a windows server 2003
license, with Apache 2.1.2 I  think It is 2 something anyhow. I have
Python 2.6 installed and I have The latest version available to me of
the mod_wsgi interface. And when I run this all via pythin manage.py
runserver 8080 everything works great.

So with that done I need to be able to host it on Apache... so I set
up my Alias and my  stanza within my conf file.

Now, my actual problem, when I look at localhost:8080\admin I get
exactly what you would expect, my classes all laid out on the default
soft blue background. When I look http://wiki.mydomaincom/DBMon/admin/
(via Apache) I get all the links I expect, and they work as expected,
but they are all down the left side of the page with none of the
coloring is there.

It is like the template is not being read, so I added a local admin
template directory to my settings.py and copied over the admin/base-
site template to a local folder and changed the "Django
Administration" heading to "My Custom Line" and when I reloaded the
pages they both showed the cooresponding changes.

http://thedjangoforum.com/static/var/sphene/sphwiki/attachment/2010/06/03/django_img.gif

Any ideas on what piece is still missing?

-- 
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: Template issue, maybe?

2010-06-04 Thread Venkatraman S
Admin media is not being loaded.

-V-
http://twitter.com/venkasub


On Fri, Jun 4, 2010 at 11:59 PM, Vectar  wrote:

> Hello all,
>
> New to Django, I have been through all the tutorials and verified
> things appeared to be working. I am running a windows server 2003
> license, with Apache 2.1.2 I  think It is 2 something anyhow. I have
> Python 2.6 installed and I have The latest version available to me of
> the mod_wsgi interface. And when I run this all via pythin manage.py
> runserver 8080 everything works great.
>
> So with that done I need to be able to host it on Apache... so I set
> up my Alias and my  stanza within my conf file.
>
> Now, my actual problem, when I look at localhost:8080\admin I get
> exactly what you would expect, my classes all laid out on the default
> soft blue background. When I look http://wiki.mydomaincom/DBMon/admin/
> (via Apache) I get all the links I expect, and they work as expected,
> but they are all down the left side of the page with none of the
> coloring is there.
>
> It is like the template is not being read, so I added a local admin
> template directory to my settings.py and copied over the admin/base-
> site template to a local folder and changed the "Django
> Administration" heading to "My Custom Line" and when I reloaded the
> pages they both showed the cooresponding changes.
>
>
> http://thedjangoforum.com/static/var/sphene/sphwiki/attachment/2010/06/03/django_img.gif
>
> Any ideas on what piece is still missing?
>
> --
> 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: Template issue, maybe?

2010-06-04 Thread Bill Freeman
People are more likely to have ideas if you give us your Apache
configuration stanzas, particularly the WSGIScriptAlias and, if used
your WSGIDaemonProcess and WSGIProcessGroup directives,
any directory stanzas you have for serving the media, admin-media,
and any other static content trees.  All presumably within a
VirtualHost stanza.

Or if WSGIScriptAlias in particular, is news to you, you need to do
more reading about WSGI deployment.

On Fri, Jun 4, 2010 at 2:29 PM, Vectar  wrote:
> Hello all,
>
> New to Django, I have been through all the tutorials and verified
> things appeared to be working. I am running a windows server 2003
> license, with Apache 2.1.2 I  think It is 2 something anyhow. I have
> Python 2.6 installed and I have The latest version available to me of
> the mod_wsgi interface. And when I run this all via pythin manage.py
> runserver 8080 everything works great.
>
> So with that done I need to be able to host it on Apache... so I set
> up my Alias and my  stanza within my conf file.
>
> Now, my actual problem, when I look at localhost:8080\admin I get
> exactly what you would expect, my classes all laid out on the default
> soft blue background. When I look http://wiki.mydomaincom/DBMon/admin/
> (via Apache) I get all the links I expect, and they work as expected,
> but they are all down the left side of the page with none of the
> coloring is there.
>
> It is like the template is not being read, so I added a local admin
> template directory to my settings.py and copied over the admin/base-
> site template to a local folder and changed the "Django
> Administration" heading to "My Custom Line" and when I reloaded the
> pages they both showed the cooresponding changes.
>
> http://thedjangoforum.com/static/var/sphene/sphwiki/attachment/2010/06/03/django_img.gif
>
> Any ideas on what piece is still missing?
>
> --
> 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: Recommendations for a twitter oauth library?

2010-06-04 Thread steve
I wanted to second my thumbs up for oauth2. It's working for my site
as well.
 I'm using http://github.com/simplegeo/python-oauth2 specifically
(though the official Twitter library page mentions that the "brosner
fork" should be the one to use, which is forked from the one I'm
using, and I haven't read the details on the difference )
-Steve

On Apr 28, 1:22 am, Aliaksandr Abushkevich 
wrote:
> Hi Adam,
>
> OAuth2 works for me. You can use it in any of your python projects.
>
> Best regards,
> Alex
>
> On Wed, Apr 28, 2010 at 5:33 AM, adamjamesdrew  wrote:
> > Hi has anyone found a good twitteroauthlibrary for 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 
> > 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 
> 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.



Re: django ORM memory leaks in standalone script

2010-06-04 Thread tmitchell
Are you running with DEBUG on?  I've noticed the same memory growth in
standalone scripts when in DEBUG mode.

It may be related to this:
http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug

On Jun 4, 10:34 am, Кирилл Яковенко 
wrote:
> I have tried this method, but it didn't give any results.
> I suspect that this is due to incorrect settings of the database or connect
> to it.
>
> 2010/6/4 Dj Gilcrease 
>
>
>
> > On Fri, Jun 4, 2010 at 6:44 AM, yakovenko  wrote:
> > > import os
> > > import sys
> > > os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings'
> > > sys.path.append('/md/lib')
> > > from django.db import close_connection, reset_queries
> > > from md.mddata.models import Info
> > > def test():
> > >  for i in Info.objects.all():
> > >  pass
>
> > do
>
> > for i in Info.objects.all().iterator(): #or just .iterator() forget which
>
> > and you wont leak
>
> > --
> > 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 > groups.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: django ORM memory leaks in standalone script

2010-06-04 Thread tmitchell
Holy reading comprehension, Batman.  Just saw you have DEBUG off,
ignore previous comment.

On Jun 4, 10:34 am, Кирилл Яковенко 
wrote:
> I have tried this method, but it didn't give any results.
> I suspect that this is due to incorrect settings of the database or connect
> to it.
>
> 2010/6/4 Dj Gilcrease 
>
>
>
> > On Fri, Jun 4, 2010 at 6:44 AM, yakovenko  wrote:
> > > import os
> > > import sys
> > > os.environ['DJANGO_SETTINGS_MODULE'] = 'md.settings'
> > > sys.path.append('/md/lib')
> > > from django.db import close_connection, reset_queries
> > > from md.mddata.models import Info
> > > def test():
> > >  for i in Info.objects.all():
> > >  pass
>
> > do
>
> > for i in Info.objects.all().iterator(): #or just .iterator() forget which
>
> > and you wont leak
>
> > --
> > 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 > groups.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: Django sessions issue

2010-06-04 Thread aa56280
> How are you logging out? Are you sure you are calling
> django.contrib.auth.logout() ?

Yup, I'm calling django.contrib.auth.views.logout()

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



Multi-table inheritance create child

2010-06-04 Thread Francis Gulotta
Has anyone used the patch from this ticket #7623?
http://code.djangoproject.com/ticket/7623

Does it work well? Is there a better way?

I've got the same problem the submitter has except I was hoping to extend
the auth.User class so I'd still have all of the user methods available in
the new user type.

from django.contrib.auth.models import User

class Customer(User):

#user's customer profile

phone = models.CharField(max_length=255)

referrer = models.TextField()


> def __unicode__(self):

return "%s's customer profile" % self.get_full_name()


I was hoping to make a few dfferen't profile types and have all the user
fields available in the admin without having to recreate every single one in
an admin class.

-Francis

---
Francis Gulotta
wiz...@roborooter.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: admin modifications

2010-06-04 Thread rahul jain
Hi Daniel,

Yes I know about admin actions but I would like to provide a select
option/modify button on every rows inside my admin display. Not just
at one place.

--RJ

On Wed, Jun 2, 2010 at 1:05 AM, Daniel Roseman  wrote:
> On Jun 2, 7:56 am, rahul jain  wrote:
>> Hi Django,
>>
>> I am not sure how this could be done, so on the admin display, on one
>> of the columns I would like to provide select tab. If i select one of
>> the options,
>> it should update some other column on the display.
>>
>> Firstly, whats the clean way for adding select boxes on the admin
>> display, it could be one of the columns
>>
>> Secondly, if i select one of those options, could I do it without
>> hitting any server, the ajax way.
>>
>> --RJ
>
> Admin actions are what you need:
> http://docs.djangoproject.com/en/1.2/ref/contrib/admin/actions/
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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.



Ensuring a single file in storage, per FileField

2010-06-04 Thread Scott Gould
Hi folks,

I have various models with File and Image fields. I want to keep the
filesystem storage clean, removing any orphaned file upon a new one
being uploaded. To date I've been overriding save() in each model,
which isn't terribly robust:

class MyModel
def save(self, **kwargs):
# remove old file if new one is uploaded
old_obj = MyModel.objects.get(pk=self.pk) if self.pk else None
if old_obj and self.image != old_obj.image:
old_obj.image.storage.delete(old_obj.image.name)

super(MyModel, self).save(**kwargs)

For obvious reasons I'd like to refactor this into a custom FileField/
ImageField. The logic that I would like is even simpler and more
reliable than the above:

1. If a new file was provided, delete the old one.
2. Save.

The trouble is I can't figure out how, at the Model or Field level, to
figure out if a new physical file was *really actually provided*, in
order to decide whether I should delete the underlying old one.

Thanks for any help on this one.

Regards
Scott

-- 
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 sessions issue

2010-06-04 Thread Tom Evans
On Fri, Jun 4, 2010 at 8:45 PM, aa56280  wrote:
>> How are you logging out? Are you sure you are calling
>> django.contrib.auth.logout() ?
>
> Yup, I'm calling django.contrib.auth.views.logout()
>

You better show some code now...

Cheers

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: Something like admin.StackedInline where 'extra'

2010-06-04 Thread zehi
Thanks Frank.

On Jun 3, 6:33 pm, Frank Wiles  wrote:
> On Thu, Jun 3, 2010 at 9:56 AM, jeremy07  wrote:
> > Hi, I have a simple booking app where first form gets number of
> > travelers. Based on that number I need to generate another form with
> > number of rows equal to entered number of travelers to get their
> > names.  Something like admin.StackedInline where 'extra' would be a
> > number of travelers. Any idea?
>
> Look into inline formsets:
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-...
>
> This is what you're wanting.
>
> --
> Frank Wiles
> Revolution Systems |http://www.revsys.com/
> fr...@revsys.com   | (800) 647-6298

-- 
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 tag weird behaviour

2010-06-04 Thread __alex__
Yeah, this was from the copy paste. It is split_contents()[1],
otherwise the code wouldn't run at all ;)

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



help with serving up mp4 with "nice" url

2010-06-04 Thread Margie Roginski
Hi,

I am trying to serve up an mp4 video from my django app.  I've
generated the video
using a tool called Camtasia, and it creates a set of files for me
that all go in a single
directory.  I've put these down in my site_media directory with a
directory structure like this:

  site_media/img/help/overview_video/overview_video.html
 overview_video.mp4
 overview_video_controller.swf
 swfobject.js
 exprsesInstall.swf

If I reference overview_video.html like this, it works just fine:

  http://mysite.com/site_media/img/help/overview_video/overview_video.html

But I don't want the user to see site_media in their url.  Instead I'd
like them to go
to a nicer looking url, like this:

http://mysite.com/taskmanager/help/overview_video

So I'm trying to figure out what I put in my taskmanager app urls.py
in order to make it
handle the nicer url and then redirect to site_media/img/help/
overview_video/overview_video.html.

I think I should be able to do something like this:


   url(r'^help/overview_video$',direct_to_template,
 {"template": "[reference_to_site_media]/img/help/
overview_video/overview_video.html"})

But I can't figure out what to put in for [reference_to_site_media].
Could someone give me a hand?

Thanks.

Margie




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



aggregation question

2010-06-04 Thread P. Kaminski
Hello,
I'm studying the Django page on aggregation
http://docs.djangoproject.com/en/dev/topics/db/aggregation/
In the section 'Joins and aggregates' there's an example of how to
create an annotation for each Store with book price ranges. But what
if I want to do the opposite, i.e. for each available Book, look up
through the stores and create a price range from this. This backward-
looking procedure is what's I'm most interested in.
Best regards,
Przemek

-- 
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 use Django with Apache and mod_wsgi

2010-06-04 Thread Jagdeep Singh Malhi
please Discuss in detail ...
I am not able to understand ,how i can use Django  with mod_wsgi
I am using ubuntu 10.04 (LTS)
please help.

-- 
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 Django with Apache and mod_wsgi

2010-06-04 Thread Kenneth Gonsalves
On Saturday 05 June 2010 10:49:59 Jagdeep Singh Malhi wrote:
> please Discuss in detail ...
> I am not able to understand ,how i can use Django  with mod_wsgi
> 

no big deal - just follow the docs
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
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: *Immediate* session expiration problem/bug in IE

2010-06-04 Thread Dmitry Dulepov
Hi!

Shawn Milochik wrote:
> Do any of you have an idea as to where the problem is? I've spent a long
> time changing just about every setting in IE to do with cookies,
> security, temp files, etc., disabling all the add-ons, deleting temp
> files, changing and customizing security zones, adding our domain to the
> allowed list, setting IE to "always allow session cookies," etc.

I am on Mac myself and I do not have much experience with MSIE users.
However I know that such problems exist for MSIE7/8 users. It is related to
"cookie policy". You need to add something to cookies to make MSIE happy. I
do not remember exactly what it is. There is a Microsoft Knowledge Base
article about it. Google for it, may be it helps.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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: How to use Django with Apache and mod_wsgi

2010-06-04 Thread Dmitry Dulepov
Hi!

Jagdeep Singh Malhi wrote:
> please Discuss in detail ...
> I am not able to understand ,how i can use Django  with mod_wsgi
> I am using ubuntu 10.04 (LTS)
> please help.

This article is titled "How to use Django with Apache and mod_wsgi":
http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.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.