Obsoleting by date

2006-11-14 Thread Gabriel Puliatti

Hello, I have a model which is obsoleted after a certain date, so that
I can just retrieve the entries from database which are in the future,
and not those which have already passed.

Since I can't get into the djangoproject database, I guess I should
try here. Is there a way to .get() or .filter() those which have a
date in the future, or get a boolean to be true after a certain date?

-- 
The Public is merely a multiplied "me."
-- Mark Twain

Gabriel Puliatti
[EMAIL PROTECTED]
predius.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-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
-~--~~~~--~~--~--~---



Django site.

2006-11-13 Thread Gabriel Puliatti

Is the Django site down?

I've been getting a (145) Connection timed out for a while now.

-- 
The Public is merely a multiplied "me."
-- Mark Twain

Gabriel Puliatti
[EMAIL PROTECTED]
predius.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-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: Nesh Thumbnail - Installation problem

2006-11-06 Thread Gabriel Puliatti
On Mon, 2006-11-06 at 10:07 +, Frankie Robertson wrote:
> I think the "class Foo(models.Meta):" in the example is a probably
> typo or something. I've used ImageWithThumbnailField in in a normal
> model and I suggest that you do too. 

Correct me if I'm wrong, but isn't class models.Meta back from before
magic-removal?

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


Re: Fast hosting for Django

2006-09-24 Thread Gabriel Puliatti

On 9/24/06, iain duncan <[EMAIL PROTECTED]> wrote:
> I know this has been asked many times, but as new hosting solutions pop
> up continually, just wanted to check on recommendations for good fast
> shared hosting that is Django friendly and reliable for business
> clients.

http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts

A list on the wiki of the Django-capable webhosts. There are even two
hosts which cater directly to Django users.


-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.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-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
-~--~~~~--~~--~--~---



Re: ManytoMany uploading.

2006-09-21 Thread Gabriel Puliatti

On 9/21/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote:
> Hm, I used that. I can print new_data.getlist('courses') and get the
> list, but when I try to assign it to a variable for writing, I get
> "'str' object has no attribute '_get_pk_val'"
>
> However, this only happens when I do new_profile.save(). When I try to
> write what you said, it works and I can print, but the same happens
> when trying to save.

Never mind, it's fixed now. I followed Malcolm's advice and got the
things from the database, using the id.

Took me a while to figure it out. :P Thanks for all, guy.


-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the furniture!
    -- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.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-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
-~--~~~~--~~--~--~---



Re: ManytoMany uploading.

2006-09-21 Thread Gabriel Puliatti

On 9/21/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> courses = new_data.getlist('courses')

Hm, I used that. I can print new_data.getlist('courses') and get the
list, but when I try to assign it to a variable for writing, I get
"'str' object has no attribute '_get_pk_val'"

However, this only happens when I do new_profile.save(). When I try to
write what you said, it works and I can print, but the same happens
when trying to save.
-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.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-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
-~--~~~~--~~--~--~---



Re: ManytoMany uploading.

2006-09-21 Thread Gabriel Puliatti
On Thu, 2006-09-21 at 06:30 +, pflouret wrote:
> try this:
> 
> new_profile = UserProfile(user=new_user, permissions=permissions)
> new_profile.save()
> new_profile.courses = courses
> new_profile.save()

Tried that. Failed with "'str' object has no attribute '_get_pk_val'".

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
    -- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


ManytoMany uploading.

2006-09-21 Thread Gabriel Puliatti
Hey, I'm trying to write a manytomany into the database. I have created
the form correctly, using {{ form.courses }}, and I can upload
everything. The problem comes when writing the data to the database. I
take the field as following:
courses = new_data['courses']
And then to write it, I do the following:
new_profile = UserProfile(user=new_user,
  courses=courses,
  permissions=permissions)

Problem is, I get "'courses' is an invalid keyword argument for this
function". 

If I try to print courses, I get a number. 1 if I choose the first
option, 2 if I choose option 2 and 1 or just 2, and 3 if I choose three
in any way, with others or alone.

What exactly do I need to do with this to write it into the database?


-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


Re: ManytoMany filtering

2006-09-19 Thread Gabriel Puliatti
On Wed, 2006-09-20 at 10:40 +1000, Malcolm Tredinnick wrote:
> 
> Homework.objects.filter(course__in =
> list(classesjoined.all()))
> 
> The list() call may be superfluous there, but I have a recollection
> that
> we don't handle iterators smoothly in filter() calls. I may be
> misremebering, though. 

