Get times of day with most entries

2008-09-15 Thread Henrik Lied

Hi there!

I'm working on a very interesting pet project where I monitor the
traffic outside a house.

The system works like this:
I have a AXIS 214 PTZ IP Camera, which has motion sensoring. Whenever
a car drives past its viewing area, the camera server sends a TCP
message to a Django server. The django server records the "drive by"
in a Vehicle model:
class Vehicle(models.Model):
when = models.DateTimeField()

This adds up to quite a lot of traffic in a day, and I want to be able
to filter out which time of day the traffic is at it's highest.

Is there a good way of doing this?

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



Sending user submitted data through HTTP POST to another resource

2007-09-23 Thread Henrik Lied

Hi there!

I'm working on a project where users can upload videos to a service.
The project is written in Django, but the videos and transcoding of
these is handled by a remote server in our media corporation.

The API for uploading to this server only accepts HTTP POST, and this
is where I'm a bit stuck.

Let me elaborate:
The videotranscoder (remote server) takes the following arguments:
keyword: A unique identifier for our service (there are a ton of other
services using this server)
title: The title of the movie
tags
description
user_id = [optional]

The keyword and user_id-arguments shouldn't be displayed in public for
the user (security reasons), so I have to create a wrapper around the
request/response (the remote server returns a 200 OK and a short XML
doc if everything goes well) for the uploading of the video.

So here's the basic layout I want:
- User fills out a form with the following elements:
- title
- tags
- description
- file_to_upload
- User submits the form (through POST with multipart)
- Django processes the data and checks for errors
- no errors - send the request to the remote server through POST
- errors found - send the form back to the user with the errors

I get everything right up to the last point: How do I get Django to
send the user posted data [through POST] to another webservice?

I've tried with the urllib, but it simply resulted in a broken pipe.
And how do I manage to do this without spending all my memory on one
operation?


Thanks!
- 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Accessing the content-attribute in request.FILES without loading it into memory

2007-08-14 Thread Henrik Lied

I've got #2070 on my django installation, but that won't help when I
access the
'content' attribute.
I see that snippet #370 [1] uses the FileWrapper from Django to split
the file into
chunks. Could that be used on the FILES-object too?


[1] http://www.djangosnippets.org/snippets/365/

On Aug 14, 7:03 am, simonbun <[EMAIL PROTECTED]> wrote:
> Hi,
>
> You'll want to take a look at ticket #2070 [1] for streaming uploads.
> It has a working patch that will make it to trunk pretty soon I think.
> I'm not sure how you would handle streaming uploads directly to a S3
> bucket, but it shouldn't be too hard to hack the patch from the
> ticket.
>
> [1]http://code.djangoproject.com/ticket/2070
>
> regards,
> Simon
>
> On Aug 14, 3:10 am, Henrik Lied <[EMAIL PROTECTED]> wrote:
>
> > Hi there!
>
> > I'm using Amazon S3 for file storage, and I have to send the file
> > directly from request.FILES.
> > (I could always save the file locally first, send it to Amazon and
> > then delete it from my local server, but this would double the wait
> > for the user.)
>
> > Is there a way to only load chunks of the uploaded file into memory,
> > instead of loading the whole thing at once? And here comes an even
> > better question: Would it be useful?
>
> > Thanks in advance!


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



Accessing the content-attribute in request.FILES without loading it into memory

2007-08-13 Thread Henrik Lied

Hi there!

I'm using Amazon S3 for file storage, and I have to send the file
directly from request.FILES.
(I could always save the file locally first, send it to Amazon and
then delete it from my local server, but this would double the wait
for the user.)

Is there a way to only load chunks of the uploaded file into memory,
instead of loading the whole thing at once? And here comes an even
better question: Would it be useful?

Thanks in advance!


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



Re: Blog engine

2007-07-29 Thread Henrik Lied

@Forest: I agree, it should be that simple. But let's say you've got a
comment reply plugin. How would we - through a middleware - manage to
intercept our usual comment system, and modify the HTML template
source to fit the plugin? It's cases like these I see the potential
pitfalls of our way of thought. Please, enlighten me if the answer is
simple. :-)


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



Re: Blog engine

2007-07-28 Thread Henrik Lied

Ok, so I've been thinking some more.

