Re: default django admin theme

2010-12-24 Thread patrickk
these discussions might be helpful:

refining django admin look proposal
http://groups.google.com/group/django-developers/browse_thread/thread/ca4f26d616921753/

django design czar
http://groups.google.com/group/django-developers/browse_thread/thread/18bca037f10769e9/

btw: don´t mix up grappelli and admin-tools. these are different apps
with very different goals.

regards,
patrick

On 24 Dez., 03:42, "Jos? Moreira"  wrote:
> Hi,
>
> django-admins-tools? Gonna take a look. Notice that i didn't meant
> to criticise grapelly or any other tool, i ment to discuss the
> out-of-the-box user interface, which i didn't meant it wasn't good in
> itself.
>
> Yeah i know, it's open source and i can put my code where my mouth it's just
> that i'm also more of a server-side developer myself :) i would even be open
> to support it financially but unfortunately it's not an option i have at the
> moment, but i would gladly help in anyway i can and will start by passing
> around the info.

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



delivering streaming videos

2010-12-24 Thread 93-interactive
Hi,

i have currently started a new django project where i have to deliver
html5 videos to a webbrowser but the videos are not allowed to remain
in the web folder.

so here is what i have:

def download(req, video_id, video_type):
ctype='';
if (video_type=='ogv'):
ctype='video/ogg'
elif (video_type=='mp4'):
ctype='video/mp4'

if (ctype==''):
raise Http404

fname='%s%s.%s' % (settings.VIDEO_ROOT, 'test', video_type)
try:

f=open(fname,'rb')
viddata=f.read()
f.close()
fsize=os.path.getsize(fname)
except:
raise Http404

resp=HttpResponse(viddata, ctype)
resp['Content-Disposition'] = 'attachment; filename=%s.%s' %
('video'+video_id, video_type)
resp['Content-Length'] = fsize
return resp

this does work in the way that you can download the video by directly
accessing the url, and it is shown by the browsers, when the url is
set in the 's src parameter... but... a) the browsers seem not
to know about the video length and you can not jump through the video
via the time bar. When i just put the video into the media folder an
access it from there, all browsers show immediately the length of the
video and they allow you to jump around in the video even if it is not
completely loaded... how can i achieve the same result from 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.



Group models by personal order and no by app in admin

2010-12-24 Thread Álex González
Hi!

I have a lot of models in same app at my django app, can I group then
another way that app order?

I see:

Auth
   Users

Sites
   Sites

My app
  Model 1
  Model 2
  Model 3
  ...
  Model N

And like for example, Model 1&2 under "My app (Users)" tab. and 3 to N in
"My app (configuration)"

Thanks!

-- 
@agonzalezro 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
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 comments posted template and ajax calls

2010-12-24 Thread Michel Thadeu Sabchuk
Hi guys,

First of all, merry christmas for all of you ;)