That did it. Much thankful for everything, this not only helped in this
parted, but I had to use it in three functions, iirc. 

Also, will keep it as something to take into consideration, as I think I
might go into this in the furture.

Again, thanks a lot!

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


Re: ManytoMany filtering

2006-09-19 Thread Gabriel Puliatti
On Wed, 2006-09-20 at 09:35 +1000, Malcolm Tredinnick wrote:
> It's possible that I've guessed at the missing details incorrectly. In
> that case, could you give us an example of what "classesjoined" contains
> (print it out; don't guess at what you think it should it be) and maybe
> show the details of the Homework model?

All the models are here.
http://arrrt.googlecode.com/svn/trunk/homework/models.py


The code in question is here:
http://arrrt.googlecode.com/svn/trunk/homework/views.py
Look for "uploadlist".

If I try to use filter, I get no errors, but everything still passes,
not filtering anything.

Also, for "classesjoined". 
>>> print(classesjoined)



-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
    -- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


ManytoMany filtering

2006-09-19 Thread Gabriel Puliatti
Hello. I'm trying to get some database objects using objects.get.
However, I only want to get those objects which match a certain
manytomany. Is there a way to do this? 

For example, each student has multiple subjects and each homework has
one subject assigned to it. Then, there is a Subject class which to
which the students are connected using manytomany. I want to be able to
get the multiple subjects this student has and only get the homework
objects which match the subjects the student is enrolled in. When I
trying doing:

"homework = Homework.objects.get(course=classesjoined)" where classes
joined is the ManytoMany in the student's model, I get "Error binding
parameter 0 - probably unsupported type."

Is there a way to fix this?

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


Re: Uploading.

2006-09-12 Thread Gabriel Puliatti
On Tue, 2006-09-12 at 12:49 +, zenx wrote:
> thanks for the tutorial!!! I wil take a look at it :)
> 

I've now fixed all the indenting issues and checked the code for errors,
then fixed them. So it should work. If there are any issues, you know my
email. :P

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes

Gabriel Puliatti
[EMAIL PROTECTED]
predius.org


signature.asc
Description: This is a digitally signed message part


Re: Rails/Django comparison synopsis

2006-09-11 Thread Gabriel Puliatti
On Mon, 2006-09-11 at 16:41 -0700, Jeff Rodenburg wrote:
> My question: how would you (you = someone with solid Django
> background) characterize similarities and differences with Rails?

Django is slightly older, having been developed two years before the
initial release in July 2005. 

They have both been under extensive testing in their respective "owner"
sites, those being 37signal's for RoR and LawrenceWorld for Django.
However, benchmarks prove that Django is actually faster. [1]

Also, there are many complaints from RoR users that the documentation is
really bad. While I've sometimes missed some things on Django's, it's
been largely my fault, and it's always been right there. If not, it's
all in the site, be it tickets or source examples.

Tue, 2006-09-12 at 09:45 +0900, Sean Schertell wrote: 
> (1) The admin section is assumed. The admin section is unbelievably  
> cool when it meets 100% of your needs. But  if you decide for  
> whatever reason that you wanna do your own custom admin section,  
> prepare to endure some funkiness. For example, basic authentication.  
> You can use the bundled auth system, but then you're required to use  
> hard-coded urls for your login/logout pages. Don't like those urls?  
> Well then, you're gonna have to write you own authentication system  
> from scratch. I've found this to be the case for a lot of stuff.  
> Django gives you some stuff for free, but it's not as flexible as I'd  
> hoped. And writing your own from scratch feels like more work to me  
> than it did in Rails (for example the auth system).

Really? I just used my own forms and used authenticate() and login(). It wasn't 
more than 10 or 15 lines.


[1] http://wiki.rubyonrails.org/rails/pages/Framework+Performance

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the
furniture!
-- Sherlock Holmes


Gabriel Puliatti <[EMAIL PROTECTED]>
predius.org


signature.asc
Description: This is a digitally signed message part


Uploading.

2006-09-11 Thread Gabriel Puliatti
I've uploaded a tutorial on uploading files into Django. I had some problems doing this when I started working on Django, and thought that perhaps people would appreciate it. I know that the files are not indented, blame Wordpress. It would be good to get some feedback, as I adapted it from my program and am not completely sure that it would work as it is. 
Link is:http://blog.predius.org/2006/09/11/uploading-files-on-django/-- No violence, gentlemen -- no violence, I beg of you!  Consider the furniture!
-- Sherlock HolmesGabriel Puliatti[EMAIL PROTECTED]predius.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-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  -~--~~~~--~~--~--~---