The model could be something like this:
class Plugin(models.Model):
"""(Plugin description)"""
pointer = models.FilePathField() ## Could work, right?
name = models.CharField(maxlength=200)
description = models.TextField(blank=True, null=True)
url = models.URLField()
apply_to = models.ForeignKey(ContentType)
active = models.BooleanField(default=False)

We then would have to make a standard on how the plugin-packages would
be designed.
A zip-file would probably work out OK. We would then have to get this
zip-file, run through it and copy its files into a plugins-
subdirectory. The package should have a info.txt-document, where the
plugin title would be on the first line and description on the second.

But - I'm still not sure how we'd easily hook this into other
applications - at least not without the user having to modify the
source code...


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



Re: Blog engine

2007-07-28 Thread Henrik Lied

When you say "installs", do you mean that the plugin is retrieved from
the external site, and placed somewhere on the users host, or is it
constantly querying the plugin on a remote computer?

The first of those two options would definitely be the best. But I'm
having some problems working it out IRL:
Let's say you've just installed the Akismet-plugin. How are we
supposed to notify the comment framework that a new plugin has been
installed - and better yet - how it should use it? This is a valid
problem for almost every plugin. If we manage to resolve a good answer
to that question, I'm done being a critic. :-)


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



Re: Blog engine

2007-07-27 Thread Henrik Lied

This is great, Chris, but the fact of the matter is that it won't
appeal to the "Wordpress crowd".
That group wants in-browser setup, easy plugin architecture etc.
contrib.admin wouldn't do the trick. The admin-panel would have to be
hand made.

For the plugin architecture: I have no idea how we'd do this well. Any
input here?
It *could* be done in a Facebook Apps-manner (the actual code is
remotely hosted, the admin-panel would show a list of available
plugins), but I don't know how ideal this would be in a real world
scenario. It sure would be great, though!


On Jul 25, 12:06 am, "Chris Moffitt" <[EMAIL PROTECTED]> wrote:
> I think I mentioned earlier in this thread, that I do have my take on
> creating a blog here 
> -http://www.satchmoproject.com/trac/browser/satchmoproject.com/satchmo...
>
> It's pretty full featured right now and makes use of the tagging and
> comment_utils libraries.  It still needs the feeds but that should be pretty
> simple.  It's BSD licensed so hopefully it will be useful to folks.
>
> -Chris


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



Re: Blog engine

2007-07-24 Thread Henrik Lied

This sounds great. I created a project on Google Code:
http://code.google.com/p/django-blog-engine/


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



Abstracting the low level API

2007-07-06 Thread Henrik Lied

Hi there!

The cache middleware didn't quite suit my needs, so I threw up a small
function to reset the cache key whenever the object is updated.

The functions look like this: http://dpaste.com/hold/13712/

Sample usage would be
>>> entry = cache_key(request, 'blog', Entry.objects.get(id=1))

The problem with this is that it hits the database, right? So the
whole purpose of the cache is gone.
How can I make this better?


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



Re: Event based caching

2007-06-10 Thread Henrik Lied

So there's simply no way around this?
If I'm sticking with the time based cache, it will probably only be
activated
for non-authorized users. The problem is that most of the site is
restricted to
logged in users, so the server load will probably be a bit too high.

Has this subject never been touched before? I feel that that's
strange.

If you look at Facebook, for instance. They use memcached all over the
place, but
they're still able to show you the updated information (when it's
updated). Should it
really be so difficult to allow event based caching? Doesn't the
framework know the
name of the keys that needs to be updated on POST?


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



Event based caching

2007-06-09 Thread Henrik Lied

Hi there!

I haven't found anything on this, so I thought I'd ask:
Has anyone implemented event-based caching in Django?

Hypothetical scenario
---
A rather large social networking site uses memcached for caching. The
Django Caching Framework only allows time-based caching:
1. User A logs in
2. User A updates a blog post
3. User B shortly after reads the blog post, but the caching framework
still displays the old version of the entry.


How can I prevent this? Is there an easy way to delete a single key in
the cache?


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



Editing seveal object in one page

2007-05-12 Thread Henrik Lied

Hello!

Ok, this is the scenario:
An album contains several images. The user can click on "manage
album", and get a list of all the images contained inside the specific
album.
The user should then be able to edit information on each individual
image on one page, and click a "Submit"-button at the bottom.