I using an ajax approach to show the comments form. I need to mix this
approach with a common approach, this is not a problem for the preview
page because I can create app specific templates (i.e. "comments/app/
preview.html" instead of "comments/preview.html").

The problem occurs with the posted.html template. It is not app
dependent and this way I can't have a "comments/app/posted.html".

I need to show some code for specific type objects and other code for
general ones. Is it good to comment's posted.html template be app
dependent? I can fix it and send a patch to the dev team. Do you have
another suggestion?

Thanks in advance.

Best regards.

--
Michel Sabchuk

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



manytomany and form

2010-12-24 Thread refreegrata
hello list. I have a model like this


class Dcto(models.Model):
..
fk_dcto = models.ManyToManyField('self', blank=True, null=True)

this create a this internal table with this fields

id
from_dcto_id
to_dcto_id


My problem appear when I save the formmodel. I want something like
this saved.

id  | from_dcto_id | to_dcto_id
x   |old_dcto 1 |  new_dcto
x   |old_dcto 2 |  new_dcto


but I get this


id  |  from_dcto_id  | to_dcto_id
x   | old_dcto 1  |  new_dcto
x   | old_dcto 2  |  new_dcto
x   | new_dcto   |  old_dcto 1
x   | new_dcto   |  old_dcto 2


Somebody know how can i solve this problem?
Another question. I prefer a CheckboxSelectMultiple(), no a
selectMultiple(), I can define this in the widget meta,

widgets = {
   'fk_dcto':forms.widgets.CheckboxSelectMultiple(),

but the user selection isn't saved.

Thanks for read, and sorry for my poor english.

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



ANN: The Django-CMS 2.1 Release Candidate 1 has been released!

2010-12-24 Thread Jonas Obrist

The first Release Candidate for the Django-CMS 2.1 was just released and is
ready for testing. Please keep in mind that this is a release candidate, 
and not

a final release yet!

Download: http://pypi.python.org/pypi/django-cms/2.1.0.rc1
Documentation: http://django-cms.rtfd.org
Source: https://github.com/divio/django-cms/tree/2.1.0.rc1

Please report any issues you find with this release to our issue tracker at
https://github.com/divio/django-cms/issues, thank you.
The Release Candidate 1 has all the new features fo the Django-CMS 2.1 and
countless bugfixes since Beta 3.

This Release Candidate would not have been possible without the 
contribution by
the community, a total of 68 different people have committed to the 
Django-CMS

since it's last stable release, 2.0.2.
Special thanks however go to Eric Robitaille, whos contribution to the 
Publisher
were absolutely priceless, and Řyvind Saltvik, who fixed bug after bug 
during
the last two weeks and thus allowed us to make this release. Both of 
them are

now also core committers.


So what's new in 2.1?


* Frontend Editing!
  You can edit your contents directly on the site, as an alternative to 
the more

  abstract admin panel.

* Better integration of 3rd party applications!
  It is now easier then ever to integrate any 3rd party Django 
applications into

  your CMS or make your Django application CMS-Ready.

* "Placeholders"
  It is now possible to use the Django-CMS Plugin based content 
architecture in
  any Django model using the new Placeholder Fields! This even comes 
with full

  blown frontend editing.

* Menu Refactor
  The menu code has been strongly refactored since 2.0 and it is now 
easier to

  extend and alter the menus.

* Better Docs, Better Tests, Better Code
  Our documentation is now hosted on the amazaing readthedocs.org and was
  improved vastly and is still being improved until 2.1 final. On top 
of that
  our testing infrastructure, our test suite and our test coverage has 
improved
  significantly as well. And in the process of fixing a lot of bugs, we 
have
  also improved the readability and maintainability of the Django-CMS 
codebase

  to make it easier for new developers to get around.

* And lots more!


Wishing you a merry Christmas in the name of the Django-CMS core 
developers team,


Jonas Obrist

--
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: manytomany and form

2010-12-24 Thread refreegrata
to the first question, symmetrical=False, with this generate an
inverted information.
I want this.

id  | from_dcto_id | to_dcto_id
x   |old_dcto 1 |  new_dcto
x   |old_dcto 2 |  new_dcto

but I get this

id  | from_dcto_id | to_dcto_id
x   |new_dcto 1 |  old_dcto 1
x   |new_dcto 2 |  old_dcto 2


I need that every new dcto select his parents, to delimite the actions
over himself, not a parent defining his childs.

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



Parse content

2010-12-24 Thread Jonas Geiregat
Hello,

I have some content that is stored as models.TextField().
Content is mainly text but there should be option to add additional parsing.
Such as a code block [code] which should be formatting in some way.

But where would you best place this code ? 
Inside the model view or are there options for implementing such behavior using 
the built-in template language ?

Regards,


Jonas Geiregat
jo...@geiregat.org




-- 
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: manytomany and form

2010-12-24 Thread refreegrata
finally I do this

--
class form(forms.ModelForm):
fk_dcto = forms.ModelMultipleChoiceField(queryset= ,
required=False, widget=forms.CheckboxSelectMultiple)
--
with this I can save with checkboxselectmultiple.

To define a correctly order to the many to manyfields in the form
declaration I do this.

def clean_fk_dcto(self):
self.fk_dcto_copy = self.cleaned_data.get('fk_dcto')
return []

def save(self, *args, **kwargs):
newRow = super(Myform, self).save(*args, **kwargs)

for item in self.fk_dcto_copy:
item.fk_dcto.add(newRow)
item.save()
return oti



-- 
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: ManyToManyField('self') doesn't works as expect

2010-12-24 Thread pjrhar...@gmail.com
By default many to many fields on self are symmetric[1], yours can't
be (if A is up from B, B isn't up from A), so you need to specify
symmetrical=False. You'll also need to specify some related names
because they will clash.

You might want to rethink your model though anyway, I'm not convinced
that's going to be the easiest system to deal with.

1. 
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.symmetrical

On Dec 14, 8:09 am, Shuge Lee  wrote:
> I created a model to save map,
> a map is contains many room(RoomConfig).
>
> # model
> class RoomConfig(models.Model):
>     room_name = models.CharField(max_length = 64)
>     room_to_room = models.ManyToManyField('self', through =
> 'RoomToRoomConfig')
>
> class RoomToRoom(models.Model):
>     DIRECTION_CHOICES = ((0, "up"), (1, "right"), (2, "down"), (3,
> "left"))
>     from_room = models.ForeignKey('RoomConfig')
>     to_room = models.ForeignKey('RoomConfig')
>     from_direction = models.IntegerField(choices = DIRECTION_CHOICES)
>     to_direction = models.IntegerField(choices = DIRECTION_CHOICES)
>
> why it raise Error: One or more models did not validate:
>
> configs.roomconfig: Many-to-many fields with intermediate tables
> cannot be symmetrical.
> configs.roomtoroomconfig: Accessor for field 'from_room' clashes with
> related field 'RoomConfig.roomtoroomconfig_set'. Add a related_name
> argument to the definition for 'from_room'.
> configs.roomtoroomconfig: Accessor for field 'to_room' clashes with
> related field 'RoomConfig.roomtoroomconfig_set'. Add a related_name
> argument to the definition for 'to_room'.

-- 
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 management commands from the admin interface

2010-12-24 Thread Ed
I am having difficulty getting my custom command to run on schedule. I'm 
using django-chronograph, but I can't seem to get it to run like it can 
(successfully) from the command line.  Before I go into the background of 
this problem, I will state my question: H*ow might I run a custom management 
command from the django admin graphical interface to prove that it can 
indeed be done?  Or rather, how can I make sure that custom management 
commands available from said interface?*

I'm just developing an app locally using django installed on Ubunutu.

I have a custom command that I use to clear out log entries that are greater 
than 30 days old. In order to test it repeatedly, I altered it so that it 
only deletes one somewhat arbitrary entry:

from datetime import datetime, timedelta
from hitcount.models import Hit
from django.core.management.base import BaseCommand, CommandError

class Command(BaseCommand):
args = ''
help = 'Clear out all Hits that occured over "days" days ago'

def handle(self, *args, **options):
list = Hit.objects.filter(created__lt = 
datetime.now()-timedelta(days=2) )
list[0].delete()

self.stdout.write('Hit deleted - %s' % list[0])

This command (del_hit.py) is located in the following structure:

/project_dir
   /app
  /management
 __init__.py
 /commands
__init__.py
del_hit.py

As I stated, I can successfully run this command from my project_dir

python manage.py del_hit
I tried installing django-chronograph. It seems very useful. It recognized 
my command and allowed me to select it from a drop down list. However, when 
it tries to execute the command, it gives me the following error in the log:

The job failed to run. The exception was :

Unknown command: u'del_hit'

Traceback (most recent call last):

File "/home/vadmin/development/python/my_proj/chronograph/models.py", line 
213, in handle_run
call_command(self.command, *args, **options)

File "/usr/lib/python2.6/dist-packages/django/core/management/__init__.py", 
line 155, in call_command
raise CommandError("Unknown command: %r" % name)

CommandError: Unknown command: u'del_hit'

I traced this back to the __init__.py file of the django/core/management 
utility.  There seems to be some strange behavior going on.  When the server 
first comes up, a dictionary variable _commands is populated with the core 
commands (from django/core/management/commands).  Custom management commands 
from all of the installed apps are also pushed into the _commands variable 
for an overall dictionary of all management commands.  

Somehow, though between when the server starts and when django chronograph 
goes to run the job from the admin interface, the _commands variable loses 
the custom commands; the only commands in the dictionary are the core 
commands.  I'm not sure why this is.  Could it be a path issue?  Am I 
missing some setting?  Is it a django-chronograph specific problem?  *So how 
might I run a custom management command from the django admin graphical 
interface to prove that it can indeed be done?  Or rather, how can I make 
sure that custom management commands available from said interface?*

-- 
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: Group models by personal order and no by app in admin

2010-12-24 Thread Mikhail Korobov
Hi Alex,

django-admin-tools should solve all your problems with admin index
page.

https://bitbucket.org/izi/django-admin-tools/

On 24 дек, 17:48, Álex González  wrote:
> Hi!
>
> I have a lot of models in same app at my django app, can I group then
> another way that app order?
>
> I see:
>
> Auth
>    Users
>
> Sites
>    Sites
>
> My app
>   Model 1
>   Model 2
>   Model 3
>   ...
>   Model N
>
> And like for example, Model 1&2 under "My app (Users)" tab. and 3 to N in
> "My app (configuration)"
>
> Thanks!
>
> --
> @agonzalezro 
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx

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



Massive insertion of records

2010-12-24 Thread Silva Paulo
I need to do a massive insertion of records in two tables "connectd" by 
"foreignkey". Is there a way, using the Django db API, to do it. 
e=Foo(...);e.save() seems too slow.

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.



case insensitive "in" query

2010-12-24 Thread Tim Saylor
I have two lists of values and I need to filter a queryset to only
rows in which a column's value is in one of these lists.  The data is
not case consistent, so if I were comparing the column to a single
value I would use the "iexact" lookup type.  Since I'm comparing to a
list of values I'm using the "in" lookup type, but there's no way to
make that case insensitive that I know of.  The way I'm doing this is
by looping through the list I want to exclude and doing an "iexact"
lookup on each of those values.  It feels like a really crappy way to
do it, but I don't know of anything better.  Is there an alternative?

-- 
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: Massive insertion of records

2010-12-24 Thread Christophe Pettus

On Dec 24, 2010, at 9:26 AM, Silva Paulo wrote:

> I need to do a massive insertion of records in two tables "connectd" by 
> "foreignkey". Is there a way, using the Django db API, to do it. 
> e=Foo(...);e.save() seems too slow.

It's always going to be very slow to do inserts via the Django ORM compared to 
going straight to the database.  Which DB are you using, and what format is the 
data in before it gets inserted?

--
-- Christophe Pettus
   x...@thebuild.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: case insensitive "in" query

2010-12-24 Thread Christophe Pettus

On Dec 24, 2010, at 11:12 AM, Tim Saylor wrote:

> Is there an alternative?

This is probably a good case for doing a raw query.  You can then do something 
along the lines of "WHERE lower(field) IN ('', '''...)".  Depending on the 
data, creating a functional index on "lower(field)" might help performance.

--
-- Christophe Pettus
   x...@thebuild.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: delivering streaming videos

2010-12-24 Thread 93-interactive
ok, i am a step closer, i now implemented range requests:

def sendFileRange(req, contenttype, fname, delivername):
try:
fsize=os.path.getsize(fname)
except:
raise Http404

pos1=0
pos2=fsize-1
if req.META.has_key('HTTP_RANGE'):
arr=req.META['HTTP_RANGE'].split('=')
if (len(arr)>1) and (arr[0]=='bytes'):
r=arr[1]
values=r.split('-')
if len(values)>1:
if (r[0]=='-'):
p1=0
p2=int(values[1])
elif (r[-1]=='-'):
p1=int(values[0])
p2=fsize-1
else:
p1=int(values[0])
p2=int(values[1])
if (p2>p1):
pos1=p1
pos2=p2

numbytes=(pos2-pos1)+1

try:
f=open(fname,'rb')
f.seek(pos1)
data=f.read(numbytes)
f.close()
except:
raise Http404

resp=HttpResponse(data, contenttype, 206)
resp['Accept-Ranges']='bytes'
if req.META.has_key('HTTP_RANGE'):
resp['Content-Range']='bytes %d-%d/%d' % (pos1, pos2,
fsize)
resp['Content-Length'] = numbytes
resp['Content-Disposition'] = 'attachment; filename=%s' %
(delivername)
return resp

def download(req, video_id, video_type):
ctype='';
if (video_type=='ogv'):
ctype='video/ogg'
elif (video_type=='mp4'):
ctype='video/mp4'

if (ctype==''):
raise Http404

fname='%s%s.%s' % (settings.VIDEO_ROOT, 'test', video_type)
return sendFileRange(req, ctype, fname, 'video%d.%s' %
(int(video_id), video_type))

this works now for firefox and i assume all other theora playing
browsers, but chrome and IE, that play the mp4 file fail, actually the
django server fails:

with IE9 i get:

[24/Dec/2010 21:32:09] code 400, message Bad request version ('RTSP/
1.0')
[24/Dec/2010 21:32:09] "DESCRIBE rtsp://mysite:8000/myapp/download/1.mp4
RTSP/1.0" 400 -
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Django-1.2.3-py2.4.egg/django/
core/servers/basehttp.py", line 281, in run
self.finish_response()
  File "/usr/lib/python2.4/site-packages/Django-1.2.3-py2.4.egg/django/
core/servers/basehttp.py", line 321, in finish_response
self.write(data)
  File "/usr/lib/python2.4/site-packages/Django-1.2.3-py2.4.egg/django/
core/servers/basehttp.py", line 417, in write
self._write(data)
  File "/usr/lib64/python2.4/socket.py", line 256, in write
self.flush()
  File "/usr/lib64/python2.4/socket.py", line 243, in flush
self._sock.sendall(buffer)
error: (32, 'Broken pipe')

with chrome the same, but without the RTSP lines

any ideas?

-- 
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: delivering streaming videos

2010-12-24 Thread Cal Leeming [Simplicity Media Ltd]
This really is *not* a good way of doing things.

Unless you have a specific need to be streaming out via Python (for example,
on the fly stream modification, in which case I'd argue those bits of code
should be written as C extensions for performance), then I would advice
using nginx with the appropriate mods for anything like this.

On Fri, Dec 24, 2010 at 8:28 PM, 93-interactive <
93interact...@googlemail.com> wrote:

> ok, i am a step closer, i now implemented range requests:
>
> def sendFileRange(req, contenttype, fname, delivername):
>try:
> fsize=os.path.getsize(fname)
>except:
>raise Http404
>
> pos1=0
>pos2=fsize-1
>if req.META.has_key('HTTP_RANGE'):
>arr=req.META['HTTP_RANGE'].split('=')
>if (len(arr)>1) and (arr[0]=='bytes'):
>r=arr[1]
>values=r.split('-')
>if len(values)>1:
>if (r[0]=='-'):
>p1=0
>p2=int(values[1])
>elif (r[-1]=='-'):
>p1=int(values[0])
>p2=fsize-1
>else:
>p1=int(values[0])
>p2=int(values[1])
>if (p2>p1):
>pos1=p1
>pos2=p2
>
>numbytes=(pos2-pos1)+1
>
>try:
>f=open(fname,'rb')
> f.seek(pos1)
>data=f.read(numbytes)
>f.close()
>except:
>raise Http404
>
>resp=HttpResponse(data, contenttype, 206)
>resp['Accept-Ranges']='bytes'
>if req.META.has_key('HTTP_RANGE'):
>resp['Content-Range']='bytes %d-%d/%d' % (pos1, pos2,
> fsize)
>resp['Content-Length'] = numbytes
>resp['Content-Disposition'] = 'attachment; filename=%s' %
> (delivername)
>return resp
>
> def download(req, video_id, video_type):
>ctype='';
>if (video_type=='ogv'):
>ctype='video/ogg'
>elif (video_type=='mp4'):
>ctype='video/mp4'
>
>if (ctype==''):
>raise Http404
>
>fname='%s%s.%s' % (settings.VIDEO_ROOT, 'test', video_type)
> return sendFileRange(req, ctype, fname, 'video%d.%s' %
> (int(video_id), video_type))
>
> this works now for firefox and i assume all other theora playing
> browsers, but chrome and IE, that play the mp4 file fail, actually the
> django server fails:
>
> with IE9 i get:
>
> [24/Dec/2010 21:32:09] code 400, message Bad request version ('RTSP/
> 1.0')
> [24/Dec/2010 21:32:09] "DESCRIBE rtsp://mysite:8000/myapp/download/1.mp4
> RTSP/1.0" 400 -
> Traceback (most recent call last):
>  File "/usr/lib/python2.4/site-packages/Django-1.2.3-py2.4.egg/django/
> core/servers/basehttp.py", line 281, in run
>self.finish_response()
>  File "/usr/lib/python2.4/site-packages/Django-1.2.3-py2.4.egg/django/
> core/servers/basehttp.py", line 321, in finish_response
>self.write(data)
>  File "/usr/lib/python2.4/site-packages/Django-1.2.3-py2.4.egg/django/
> core/servers/basehttp.py", line 417, in write
>self._write(data)
>  File "/usr/lib64/python2.4/socket.py", line 256, in write
>self.flush()
>  File "/usr/lib64/python2.4/socket.py", line 243, in flush
>self._sock.sendall(buffer)
> error: (32, 'Broken pipe')
>
> with chrome the same, but without the RTSP lines
>
> any ideas?
>
> --
> 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: Massive insertion of records

2010-12-24 Thread Silva Paulo
I am using sqlite3. Tha data is in memory most of it after being read from a 
zlib.compress of a cPickle.dumps of a class object on a file.

I was thinking of something like a method to store, for example, a list of 
records in the db at once.

>From your answer I may conclude that I should use a "non django" solution to 
>load the database, isn't it?


--- On Fri, 12/24/10, Christophe Pettus  wrote:

> From: Christophe Pettus 
> Subject: Re: Massive insertion of records
> To: django-users@googlegroups.com
> Date: Friday, December 24, 2010, 8:46 PM
> 
> On Dec 24, 2010, at 9:26 AM, Silva Paulo wrote:
> 
> > I need to do a massive insertion of records in two
> tables "connectd" by "foreignkey". Is there a way, using the
> Django db API, to do it. e=Foo(...);e.save() seems too
> slow.
> 
> It's always going to be very slow to do inserts via the
> Django ORM compared to going straight to the database. 
> Which DB are you using, and what format is the data in
> before it gets inserted?
> 
> --
> -- Christophe Pettus
>    ...@thebuild.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.
> 
> 


  

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