Filtering by groups.

2006-09-01 Thread Gabriel Puliatti

Hello. I have an application in which a list should be filtered
depending on what groups a user belongs, since the application is a
homework list, and the list must only contain the classes the user
(student) is enrolled.

I know I should do this using filter, but I have no idea how to get
the list of groups the current, logged in user is a member of, and
then making that into a filter. Anyone have any tips?

-
def index(request):
object_list = Homework.objects.order_by('-duedate')[:100]
t = loader.get_template('homework/homework_list.html')
c = Context({
'object_list': object_list,
})
return HttpResponse(t.render(c))
-

This is the relevant function, in which the latest 100 homework
entries are passed and then rendered by a template.

If anyone has any tips on how to do this filtering by user group, then
please do. Help is much appreciated at this point, considering I am a
newbie. :P

-- 
No violence, gentlemen -- no violence, I beg of you!  Consider the furniture!
-- Sherlock Holmes

Gabriel Puliatti
predius.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-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
-~--~~~~--~~--~--~---



Re: upload files to another server

2006-08-23 Thread Gabriel Puliatti

On 8/23/06, zenx <[EMAIL PROTECTED]> wrote:
> But how could I upload files with Django FileField or ImageField to
> another webserver than the one using django?

I think it meant something like a separate server, not a machine.

Like using apache to run Django and lightTPD to serve the media files.


-- 
You can't get there from here.

Gabriel Puliatti
predius.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-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
-~--~~~~--~~--~--~---



Re: How to user django upload file ?

2006-08-05 Thread Gabriel Puliatti

On 8/5/06, Zheng JinYuan <[EMAIL PROTECTED]> wrote:
>
> Can not find document in django site about how to upload file ? Any tips ?
>

I did that a couple of days ago.

http://code.google.com/p/arrrt

Get the code, and look for the functions for uploading in views.py.


-- 
Wagner's music is better than it sounds. -- Mark Twain

Gabriel Puliatti
predius.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-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
-~--~~~~--~~--~--~---



Re: Novice problem with cookies

2006-08-03 Thread Gabriel Puliatti
On 8/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi, I'm here again:
>
> I'm a novice with web developing and when I began to read django
> documentation
> I understood that that wasn't matter with the name you put to the
> SESSION_COOKIE_DOMAIN and if it has dots in it it will not have
> problems with firefox.
>
> I'm finishing a project made with django but I have a little problem.
>
> My project hasn't a domain name and my client doesn't want me to
> register one (It will be part of a bigger web site)
> Now we are testing the app and we are experimenting a problem.
>
> As we haven't a domain name I set the SESSION_COOKIE_DOMAIN to the
> public IP of the site. Well this works great from Internet, but when I
> try to access the admin site from the lan of my client I couldn't log
> in. If I change the SESSION_COOKIE_DOMAIN it works into the lan but not
> outside. It's not a browser
> related problem because I tested this with at least two different
> browsers IE and Firefox.
>
> I was looking for a solution and I thought about installing a DNS on
> the lan of my client but I believe that it will not solve the problem
> because I don´t have a domain name.
>
> Thanks in advance.
>
>
> >
>

Can't you invent a domain name and add it into /etc/hosts of the client?

-- 
Wagner's music is better than it sounds. -- Mark Twain

Gabriel Puliatti
predius.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-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
-~--~~~~--~~--~--~---



Two entries in a Manipulator.

2006-08-02 Thread Gabriel Puliatti

Hey, I'm trying to upload a file. However, I have two fields, one
which is the file and the other one which is called togroups. However,
reading the forms documentation I did not find a way to add two items,
just one.

The relevant code is here.
http://pastebin.ca/111991

And this is the error that is print()ed.
{'togroup': ['This field is required.']}



-- 
Wagner's music is better than it sounds. -- Mark Twain

Gabriel Puliatti
predius.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-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
-~--~~~~--~~--~--~---



Uploading?

2006-08-02 Thread Gabriel Puliatti

Hey, I've been trying to do an uploading page, where users can upload a
file, outside of the admin panel, of course.

I follow http://www.djangoproject.com/documentation/forms/, but I end
up getting

"local variable 'errors' referenced before assignment"

All the code is here: http://arrrt.googlecode.com/svn/trunk/ if needed.

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