I'm having some trouble wrapping my head around a good way to do this.
I don't want to wrap each image in it's own FORM-element. I've been
thinking about making each INPUT-element a part of an array (), but that'll make it difficult/
impossible to link the images with the corresponding text.

Does anyone have any input on this matter? I'd be really grateful! :-)


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



Re: Example of passing initial value to SelectDateWidget?

2007-04-29 Thread Henrik Lied

> > > Is anyone able to provide an example of passing initial data to the
> > > SelectDateWidget in newforms.extras.widgets (or to the DateField that
> > > uses that widget)?  I've tried many different approaches, but am
> > > totally stuck.
This won't work?
birthdate = forms.DateField(label='Birth date',
widget=SelectDateWidget(years=range(2006,1900,-1)))


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



Re: Friendship_type on symmetrical M2M

2007-04-28 Thread Henrik Lied

Thanks for the quick reply!

On 29 Apr, 02:02, Tim Chase <[EMAIL PROTECTED]> wrote:
> This also meets your criterion that, X can consider Y a friend,
> but Y doesn't have to consider X a friend.
I'm sorry, maybe I haven't been clear enough on what I want to
achieve.
This little problem is part of a pretty large project. My employer has
spent enormous
resources on user testing on this point, and the fact is that people
want this process to
be quick and easy. If Joe adds Murray as a friend, and uses the pre-
filled description
"We worked together" when adding him, Murray simply wants to be able
to press
"Confirm", and the relationship is set up on both their profiles. This
is where
the symmetrical M2M is really handy - it doesn't rely on two separate
fields in the
table. The friendship on both sides is easily extracted through
something like
v = Profile.objects.get(user=request.user)
v.friends.all()

Do you get what I mean? I'm really sorry if I'm not clear enough!
> Imagine if "description" was "Mom".  If X is Y's
> mom, but Y certainly wouldn't be X's mom.  Unless you live in
> some freaky world of inbreeding where you married your own father. :)
I can assure you that this won't be a problem. The "description"-field
will
be very dynamic, as mentioned above ("We worked together" etc.)


Again, thank you for your input! This is an interesting
discussion. :-)


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



Re: Friendship_type on symmetrical M2M

2007-04-28 Thread Henrik Lied

Thanks Malcolm!
One question:
In my example, it would be very easy to add and display friends.
If Joe added Murray as a friend, I would simply get Joe's friends
by doing something like:
v = Profile.objects.get(user=request.user)
v.friends.all()

And the approach would be the exact same for Murray.

In Tim's example, the model "Friendship" has two references to
the User-object.

So, if Joe added Murray as a friend, I'd get that out by doing
something
like:
v = Friendship.objects.filter(person=request.user)
for a in v:
#something

But - if I'm not too tired - this query wouldn't include Joe in the
output in
Murray's case.

Catch my drift?

It doesn't seem to be dynamic enough, if you understand what I mean.

On 29 Apr, 01:49, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-04-28 at 23:27 +, Henrik Lied wrote:
> > Thank you for your example, Tim.
> > I'm sorry, but the problem with it is that it isn't symmetrical.
>
> > A part of my Profile-model looks like this:
> > class Profile(models.Model):
> > user = models.ForeignKey(User)
> > friends = models.ManyToManyField("self")
>
> > This makes it very easy to create and maintain a relationship
> > between users - but I have no idea how to specify the friendship
> > type. Is it even possible?
>
> Go back and have another look at Tim's suggestion. It is the right
> approach. The problem isn't that the relationship is symmetrical, you're
> right: the problem is that you cannot attach any extra attributes to the
> relationship table (the table that connects the two ends) using
> ManyToManyField.
>
> Instead of trying to make the relationship a direct Many-to-Many, which
> does not let you put any fields on the intermediate table, you need to
> construct the intermediate table yourself via a couple of joins.
>
> See, 
> alsohttp://www.djangoproject.com/documentation/models/m2m_intermediary/for
> a similar example.
>
> Regards,
> Malcolm


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



Re: Friendship_type on symmetrical M2M

2007-04-28 Thread Henrik Lied

Thank you for your example, Tim.
I'm sorry, but the problem with it is that it isn't symmetrical.

A part of my Profile-model looks like this:
class Profile(models.Model):
user = models.ForeignKey(User)
friends = models.ManyToManyField("self")

This makes it very easy to create and maintain a relationship
between users - but I have no idea how to specify the friendship
type. Is it even possible?

Facebook has done this in a great way, and I'm guessing they're using
a similar approach to what I'm trying. But how the hell do they manage
to
specify the friendship type? That's what my brain is having problems
understanding.

What do you guys think?


On 28 Apr, 23:41, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Scenario: User A goes to User B's profile. User A know User B,
> > so User A adds User B as his friend. He then specifies their
> > friendship as "Colleagues".
>
> > How can I make this work? I have extended the User-model to
> > include a friends-field (ManyToManyField("self")), but I have
> > no idea how to specify the friendship type for each of the
> > friendships in a dynamic way. Think Facebook. Only one of the
> > users specify the friendship type.
>
> It sounds like you want something like a secondary model to which
> you can attach such attributes:
>
> class Person(Model):
> pass
>
> class FriendshipType(Model):
> # "colleague", "roommate", "teacher", etc
> pass
>
> class Friendship(Model):
> person = Person()
> friend = Person()
> description = ForeignKey(FriendshipType)
> known_since = DateTimeField()
>
> to which you can do things like
>
> my_friends = Friendship.objects.filter(
> person=request.User).select_related()
> for friendship in my_friends:
> do_something('I have known my %s %s since %s' % (
> friendship.description,
> friendship.friend,
> friendship.known_since,
> ))
>
> in your view.
>
> -tim


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



Friendship_type on symmetrical M2M

2007-04-28 Thread Henrik Lied

Hi there!

Scenario: User A goes to User B's profile. User A know User B, so User
A adds User B as his friend. He then specifies their friendship as
"Colleagues".

How can I make this work? I have extended the User-model to include a
friends-field (ManyToManyField("self")), but I have no idea how to
specify the friendship type for each of the friendships in a dynamic
way. Think Facebook. Only one of the users specify the friendship
type.

Any input here? :-)


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



"News Feed" feature

2007-04-23 Thread Henrik Lied

Hi there,

What would you say is the best way to implement a "news feed" feature,
like the one in Facebook? Right now I have a model (ActivityMonitor)
with fields for actions, paths and users. But I feel this method might
not be scalable enough. I print the entire action into the database
("User made a comment about User2's image").

Have anyone in here done something like 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DateField returns 'str' object has no attribute 'strftime'

2007-04-20 Thread Henrik Lied

Hi Malcolm,

I just figured it out - with some help in the IRC-channel.

I passed the form variables through datetime.date. That did the trick.

Thanks for your reply!

On 20 Apr, 11:44, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-04-20 at 09:09 +0000, Henrik Lied wrote:
> > Hi there,
>
> > I'm creating a user registration system for a project.
> > The system uses the SelectDateWidget for user input of birthdate.
>
> > When I try to register a new user, the system spits back this error:
> > 'str' object has no attribute 'strftime'
>
> > This is the relevant code:
> > bd_month = frm.data['birthdate_month']
> > bd_day = frm.data['birthdate_day']
> > if len(bd_month) == 1:
> > bd_month = '0'+bd_month
> > if len(bd_day) == 1:
> > bd_day = '0'+bd_day
>
> > temp_date = frm.data['birthdate_year']+'-'+bd_month+'-'+bd_day
>
> > The error occurs in django/db/models/fields/__init__.py in
> > get_db_prep_save
>
> A few more clues might be helpful. The error message is telling you that
> you're passing a string where a datetime object is expected, but you
> don't explain how you are passing data to a model field anywhere. Note
> that get_db_prep_save() is used to convert Python objects back to
> strings for putting into the database, so if your field data has not
> been already converted to a Python object by that point, a mistake has
> been made somewhere.
>
> What line in the above code fragment throughs the exception? If none of
> those lines do it, how are you passing your data to the code that does
> throw the exception? Can you write a short example that shows the
> problem?
>
> Regards,
> Malcolm


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



DateField returns 'str' object has no attribute 'strftime'

2007-04-20 Thread Henrik Lied

Hi there,

I'm creating a user registration system for a project.
The system uses the SelectDateWidget for user input of birthdate.

When I try to register a new user, the system spits back this error:
'str' object has no attribute 'strftime'

This is the relevant code:
bd_month = frm.data['birthdate_month']
bd_day = frm.data['birthdate_day']
if len(bd_month) == 1:
bd_month = '0'+bd_month
if len(bd_day) == 1:
bd_day = '0'+bd_day

temp_date = frm.data['birthdate_year']+'-'+bd_month+'-'+bd_day

The error occurs in django/db/models/fields/__init__.py in
get_db_prep_save

Anyone have a clue?


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



Re: ANN: Upcoming backwards-incompatible changes to Django development version

2007-04-06 Thread Henrik Lied

Yeah, you're right about that. Your example works best with
editable=False, I'd say.


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



Re: Smartest way to display help messages per view

2007-04-06 Thread Henrik Lied

I'm not quite sure what I'd to, either. Giving the help info its own
model might be good in some way, but it might be a bit overkill.
Totally depends on your application.


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



Re: ANN: Upcoming backwards-incompatible changes to Django development version

2007-04-06 Thread Henrik Lied

> Examples of some of these changes are:
>
> * Removing the "auto_now" and "auto_now_add" options in Django models.
>
Is this removed without a substitute?


> * Removing the LazyDate shortcut.
>
Again, is this removed without a substitute?


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



Starting a new, external process

2007-03-14 Thread Henrik Lied

Hi there!

I have a model which allows people to upload videos.
In the save-method I run os.system("mencoder *variables"), which
converts the uploaded video to a flash file.

I don't want the user to have to wait until the conversion is done
before he can go on with his business. I've tried the Thread-module,
but the current job still waits for the background process to finish..

Does anyone have a good idea (with a full example) on how I should go
on? :-)


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



Re: Video uploading and converting - queue system?

2007-03-08 Thread Henrik Lied

The thing is that the server load will increase quite a bit when 500
users do the same thing at the same time. It would be nice to get a
different server to take care of this.

How's that "large streaming upload" patch working?


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



Video uploading and converting - queue system?

2007-03-07 Thread Henrik Lied

Hi there,

I'm creating a video upload feature for a social network. The uploaded
video gets converted to Flash Video (flv) using mencoder.

I need some input on how to convert the video. As it is now, I'm just
converting the file directly after the original file is saved (via
os.system). The problem with this (I think) is that it won't be good
in the long run, since the user has to wait until the video is
processed by mencoder.

So I've been thinking about a queue-system. How I should do this I'm
not sure about. I was thinking about adding an extra field to the
model (encoded = models.BooleanField), and setup a python script which
returns all the non-encoded entries. This script then executes the
os.system()-command, and sets encoded to True.
I guess I'd have to setup a simple crontab that would run this script
every 10-20 minute.

Do you have another idea? I've read about os.fork - would that be
ideal for my problem?

I welcome every input, so please - don't be shy! :-)


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



Re: How to implement a group-feature in a social network app?

2007-03-04 Thread Henrik Lied

For example:

Joe creates a group called 'Fruitlovers'. Then he wants Chris and
Peter to be able to moderate the group. What would be the ideal GUI-
presentation for the creator? And how would a view like that look like?


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



Re: How to implement a group-feature in a social network app?

2007-03-04 Thread Henrik Lied

Hi there,

That's actually true, I've changed that to a M2M now. Thanks! :-)

Any other suggestions? Does anyone know of any articles/texts on this
subject?

--
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to implement a group-feature in a social network app?

2007-03-04 Thread Henrik Lied

Hi there,

I'm creating a social network app. with lots of features. Among those
features are the possibility of users creating groups. A group of
course has an owner, and the owner is supposed to be able to assign
moderators to that group. I have a mockup of a model, but I don't
think it's good enough.

Current model:
class Group(models.Model):
creator = models.ForeignKey(User, raw_id_admin=True,
verbose_name='gruppeadmin', related_name='Creator of the group')
name = models.CharField(maxlength=200, verbose_name='gruppenavn')
slug = models.SlugField(prepopulate_from=['name',], unique=True)

moderator_1 = models.ForeignKey(User, raw_id_admin=True,
null=True, blank=True, related_name='Moderator number one')
moderator_2 = models.ForeignKey(User, raw_id_admin=True,
null=True, blank=True, related_name='Moderator number two')
moderator_3 = models.ForeignKey(User, raw_id_admin=True,
null=True, blank=True, related_name='Moderator number three')
moderator_4 = models.ForeignKey(User, raw_id_admin=True,
null=True, blank=True, related_name='Moderator number four')
moderator_5 = models.ForeignKey(User, raw_id_admin=True,
null=True, blank=True, related_name='Moderator number five')

description = models.TextField('beskrivelse')
category = models.ForeignKey(GroupCategory,
verbose_name='gruppekategori')

creation_date = models.DateTimeField(auto_now_add=True)



Have any of you created a similar feature, or is able to give me some
feedback on how it's done properly? :-)


Cheers from Norway,
Henrik Lied


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



Re: Template filter to retrieve the MEDIA_URL

2007-03-02 Thread Henrik Lied

Hi there, Sean!

Thanks for the different methods --

I went for a different approach, though. I simply created a simple
filter like this:
def mediaurl(value):
import re
from project.setting import MEDIA_URL
"Replaces the string MEDIAURL with the MEDIA_URL"
return value.replace('MEDIAURL', MEDIA_URL)

...and use it like this: {{ object|mediaurl }}

Is this a bad way to resolve the 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to user generic views (object_list) to show dynamic list ?

2007-03-02 Thread Henrik Lied

Yeah, just pass an extra argument in the urls.py, like /files/(?
P[-\w]+), and filter your queryset. Take a look at
http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views


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



Template filter to retrieve the MEDIA_URL

2007-03-02 Thread Henrik Lied

Hi there,

I'm just wondering what the best way of retrieving the MEDIA_URL for
an object is.

Let's say I'm writing a blog post with some images. Instead of writing
http://media.mydomain.com/image.gif";>, I'd write  or something equivalent.

So if I change my domain, I wouldn't have to rewrite a ton of blog
posts to change the domain.

--

Have anyone tried 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Need input on how to create a good tagging feature

2007-02-26 Thread Henrik Lied

Great, thanks! :-)


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



Re: Need input on how to create a good tagging feature

2007-02-26 Thread Henrik Lied

Ah, GREAT! Just what I needed :-)

One question though - if I wanted not only to split the tags when
space separated, but also on "," and ", " - how would I do that?


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



Need input on how to create a good tagging feature

2007-02-26 Thread Henrik Lied

Hi there!

I'm currently creating a new social networking site, specific for my
country.
One of the things on the feature-list is that each profile can create
blogs (several, if the user wants to), and with blogging, tags become
the natural alternative.

So - I'd like some input on what you think is the most appropriate way
of users tagging entries. I don't think the usual ManyToMany-widget is
the best way. I like the Flickr/delicious-kind of tagging, where users
write the tags in a charfield like "home, blogging, article, more".

What's the best way of getting a feature like this to work?

The models are like this:

class Tag(models.Model):
author = models.ForeignKey(User, raw_id_admin=True)
name = models.CharField(maxlength=64)
slug = models.SlugField(prepopulate_from=['name'])

class Entry(models.Model):
name = models.CharField(maxlength=200)
tags = models.ManyToManyField(Tag)

[]

Would overriding the save-method on Entry be a choice? If so, what
would be the best way to do so?

Thanks in advance!
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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Inserting dummy content

2007-02-09 Thread Henrik Lied

Hi there!

I was wondering if there's an easy way to insert a lot of dummy
content into a couple of models. Have anyone written something that
does this?

The reason I'm asking is that I'm writing this social networking app,
and in a while I'm going to present it to a company. It would be nice
to have a bunch of dummy users and dummy content by then, just to
illustrate the power of the built in admin filtering possibilities.
I'm not to keen on creating fifty different users, and just as many
user profiles and content, if you know what I mean.


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



Trouble with relations

2007-02-09 Thread Henrik Lied

Hi there!

I'm currently working on a project which mixes user generated content
with journalistic content.
The system lets users vote on an article, and articles with many
positive votes will come up in the admin-panel, so that the moderators
can label the entry for front page status.

class FrontPageEntry(models.Model):
added = models.DateTimeField(auto_now_add=True)
entry_id = models.ForeignKey(Entry, raw_id_admin=True)


This model above is the one used to set the newest feature-article on
the front page.
What I'm a little confused about is how I'm going to get this
displayed!

I guess I'll have to call Entry.objects.filter(ARGS HERE), but exactly
what args I should use I don't know.


Can someone push me in the right direction? :-)


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