Re: edit model properties in the admin

2018-02-14 Thread Gonzalo Delgado
On 14/2/18 08:05, Andy wrote:
> Im trying to have a custom admin that is also able to edit some model 
> properties, but putting those properties into my fieldsets its complaining

What would mean to edit a property (assuming this means an attribute
that isn't a model field) in your app? Where would the data go?

> Unknown field(s) (foo, bar) specified for Profile. Check 
> fields/fieldsets/exclude attributes of class ProfileAdmin.
> The properties work in list_display, but im missing something for the edit 
> page.


The Django admin will look only for Django fields in the edit forms,
that's why you're getting the errors.
Since list_display is only for showing data, it will display any
attribute in your model.

> Can i actually do this? So far i didnt find any hint on editing properties 
> with the admin.

What you can do is use a custom model form and add fields to it for the
attributes you want to be able to "edit", but you'll also need to define
what happens with the data either in the custom form class itself, or in
the ModelAdmin class by extending the change_view method.

See the documentation for details:
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form

-- 
Gonzalo Delgado

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27737ad2-0218-998a-054b-037054bf5bba%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/d/optout.


Re: Basic note/trello app - how to link model object IDs

2018-02-13 Thread Gonzalo Delgado
Hi Lylio,

On 12/2/18 16:20, Lylio wrote:
> 1. To click on a card so it opens up and displays the details, am I right
> to say I should create a card.html file in the templates folder for this?

It isn't necessary, but it is a good idea
What you need is to create a view that renders such template.
I suggest you write your own view function that does that, but what
you'd usually do is just use a generic view and either pass it the
template you want to use, or name the template in a way the generic view
will find it on its own.
See:
https://docs.djangoproject.com/en/2.0/topics/class-based-views/generic-display/

> 2. I'm confused about how Django keeps track of the cards in my app - I
> presume each card object has an ID in the database and I'd need this
ID in
> order to retrieve the card's details when it's clicked - but I'm
unsure of
> how to link the two. In the two pictures above, say someone clicked on
the
> 'class progression' card on the left... I'd like a new page to open up
that
> display the details for that card and allows the user to edit the info or
> completely delete the card.

Yes, in general, every Django model instance has an id (unless you
specifically tell it not to), and you can use it to create urls for the
detail view I mentioned earlier. This is a good start, but you'll later
want to add a SlugField to your Card model, and use that instead of the
id so urls look nicer.

> I'm maybe asking a bit much here - but I'm unsure of how complex these
> requirements are. It feels like it should be *fairly *straightforward.
Any
> thoughts or advice would be greatly appreciated.

I can assure you using Django for a project like yours is *very*
straightforward.
When in doubt, revisit the Django tutorial. This part is a good one for
where you're at: https://docs.djangoproject.com/en/2.0/intro/tutorial03/


-- 
Gonzalo Delgado

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c13ffca9-7a4a-e153-86d8-198a4a2d197a%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/d/optout.


Re: Hiding models from certain UserAdmin

2014-07-24 Thread Gonzalo Delgado
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

El 24/07/14 09:36, alireza sanaee escribió:
> I want to hide some models in django admin from some users which
> are admins but I don't know it is possible or not  .

Django's permissions system[0] should allow you to do exactly that.

[0]
https://docs.djangoproject.com/en/1.6/topics/auth/default/#topic-authorization

- -- 
Gonzalo Delgado
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlPRAK0ACgkQzbfdFL5JoUmA3AD/etZo/zjdFK+q0n+MTnHYQhu7
oBDYg9/trbisA5uiTi0BAISY3krV26Yn6toRkuA31aMD5BIMWoHjPGWTm3Gs6W30
=4wfU
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53D100AE.1050808%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/d/optout.


Re: Question about including CSRF token.

2014-07-21 Thread Gonzalo Delgado
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

El 21/07/14 15:57, Chen Xu escribió:
> I am writing a website using Django, and getting confused about
> CSRF token, I understand I need to include the csrf token on my web
> page to prevent the CSRF attack. However, I am also working on a
> mobile app, which will sends request to my website API, and get
> response back, how should I handle the CSRF token problem in this
> case?

How does your mobile app and your website API communicate?

Take a look at the documentation AJAX example here:
https://docs.djangoproject.com/en/1.6/ref/contrib/csrf/#ajax

It uses a custom "X-CSRFToken" header in the AJAX query from the client.
You can probably implement something similar in your app (if it isn't
implemented in javascript).


- -- 
Gonzalo Delgado
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlPNsWUACgkQzbfdFL5JoUlNgwD+MSz1AoP4ddGJkTNkbNZ7r80W
0jnMizvZ7f5tGoEdSAwA/j4LeVLF5pXGFj/hPLl/JHc1Kqw+BbhK53iTCFd9ZNzT
=Rbs/
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53CDB165.10709%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/d/optout.


Re: Using admin views "outside" of admin

2013-11-20 Thread Gonzalo Delgado
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

El 20/11/13 12:54, Brad Smith escribió:
> Based on other threads I've read here, it seems that the
> conventional wisdom is that the admin interface is only for
> low-level access to the database, and isn't designed for anything
> "fancy", like users with different levels of administrative rights
> within an app, etc. Ok, I get that, but if I may grasp at some
> straws briefly I'd like to ask one follow-up that I haven't seen
> answered elsewhere: my app has a bunch of objects with complicated
> relationships for which I've devised a reasonably pretty and
> intuitive editing interface using Django's admin and Grappelli. 
> Since this took a nontrivial amount of effort, I wanted to ask here
> if there are any tricks I should know about for re-using *any*
> views, inlines, etc from that admin interface in a more integrated
> editing interface with granular access controls, or do I just need
> to suck it up and rewrite everything from scratch using regular
> Django forms?

The django admin code is very extensible and re-usable. The
documentation may not stress this enough, but it is possible to do
virtually anything you want with it.

If I'm understanding your "outside" of the admin concept correctly,
what you want to do is extend the AdminSite[0] class (or maybe not
even that, just create a new instance) and attach the ModelAdmins you
want to it. I think you can even use autodiscover with a custom
AdminSite instance too if you need to have all models from
settings.INSTALLED_APPS attached to it.


[0]
https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#adminsite-objects

- -- 
Gonzalo Delgado
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.15 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlKNOH4ACgkQzbfdFL5JoUlCVQD6A1TUqYfKbgBDITrpvFblkQfo
nrVMCxnxSPIiREHgJaMBAKTR2auknxE6sX5s62B0j8eiH+AJB1EG1+AxeXoVHlGX
=kthG
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/528D387E.1080804%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to add objects from one class to another

2013-11-05 Thread Gonzalo Delgado
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

El 05/11/13 13:14, Aamu Padi escribió:
> I think abstract models is what I am after. But, I also want to get
> the latest photo by that user, be that a profile pic or background
> pic. Can I use the abstract base model, ie the Image model to
> atleast get the latest photo by [-pub_date], even though I wont
> save anything in it???

Hello Aamu :-)

Sadly, you won't be able to retrieve data in any way using the
abstract model class (see
https://docs.djangoproject.com/en/1.5/topics/db/models/#abstract-base-classes
), but django-polymorphic can definitely do that.

- -- 
Gonzalo Delgado
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.15 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlJ5JpgACgkQzbfdFL5JoUnlKAD+LljmaN7XpFTdQtcZx4i9e43c
7hAZ8Y2XOv0tH5TljKcA+wQdh5fNUmk71laONL1bWBWizncxe2PGFO/+QsLyOP+e
=AI7P
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52792698.6040509%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to add objects from one class to another

2013-11-04 Thread Gonzalo Delgado
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

El 04/11/13 19:33, Aamu Padi escribió:
> This is my models.py:
> 
> class Image(models.Model): user = models.ForeignKey(User) caption =
> models.CharField(max_length=300) image =
> models.ImageField(upload_to=get_upload_file_name) pub_date =
> models.DateTimeField(default=datetime.now)
> 
> class Meta: ordering = ['-pub_date'] verbose_name_plural =
> ('Images')
> 
> def __unicode__(self): return "%s - %s" % (self.caption,
> self.user.username)
> 
> 
> class ProfilePic(Image): pass
> 
> 
> 
> class BackgroundPic(Image): pass
> 
> 
> class Album(models.Model): name = models.CharField(max_length=150)
> 
> def __unicode__(self): return self.name
> 
> 
> class Photo(Image): album = models.ForeignKey(Album, default=3)
> 
> And this is another:
> 
> class UserProfile(models.Model): user = models.OneToOneField(User) 
> permanent_address = models.TextField() temporary_address =
> models.TextField() profile_pic = models.ForeignKey(ProfilePic) 
> background_pic = models.ForeignKey(BackgroundPic)
> 
> def __unicode__(self): return self.user.username
> 
> I can access the Parent class with its User object.
> 
>>>> m = User.objects.get(username='mika') m.image_set.all() 
>>>> [, ,
>>>>  mika_bf - mika>]
> 
> 
> But I can't access its child class with the User. I tried:
> 
>>>> m.Image.profilepic_set.all()
> and
> 
>>>> m.image_set.profilpic.all()
> 
> and this
> 
>>>> m.profilepic_set.all()
> AttributeError:'User' object has no attribute 'profilepic_set'
> 
> But all gave me errors!  How do I access the child classes, so that
> I can add images from one class to another. Like copy one image
> from Photo to ProfilePic, or from ProfilePic to BackgroundPic and
> so. Or simply, how to add images for particular User in specific
> classes?

I don't think Django supports that kind of queries. You can try
django-polymorphic for something very close to what you want:
https://github.com/chrisglass/django_polymorphic

My recommendation, though, would be to not use inheritance that way
and simply add an "image_type" field to your Image model and filter
that instead:

 class Image(models.Model):
 user = models.ForeignKey(User)
 caption = models.CharField(max_length=300)
 image = models.ImageField(upload_to=get_upload_file_name)
 pub_date = models.DateTimeField(default=datetime.now)
 image_type = models.CharField(
 max_length=20, choices=(('background', 'Background'),
 ('profile', 'Profile')))

and do:
m.image_set.filter(image_type='background')
or:
m.image_set.filter(image_type='profile')


Another possibility would be to make Image an abstract model. Your
references to profilepic_set and backgroundpic_set will work, but you
won't be able to use the Image model to store data in the database.


- -- 
Gonzalo Delgado
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.15 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlJ4QE8ACgkQzbfdFL5JoUlCDAEAkyrstji355TouLYZDjXmax8x
mFnN0nQ2lDbo0lUNiBsA/27hAQNhX74p1Wb3O1e3qjkK23nj6NCL09GL167Knl0h
=5oiE
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5278404F.8080805%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django database cache for longtime?

2013-05-29 Thread Gonzalo Delgado
El 28/05/13 20:04, kase escribió:
> i need cache a page  where i'm process a lot information
> 
> and i dont wish process again
> and  i dont wish keep in memory RAM, (maybe nobody ever review) 
> 
> so i wish put this page in a database cache but what can i do for never
> expire?

You want to use Redis[0].

There's also this django-redis[1] app that uses Redis as a cache
backend. It allows you to set keys with infinite timeout :-)

[0] http://redis.io/
[1] https://github.com/niwibe/django-redis

-- 
Gonzalo Delgado

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: NoReverseMatch at /app/

2013-05-09 Thread Gonzalo Delgado
Try this instead in your template:

{% url 'detail' registo.id %}

When referencing named urls, the name must be exactly as defined in the url
pattern.

2013/5/9 Carlos Aboim <abo...@gmail.com>

> {% url 'registo.detail' registo.id %}
>


-- 
Gonzalo Delgado

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Caught NoReverseMatch while rendering:

2011-04-06 Thread Gonzalo Delgado

El 05/04/11 17:48, GOUTAM KUMAR RANA escribió:


   7 : home - about - archive - contactcontact


Make sure a url named[0] "homepage_about" exists in one of your active 
urls.py files, and that it takes no arguments.


[0] 
http://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns


--
Gonzalo Delgado<gonzalo...@gmail.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-users@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: All views require login?

2011-03-17 Thread Gonzalo Delgado

El 17/03/11 09:30, galgal escribió:
I need to make an application in which all views require login. Is 
there any good way to do that and not to use @login_required() 
decorator with all methods? 


Yes there is: http://djangosnippets.org/snippets/1220/

--
Gonzalo Delgado<gonzalo...@gmail.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-users@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: OS Error, Permission Denined

2010-10-07 Thread Gonzalo Delgado
El 07/10/10 16:21, Rizwan Mansuri escribió:
> Could you please guide me to any document that explain this?

Sorry, I may have assumed too much on my previous response.
What OS is your Django project running on?

Here is a guide for Linux:
http://www.zzee.com/solutions/linux-permissions.shtml

-- 
Gonzalo Delgado <gonzalo...@gmail.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: OS Error, Permission Denined

2010-10-07 Thread Gonzalo Delgado
El 07/10/10 16:05, Rizwan Mansuri escribió:
>
>
>   I am newbie in Django. I ‘m stuck at this point. I have developed
>   one apps in django which has Imagefield. While I am trying add this
>   content in site its giving me error saying OSError at
>   /admin/portfolio/portfolio/add/
>
> [Errno 13] Permission denied: '/myproject'. Myproject is root folder
> of my django website. I have pasted traceback below.
>

You need to allow the http process user (most likely apache) to write in
that folder.

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Can you make a subclass of a model just to alter behavior?

2010-09-30 Thread Gonzalo Delgado
El 30/09/10 15:57, orokusaki escribió:
> I'm looking to do the opposite of what Django's proxy model does. I
> want to subclass Model, add some extra methods to it, add behavior to
> save(), set a default manager that adds some my-application-specific
> methods, and then subclass that to create most of the models in my
> application. Is this possible?
>   

Hmm.. I can't think of any caveats off the top of my head. Did you try that?
The only thing that smells a little like trouble to me is setting a
default manager.

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Flexigrid

2010-08-03 Thread Gonzalo Delgado
El 02/08/10 12:45, Ramesh escribió:
> It looks like you are just showing me how to search on google which I
> already did but couldn't find the solution I was looking for.
>
> I am still looking forward for the help on flexigrid for my project. I
> really appreciate your help.
>   

The first result I get searching with Google turns up a snippet for
integrating Flexigrid into Django[0], did you try that?

[0] http://snippets.dzone.com/posts/show/6917

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Flexigrid

2010-07-30 Thread Gonzalo Delgado
El 30/07/10 15:41, Ramesh escribió:
> I want to use Flexigrid for my project. I have used it before on
> TurboGears and it's really nice.
>
> Can somebody please help me how can I use flexigrid for my project?
> tutorials link to start for using Flexigrid on django?
>   

http://is.gd/dTrPN

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Django IDE

2010-07-18 Thread Gonzalo Delgado
El 18/07/10 06:09, Antoni Aloy escribió:
> Actually the best productive "IDE" for me, and I'd like to remark the
> for me, is Vim/gVim with lots of plugins.
For me too, this link is useful:
http://code.djangoproject.com/wiki/UsingVimWithDjango

-- 
Gonzalo Delgado <gonzalo...@gmail.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.



Email login in admin site

2010-07-06 Thread Gonzalo Delgado
Hello there,

I have setup email login in a Django site in a very similar way as
http://djangosnippets.org/snippets/74/
It works on the admin, meaning a correct email/password combination logs
the user in.

The problem is when there is no user with the entered email address in
the database. The admin shows this misleading error message:   
"Usernames cannot contain the '@' character.".

To solve this, I have tried a custom AdminSite class (the error message
is displayed from the login view method in the AdminSite class) with a
modified login method, but then I have to find a way to get all the apps
registered in the default admin site (using a customized AdminSite
instance won't show any app in the admin index page).
I tried defining the get_urls method like this:

def get_urls(self):
from django.contrib.admin import site
return site.get_urls()

but that doesn't work, because it uses django.contrib.site's login view
instead of mine, so I try hacking the urlpatterns:

def get_urls(self):
from django.contrib.admin import site
index = self.admin_view(self.index)
return patterns('', url(r'^$', index, name='index')) +
site.get_urls()[1:]

which does not work either, I get the "Looks like your browser isn't
configured to accept cookies. (...)" error message when logins should be
successful:(

I don't want to keep on going with a custom admin site for only getting
that error message right, but I don't see any other way (don't want to
hack Django's code either, unless this is considered to be a bug).
Does anybody know of a better way to handle this?

Thanks!

-- 
Gonzalo Delgado <gonzalo...@gmail.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: determining changes in file

2010-06-16 Thread Gonzalo Delgado
El 16/06/10 03:56, tazimk escribió:
> I have a text file being written by another process on a server which
> I want to watch for changes. Each time a change occurs I'd like to
> read the new data and send it to client . Any suggestions will be
> valuable . Using Django,Python
>   
If using Linux, Pyinotify may be what you're looking for:

http://trac.dbzteam.org/pyinotify

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Resize uploaded file file with PIL

2010-05-25 Thread Gonzalo Delgado
El 25/05/10 19:12, Igor Rubinovich escribió:
> I want to resize the uploaded file before saving a form. I'd like to
> do something like
>
> img = request.FILES['image']
> img.thumbnail( (200,200), Image.ANTIALIAS)
> img.save(request.FILES['image'], "JPG")
>
> photo_form = forms.PhotoEditForm(request.POST, request.FILES,
> instance=photo)
> photo_form.save()
>
> i.e. I'd like to put it into the form resized, and preferably without
> a temporary file.
>
> What I don't know is what FILES object really is so it's hard to
> figure out what's the right way to achieve this.
>
> Any ideas?
>   

You want to take a look at easy-thumbnail:
http://github.com/SmileyChris/easy-thumbnails

-- 
Gonzalo Delgado <gonzalo...@gmail.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: object is not iterable.

2010-05-14 Thread Gonzalo Delgado
El 14/05/10 18:00, Niels escribió:
> In my template this error  occurs:
>
> Caught an exception while rendering: 'Gallery' object is not iterable
>
> It occurs in this part:
> {% for image in car.images %}
>
>
> Where my models looks like:
>
> from photologue.models import Gallery,Photo
> ...
> class CarDetail(models.Model):
> images = models.ForeignKey(Gallery, null=True, blank=True)
>   

Ah, nevermind my previous response. A foreign key won't be iterable. I
will give you only one object (a Gallery instance in this case).
You may want to use ManyToMany instead of ForeignKey.

-- 
Gonzalo Delgado <gonzalo...@gmail.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: object is not iterable.

2010-05-14 Thread Gonzalo Delgado
El 14/05/10 18:00, Niels escribió:
> In my template this error  occurs:
>
> Caught an exception while rendering: 'Gallery' object is not iterable
>
> It occurs in this part:
> {% for image in car.images %}
>
>
> Where my models looks like:
>
> from photologue.models import Gallery,Photo
> ...
> class CarDetail(models.Model):
> images = models.ForeignKey(Gallery, null=True, blank=True)
>   

When car.images is null (which is allowed by your model definition) it
is not iterable.
Try something like:


{% if car.images %}
  {% for image in car.images %}



-- 
Gonzalo Delgado <gonzalo...@gmail.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: open()

2010-03-03 Thread Gonzalo Delgado
El 03/03/10 10:45, zubin71 escribió:
> >From a method defined in a view i need to get the source of an html
> file in the templates directory. This is how i tried it out. An error
> occurs at the line,
>
> f = open(os.path.join(os.getcwd(), '../templates/test.html'), 'r') ;
>
> However, this causes an error, "File or directory not found".
>
> What do i do? Please help.
>   

Obviously the path returned by os.path.join(os.getcwd(),
'../templates/test.html') is wrong, but if the file is in the templates
directory you can fetch its contents using Django's template module
render_to_string function:

from django.template.loader import render_to_string
contents = render_to_string('test.html', {})

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Serving https with runserver

2010-03-01 Thread Gonzalo Delgado
El 01/03/10 08:18, Adnan Sadzak escribió:
> Then maybe web server is the best option. In all cases you have to
> configure something until someday 'runserver' come with ssl support.

It doesn't seem like that day will ever come:

"""
DON'T use this server in anything resembling a production environment.
It's intended only for use while developing. (*We're in the business of
making Web frameworks, not Web servers*.)
"""
(
http://docs.djangoproject.com/en/1.1/intro/tutorial01/#the-development-server
)

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Serving https with runserver

2010-03-01 Thread Gonzalo Delgado
El 01/03/10 07:07, cool-RR escribió:
> Adnan, I'm really baffled by your response. No, my reasons for using
> SSL here is not because I'm afraid someone will sniff my data, We are
> talking here about `runserver`, which is the development server which
> is never used for production. The goal of `runserver` is to be able to
> easily test how your Django project behaves before you upload it to
> the real server. 
 
While it may sound so, the development server isn't really intended to
test *exactly* how a Django project behaves before uploading it to a
production server. There are a couple of cases where it will always fall
short, like serving static media or using SSL. It also can't help you
much to test how a site behaves with a big number of requests per second.
For those cases a staging[0] server is used, which is a copy of the
production server but for testing how the site behaves under certain
conditions or with new features, etc.

[0] http://en.wikipedia.org/wiki/Staging_site

-- 
Gonzalo Delgado <gonzalo...@gmail.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: schema migration

2010-02-24 Thread Gonzalo Delgado
El 24/02/10 09:16, dj_vishal escribió:
> plz suggest me which is the better one for the schema
> migration for django apps
>   

http://south.aeracode.org/

-- 
Gonzalo Delgado <gonzalo...@gmail.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: mouse events and view.py

2010-02-20 Thread Gonzalo Delgado
El 20/02/10 19:11, gintare escribió:
> Is it possible with python or i need java script?
You need javascript.

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Any CRM based on django?

2010-02-19 Thread Gonzalo Delgado
El 19/02/10 06:58, Massimiliano della Rovere escribió:
> Does anybody here know any CRM based on django?

http://tinyurl.com/ygcl4fw

-- 
Gonzalo Delgado <gonzalo...@gmail.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: A model's property in a form?

2010-02-18 Thread Gonzalo Delgado
El 18/02/10 10:18, Boris Schaeling escribió:
>
> This replaces the setter but not the getter.

To replace the getter, you'd have to override the modelform's __init__
method and set the corresponding field value from the instance getter.

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Django Mailing List Manager

2010-02-08 Thread Gonzalo Delgado
El 08/02/10 18:04, gregory.para...@gmail.com escribió:
> Does anyone know of any good email list managers in Django? Even just
> a simple app for a coming soon page that would take users email
> address and let you email them with updates would be great.
>   

You may want to take a look at Lamson[0] for building something like
that or Librelist[1] for something already built. They're not Django
apps, but they sure are Django friendly ;)

[0] http://lamsonproject.org/
[1] http://support.librelist.com/index

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Site wide configuration in admin

2010-02-06 Thread Gonzalo Delgado
El 06/02/10 10:11, Matt escribió:
> I'd like to provide site wide configuration settings in the admin
> panel.
>
> I'd like users to be able to edit things like the front page text and
> specify a featured event (represented by a model).
>
> How can this be achieved?
>   
Try livesettings: http://bitbucket.org/bkroeze/django-livesettings/overview/

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Django or CMS.

2010-02-05 Thread Gonzalo Delgado
El 05/02/10 09:09, Rob B (uk) escribió:
> The design agency I work for are looking into CMS options.  Being a
> Django man myself I'm hoping to convince them to build one using
> Django.
>
> Requirements are roughly:
>
> Page control (creation/drafts/published/withdrawn/deletion)
> Page revisions
> View draft pages on site for testing
> In-place editing for simple text updates
> Categories
> Editable Navigation
> Wysiwyg editors
> Image upload (mass select)
> Tagging (pages, images, clients)
> Smart site search
> Limiting user publishing rights
>
> I can't seem to find a decent CMS that would fit the criteria.  What
> are people's opinions / experiences with CMS'?  What would you
> recommend?  Thanks
>   

I have little experience with CMSs myself, where I work we face some of
the requirements you mention and we pretty much build what would be
specialized CMSs using Django and opensource Django apps.

I can suggest you take a look at these links:

http://code.djangoproject.com/wiki/CMSAppsComparison
http://pinaxproject.com/


Best!

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Ajax with Django

2010-02-04 Thread Gonzalo Delgado
El 04/02/10 18:19, Rohan Shah escribió:
> Any good documentation available on how to implement AJAX with Django ? 
http://lmgtfy.com/?q=django+ajax=1

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Any clues on error importing middleware?

2010-02-02 Thread Gonzalo Delgado
El 02/02/10 08:33, phoebebright escribió:
> But fields is not mentioned in the middleware:
>
> from libs.utils import  changehat
> class CheckScopeMiddleware:
> """
> if there is a hat in the GET then swithc to that hat (if
> different)
> """
> def process_request(self, request):
>
>   if 'hat' in request.GET:
>if request.GET['hat'] != request.session['hat']:
>hatcontext = changehat(request, request.GET['hat'])
>
>   

How about in the "changehat" module, is "fields" not mentioned there
either (or in a module it imports, and so on)?

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Feed not available - Syndication - Django 1.1.1

2010-01-22 Thread Gonzalo Delgado
El 22/01/10 07:31, Kenny Meyer escribió:
> I'm trying to generate some feeds for my blog with Django's high-level
> Syndication Framework. 
> My problem is, when browsing to the URL defined in the ``link``
> attribute of the ``syndication.Feed`` model, there's no Feed
> generated/displayed.
>   
The link attribute is just what will show in the feed markup as.. well..
the feed's link, doesn't
necessarily have to be the subscription url. You usually want to set it
to the url for that content in your site. Look at Django's community
aggregator feed:



  
The Django community aggregator
http://www.djangoproject.com/community/
...

While the link attribute is http://www.djangoproject.com/community/ ,
the feed's url is actually http://www.djangoproject.com/rss/community/

> If not clear what I'm trying to say, please read details on the bottom
> of this message.
>
> Here's my code:
>
> apps/blog/feeds.py:
>
> from django.contrib.syndication.feeds import Feed
> from blog.models import Post
>
> class LatestPosts(Feed):
> """Returns a Feed object with the 5 latest blog posts"""
> link = "/blog/"
> title = "Latest Blog Posts"
> description = "Latest blog posts from the Paraguayan Geek."
>
> def items(self):
> return Post.objects.order_by('-date')[:5]
>
> apps/blog/urls.py: [shortened]
>
> feeds = {
> 'latest': LatestPosts,
> }
>
> urlpatterns = patterns(
> '',
> (r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed',
>{'feed_dict': feeds},)
> )
>
> ---
> OBSERVATION
> ---
>
> I access the feed with http://localhost:8000/blog/feeds/latest/ and it
> works just fine. Displays the latest articles with title and
> description.
>   

That's the subscription URL you have to use.

> ---
> PROBLEM
> ---
>
> Now as mention earlier, when browsing to http://localhost:8000/blog/
> there's no option for subscribing to the feed.
> I've compared a lot of configurations and I cannot see the problem.
>   

Well, isn't that something you'd define yourself? Or what do you mean by
"option for subscribing to the feed"?


-- 
Gonzalo Delgado <gonzalo...@gmail.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: django-sproutcore

2010-01-19 Thread Gonzalo Delgado
El 19/01/10 08:49, Sam Barnes escribió:
> I've spent a several hours trying to figure out how to connect it all
> together but can't quite figure it out. The code looks usable but
> there's no documentation...
>   

Not familiar at all with django-sproutcore (or sproucore itself), but
googling a bit turns out this:

http://code.google.com/p/django-sproutcore/wiki/BasicTutorial

Possibly outdated, but it's better than nothing.

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Linked list of abstract objects

2010-01-18 Thread Gonzalo Delgado
El 18/01/10 05:26, Kerrick escribió:
> I'm trying to implement a linked list of abstract objects in my
> models.py; however, it is throwing an error.
> --activenotes/models.py--
> class Element(models.Model):
> class Meta:
> abstract = True
> prev = models.OneToOneField('Element', null=True, blank=True)
> next = models.OneToOneField('Element', null=True, blank=True)
>
> class Text(Element):
> contents = models.TextField()
> --end--
> --output of python manage.py syncdb--
> Error: One or more models did not validate:
> activenotes.text: 'prev' has a relation with model Element, which has
> either not been installed or is abstract.
> activenotes.text: 'next' has a relation with model Element, which has
> either not been installed or is abstract.
> --end--
> How can I rectify the problem?
>   
Try using 'self'[0] instead of 'Element', as in:

prev = models.OneToOneField('self', null=True, blank=True)

This will probably fail too. In that case, make sure to use the
related_name[1] option in the field definition.

[0]
http://docs.djangoproject.com/en/1.1/ref/models/fields/#recursive-relationships
[1]
http://docs.djangoproject.com/en/1.1/ref/models/fields/#django.db.models.ForeignKey.related_name

-- 
Gonzalo Delgado <gonzalo...@gmail.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: multiple database on django please helpme..

2010-01-12 Thread Gonzalo Delgado
El 12/01/10 11:02, Shawn Milochik escribió:
> This will help you get help:
>
> http://catb.org/~esr/faqs/smart-questions.html
>   

+1

-- 
Gonzalo Delgado <gonzalo...@gmail.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: Namespace Security

2010-01-12 Thread Gonzalo Delgado
El 11/01/10 13:46, Tim escribió:
> There is an interesting requirement in a project I am working on. For
> lack of a better term, I'll call it Namespace Security. Basically,
> there are arbitrary namespaces that can be defined, and every object
> belongs to a namespace. Then, users only have access to certain
> namespaces. So if a user has "add/change/delete course", he/she would
> only be able to perform those actions on the namespace that he/she has
> access to.
>
> Basic models would look like this. Then any additional models just add
> the ForeignKey to Namespace.
>
> model Namespace(models.Model):
> name = models.CharField()
> users = models.ManyToManyField("auth.User")
>
> model Course(models.Model):
> namespace = models.ForeignKey(Namespace)
>
> If a user has "add course" permission, and access to NamespaceA, he
> can add a course to that namespace, but would not be able to add a
> course to NamespaceB.
>
> The issue is getting Django admin to recognize this. Has anyone seen
> or done anything like this? I have a few ideas where to begin, but
> figured I would ask first so I don't end up re-inventing the wheel if
> something has already been started.
>   

I'm facing similar requirements and came across this app:

http://packages.python.org/django-authority/

but haven't tried it out yet.

--
Gonzalo Delgado <gonzalo...@gmail.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: Django with embedded python - module error

2010-01-11 Thread Gonzalo Delgado
El 10/01/10 18:06, Wim De Hul escribió:
> I'm trying to use Django in an embedded python app (main program is in C).
> When I try to import the models from my Django app, I get the following error:
>
> Traceback (most recent call last):
>   File "/data/mytest/test.py", line 4, in 
> from accounts import models
>   File "/data/dj/accounts/models.py", line 1, in 
> from django.db import models
>   File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 41, in 
> 
> backend = load_backend(settings.DATABASE_ENGINE)
>   File "/usr/lib/pymodules/python2.6/django/db/__init__.py", line 22, in 
> load_backend
> return import_module('.base', backend_name)
>   File "/usr/lib/pymodules/python2.6/django/utils/importlib.py", line 35, in 
> import_module
> __import__(name)
> ImportError: No module named mysql.base
>
> This is my sys.path:
>
> ['/data/mytest', '/data/dj', '/data/dj', '/usr/lib/python2.6', 
> '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', 
> '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', 
> '/usr/lib/python2.6/dist-packages', '/usr/lib/pymodules/python2.6', 
> '/usr/lib/pymodules/python2.6/gtk-2.0', 
> '/usr/local/lib/python2.6/dist-packages']
>
>
> And this is the mysql module:
> r...@lab:/data# ls -l /usr/lib/pymodules/python2.6/django/db/backends/mysql/
> total 40
> lrwxrwxrwx 1 root root52 2009-12-27 15:12 base.py -> 
> /usr/share/pyshared/django/db/backends/mysql/base.py
> -rw-r--r-- 1 root root 12169 2009-12-27 15:13 base.pyc
> lrwxrwxrwx 1 root root54 2009-12-27 15:12 client.py -> 
> /usr/share/pyshared/django/db/backends/mysql/client.py
> -rw-r--r-- 1 root root  1581 2009-12-27 15:13 client.pyc
> lrwxrwxrwx 1 root root56 2009-12-27 15:12 creation.py -> 
> /usr/share/pyshared/django/db/backends/mysql/creation.py
> -rw-r--r-- 1 root root  2939 2009-12-27 15:13 creation.pyc
> -rw-r--r-- 1 root root 0 2009-12-27 15:13 __init__.py
> -rw-r--r-- 1 root root   152 2009-12-27 15:13 __init__.pyc
> lrwxrwxrwx 1 root root61 2009-12-27 15:12 introspection.py -> 
> /usr/share/pyshared/django/db/backends/mysql/introspection.py
> -rw-r--r-- 1 root root  4699 2009-12-27 15:13 introspection.pyc
> lrwxrwxrwx 1 root root58 2009-12-27 15:12 validation.py -> 
> /usr/share/pyshared/django/db/backends/mysql/validation.py
> -rw-r--r-- 1 root root  1901 2009-12-27 15:13 validation.pyc
> r...@lab:/data#
>
>
> Everything seems OK for me... Django runs from Apache.
> Someone has an idea?
>   

MySQLdb[0] missing? The backend provided by Django depends on that.

[0] http://sourceforge.net/projects/mysql-python/

--
Gonzalo Delgado <gonzalo...@gmail.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: Jobs for DJango newbies?

2009-12-10 Thread Gonzalo Delgado
El Wed, 9 Dec 2009 21:23:20 -0600
Kenneth McDonald <kenneth.m.mcdon...@sbcglobal.net> escribió:

> Where would one find such beasties? Once I've taught myself Django,  
> I'd like to think I might be able to get some sort of job with it,  
> albeit a very junior one.

If you're an experienced programmer, but a Django newbie, I think there's a
good chance for you on any Django job offering. In that case I suggest you try
DjangoGigs[0].

If you don't have much experience programming you can try starting a tiny
project of your own and/or joining a small free (as in freedom) software
project that uses Django. For that you should go to Google Projects[1],
Bitbucket[2], Launchpad[3], Github[4], etc.

[0] http://djangogigs.com/
[1] http://code.google.com/hosting/search?q=django=Search+projects
[2] http://bitbucket.org/repo/all/?name=django
[3] https://launchpad.net/+search?field.text=django-
[4] http://github.com/search?type=Repositories=python=django
-- 
Gonzalo Delgado <gonzalo...@gmail.com>
http://gonzalodelgado.com.ar/


pgpdQBeZVm1Er.pgp
Description: PGP signature


Re: Django application source code

2009-11-15 Thread Gonzalo Delgado
El Sat, 14 Nov 2009 22:16:22 -0800 (PST)
sanju m <sanjuf...@gmail.com> escribió:

> Please share any simple Django application source code with AJAX
> support, for reference.

http://lmgtfy.com/?q=django+ajax+example

> I am planing to develop an account managing web application in Django.
> If any one have source code of account managing web application in
> Django, please share with me for reference.

http://lmgtfy.com/?q=django+account+app

:)

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpuuJkdNcUSl.pgp
Description: PGP signature


Re: computed values in templates...

2009-11-10 Thread Gonzalo Delgado
El Tue, 10 Nov 2009 10:31:13 -0800 (PST)
deostroll <deostr...@gmail.com> escribió:

>  Is there a recommended way to do this...?

Yeah: write an instance method in your "Stock" class (model) that returns
exactly that and call it from the template.

Remember: there shouldn't be any data processing in the presentation layer.

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpVGngMDm9rd.pgp
Description: PGP signature


Re: Class definition in the tutorial

2009-11-08 Thread Gonzalo Delgado
El Sun, 8 Nov 2009 08:00:56 -0800 (PST)
Zeynel <azeyn...@gmail.com> escribió:

> I am just learning Object Oriented terminology as I go along.

Not the best idea if you ask me. You should try "wetting your feet" with
simpler stuff first, and reading OOP theory.
That being said, I *guess* you can start out and do a lot of stuff with Django
without giving much thought of object oriented stuff.

Anyway, I'll give you some pointers for your questions:

> Please help me to understand what each word means in the class definition in
> the tutorial http://docs.djangoproject.com/en/dev/intro/tutorial01/ .
> Thank you.
> 
> class => defines a class

http://docs.python.org/tutorial/classes.html
 
> Poll => name of the class? [my guess: this is just a name; it is not
> used in the database?]

Name of the class the example is defining. Django creates a table in the
database wich includes the name "poll" prefixed by the app's name.

> (models.Model): => what is this? [my guess: there is a django class
> called model and that has a subclass called Model and this statement
> says that Poll is a subcalls of Model which is subclass of model?]

Your guess is close, but not quite correct. 'model' is the name of a module
(a .py file containing code), read about that here:
http://docs.python.org/tutorial/modules.html
The rest of your guess is correct   :)

> question => the name of the class variable? [my guess: This is a
> column in the database?]

Your guess is somewhat correct, there will be a column in a database named
"question" as a result from that line of code.
A class variable is something Django uses to make this happen.
 
> models. => what is this?

A Python module. 


> .CharField(max_length=200) => [my guess: this defines the type of the
> data in the column "question"]

Yup, more on that here:
http://docs.djangoproject.com/en/dev/ref/models/fields/#ref-models-fields


Good luck!

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpddNIlYJXZt.pgp
Description: PGP signature


Re: starting a new site with django

2009-09-25 Thread Gonzalo Delgado
El Fri, 25 Sep 2009 15:30:02 -0700 (PDT)
Ronen Gal <srone...@gmail.com> escribió:

> I would like to build a website which sells videos (music lessons).
> The site would include ~50 videos, 150MB each.
> I need some kind of shopping cart, and the ability to recieve payment.
> I also need user accounts, so I can learn my users flavour and offer
> them appropriate videos.
> I need some mailing API, to allow me to send mails to my customers.
> 
> I am sure that there someone have already written most of this
> website.
> User's accounts, shopping cart, paypal and mails all look very
> standard.
> Can you please point me to where can I find code that do all those
> stuff?

I'd take a look at Pinax[0]

> How can I connect that code to a specific hosting server (with a
> specific data base and mail API for instance)?

You're lucky, Django's documentation[1] explains how to connect to a hosting
server!
Not only that, Django provides its own mail API[2]!!!

Good luck with your site!

[0] http://pinaxproject.com/
[1] 
http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index
[2] http://docs.djangoproject.com/en/dev/topics/email/#topics-email
-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpdQ34axVa7t.pgp
Description: PGP signature


Re: Django templated: iterating through fields in a database record

2009-09-22 Thread Gonzalo Delgado
El Mon, 21 Sep 2009 08:43:57 -0700 (PDT)
Paul Lundberg <pfplundb...@gmail.com> escribió:

> Hi:
> I have several Django applications running and I am trying to tidu up
> some code.
> 
> I am trying to make a generic way of viewing a database table on a web
> page using a YUI control.
> 
> I am using the Django template to attempt to create the required
> javascript for the YUI controls.
> 
> I become a bit stuck, in that I can't seem to iterate over the fields
> in a record in a Django template.
> 
> For example I have a project table as follows:
> 
> class projects(models.Model):
> projectName   = models.CharField('Project Name',
> max_length=50, null=False)
> projectDescription= models.TextField('Project Description',
> null=True)
> projectManager= models.CharField('Project Manager',
> max_length=50, null=True)
> projectOwner  = models.CharField('Project Owner',
> max_length=50, null=True)
> projectDate = models.DateField('Project Date',
> null=False)
> projectHidden = models.BooleanField('Project Hidden',
> null=True)
> 
> Then there is a Django view that is used to get the data to render, in
> that I get a list of all the projects:
> 
>  projList = projects.objects.all()
> 
> projList is then passed into the function that renders the page.
> 
> I can go through each record in the projList using:
> 
> {% for projectItem in projList %}
> :
> :
> {% endfor %}
> 
> However I can't seem to go through each field in an individual record
> for example this doesn't work:
> 
> {% for projectItem in projList %}
> {% for fieldval in projectItem.fields %}
> {{fieldval.name }} -:-
> {{ fiieldVal.str }}
> {% endfor %}
> {% endfor %}
> 
> This doesn't cause an error but it doesn't produce any output.

Model instances are not iterable (forms are, they're different type of objects)

> I can access the fields using the field names
> 
> {% for projectItem in projList %}
> {{ projList.projectName }}
> :
> {% endfor %}
> 
> This produces an output but this gets away from the point of making a
> generic function..
> 
> Is this possible? Is this because the fields are not bound to a form's
> fields?
> 
> Any help or advice would be greatly apprecriated!

You could write a method that outputs what you want and call it from the
template.

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpvnWYhmhVwf.pgp
Description: PGP signature


Re: Help customizing the admin functionality

2009-09-21 Thread Gonzalo Delgado
El Mon, 21 Sep 2009 04:58:24 -0700 (PDT)
gustavo <gustavosen...@gmail.com> escribió:

> I am changing from php to python.
> I am building a website to a photographer and I would like to build
> the following functionality: I would like to upload a zip file and
> build a method to explode the photos and build a library.
> 
> I have already created a project and an app with two model classes,
> galery and photo.
> 
> Does anyone would help me with that?

You seem to have started off pretty well, keep going!   :)
Remember: Django's documentation is always there for you:

http://docs.djangoproject.com/

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgp52dkxrGPQ5.pgp
Description: PGP signature


Re: date inside url

2009-09-18 Thread Gonzalo Delgado
El Fri, 18 Sep 2009 05:07:51 -0700 (PDT)
dijxtra <nsko...@gmail.com> escribió:

> I'm sure I'll be hitting my head against the wall when I hear the
> answer, but before I do, I just can't get an idea how to solve this
> although it seems to me that the solution must be trivial. So, here is
> a line from my url patterns:
> 
> url(r'^(?P\d+)/(?P\d+)/(?P\d+)/$', 'day',
> name='day'),
> 
> and here is what I want to put in my template:
> 
> {% url day year={% now "Y"%} month={% now "m"%} day={% now "d"%} %}
> 
> but, ofcourse, I won't put that in my template because you can't have
> tag inside of a tag. Soo, dear ladies and gentelmen, what's the
> obvious solution I'm to blind to see?

You have to have the data available in the context, templatetags only accept
context values as parameters. So I'm guessing the obvious way to do it is
handing what datetime.datetime.now() returns (you'll probably need to convert
it to a string) to the template context from your view.

You could also write a "datetime" context processor to hand current datetime
data to all your templates.

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpeYovwlP0TK.pgp
Description: PGP signature


Re: urls.py to directly call method on instance of FooModel

2009-09-17 Thread Gonzalo Delgado
El Thu, 17 Sep 2009 10:00:22 -0700 (PDT)
IanSR <ijsto...@crystal.harvard.edu> escribió:

> I realize this isn't in typical Django style, but I'd be interested
> any feedback.  The rough idea is outlined below.

It doesn't sound like a good idea since you may end up breaking DRY (by writing
the same bolierplate code for those methods in each of your models; you could
try writing a base class and inheriting, but that can get complicated too
compared to what I'm about to suggest).

You really should take a look at Django's generic views[0]

[0]
http://docs.djangoproject.com/en/dev/topics/generic-views/#topics-generic-views

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpTo39J1DiJg.pgp
Description: PGP signature


Re: django taking data from zimbra

2009-09-17 Thread Gonzalo Delgado
El Thu, 17 Sep 2009 10:47:06 +0200
Massimiliano Bertinetti <mber...@gmail.com> escribió:

> Sorry guys I have a question without answer.. I need to write an
> application that take adressbook and appointent/calendar from zimbra and
> manipulate them and relate on table in a django application.
> 
> For example writing invoice for the contact I have on zimbra.
> 
> I find just very old doc on the zimbra-side, is out-there someone that
> do already something similar?

I'm guessing Zimbra uses LDAP to store that data.
What you need to do is fetch data from LDAP, for that you may use python-ldap:

http://www.python-ldap.org/

Hope it helps.

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpQ7LdN9aq7V.pgp
Description: PGP signature


Re: template modules like joomla

2009-09-15 Thread Gonzalo Delgado
El Tue, 15 Sep 2009 11:38:56 -0400
Randy Barlow <rbar...@americanri.com> escribió:

> > Do you have any example / documentation?
> 
> I don't have a very concrete example, but the high level thinking is
> pretty easy to write out.  Typically, you would store your templates in
> some kind of templates directory on the file system.  This doesn't work
> well for your problem, as you want Admin type people to be able to edit
> the templates, and you might even want some kind of revision control on
> them.
> 
> Instead, you can make a table in your DB in which to stuff the
> templates.  Maybe something like this:
> 
> class WebTemplate(models.Model):
>   template = models.TextField()
>   version = models.PositiveIntegerField(unique=True)
>   # Use this to store which page the template is for, like 'home'
>   page = models.CharField(max_length=)
> 
> When you create your template object, make it from the text in the
> template field, and look for the entry with the highest version.  When
> somebody edits the template, you just create a new instance and
> increment the version number.  Make sense?  If you don't need revision
> control, then you can simplify this, but I think it's pretty simple as is!

Or.. you could just use django-dbtemplates[0].

[0] http://bitbucket.org/jezdez/django-dbtemplates/wiki/Home

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgphfgCNdAEvJ.pgp
Description: PGP signature


Re: Syntax error

2009-09-15 Thread Gonzalo Delgado
El Tue, 15 Sep 2009 12:49:02 +0200
Maksymus007 <maksymus...@gmail.com> escribió:

> {% if gates.forms %}
> 
>     {% for form in gates.forms %}
> 
>         {% if forloop.first %}
> 
>         {% else %}
> 
>         {% endif %}
> 
> 
>     {% endfor $} <<<<<<<<<<<<<<<<<<<<<<<<<<<<< ?
> 
> 
> >> {% else %}
> 
> {% endif %}


-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpybCgIPfG82.pgp
Description: PGP signature


Re: get current URL

2009-09-13 Thread Gonzalo Delgado
El Sun, 13 Sep 2009 17:12:41 -0700 (PDT)
Shuge Lee <shuge@gmail.com> escribió:

> How to get current URL ?

http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path

-- 
P.U. Gonzalo Delgado <gonzalodelg...@fortix.com.ar>
http://gonzalodelgado.com.ar/


pgpcJxfIZ1MCG.pgp
Description: PGP signature


Re: Calculating on generic view

2008-07-08 Thread Gonzalo Delgado
El Tue, 8 Jul 2008 09:15:36 -0700 (PDT)
rocco_s <[EMAIL PROTECTED]> escribió:

> 
> Hi there,
> 
> im very new at Django, and i have a little problem.
> 
> Is there a way to do some calculation on generic views?
> 
> Example: Ich have a table in the db with the columns "distance" and
> "time", and i want to display an html-table with "distance", "time"
> and "km/h" for each row.
> How can i calculate this "km/h"?
> 
> 
> r.
> 

read this:
http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/

especially the "Getting more out of a generic view" part. Hope it helps.

Hope it helps.

-- 
P.U. Gonzalo Delgado <[EMAIL PROTECTED]>
http://djangopeople.net/gonzalo/


pgpot6SShJfO3.pgp
Description: PGP signature


Re: Development environment

2008-06-25 Thread Gonzalo Delgado
El Wed, 25 Jun 2008 23:17:37 +0200
Fernando Rodríguez <[EMAIL PROTECTED]> escribió:

> 
> Hi,
> 
> I'm currently learning django on Ubuntu, but my background is Windows,
> so I'm not a VIM kind of guy. What kind of IDE do you guys use or
> recommend?
> 
> Thanks in advance.  
> 
> 

I used Eclipse+PyDev for a while, but now I'm only using scribes[0], which is
awesome! I love minimalistic software.
Using the console for anything that isn't coding (debugging, testing, version
control) is much better/faster than Eclipse IMHO.

[0] http://scribes.sourceforge.net/

-- 
P.U. Gonzalo Delgado <[EMAIL PROTECTED]>
http://djangopeople.net/gonzalo/


pgp5NLU14nWnU.pgp
Description: PGP signature


Re: Choose the fields for inline editing

2008-06-11 Thread Gonzalo Delgado
El Mon, 9 Jun 2008 17:19:23 -0700 (PDT)
Cliff <[EMAIL PROTECTED]> escribió:

> 
> Hi,
> I really like the inline editing option, but found that sometimes I
> don't want to list all the attributes of an object for inline editing.
> I guess there is a way to do this, but I cannot find it. Really
> appreciate if someone can help me out.
> Thanks
> Cliff

You're probably looking for this:
http://www.djangoproject.com/documentation/model-api/#id4


-- 
P.U. Gonzalo Delgado <[EMAIL PROTECTED]>
http://djangopeople.net/gonzalo/


pgpMf8HiTv4IF.pgp
Description: PGP signature


Re: Total newbie question

2008-06-10 Thread Gonzalo Delgado
El Tue, 10 Jun 2008 08:46:14 -0700 (PDT)
Pedro Cora <[EMAIL PROTECTED]> escribió:

> 
> First of all, sorry if i'm making a question that should appear a lot
> here.
> 
> I'm a webdesigner that knows xhml and css.. and I can READ (but not
> write) in PHP. My question is. Is it possible to learn how to work
> with django? READ and WRITE code? How should I start? Python lessons?
> 
> Regards and sorry for taking your time!
> 

Hi Pedro, I think reading this should help you answer that question:

http://www.djangoproject.com/documentation/templates/

Also, allow me to quote an excerpt from the Django Book (Chapter 4)[1]:

"""
Writing Python code and designing HTML are two different disciplines,
and most professional Web development environments split these
responsibilities between separate people (or even separate
departments). Designers and HTML/CSS coders shouldn’t have to edit
Python code to get their job done; they should deal with HTML.
"""

[1] http://www.djangobook.com/en/1.0/chapter04/

-- 
P.U. Gonzalo Delgado <[EMAIL PROTECTED]>
http://djangopeople.net/gonzalo/



pgpqLmJBDV0Ca.pgp
Description: PGP signature


Re: Django experts wanted

2008-05-19 Thread Gonzalo Delgado
El Mon, 19 May 2008 11:46:38 -0500
"James Bennett" <[EMAIL PROTECTED]> escribió:

> 
> On Mon, May 19, 2008 at 10:56 AM, Jim R. Wilson <[EMAIL PROTECTED]> wrote:
> > I am compiling a contact list of Django experts who may be interested
> > in opportunities under the right circumstances.  I am not a recruiter
> > - I'm a regular developer who sometimes gets asked for referrals when
> > I'm not personally available.
> 
> The site you're looking for is djangogigs.com.
> 

 Also, djangopeople.net

-- 
P.U. Gonzalo Delgado <[EMAIL PROTECTED]>
http://djangopeople.net/gonzalo/


pgpQlGIf9AcRj.pgp
Description: PGP signature


Re: TemplateSyntaxError when moving from 0.96.1 to SVN

2008-04-14 Thread Gonzalo Delgado
El Sun, 13 Apr 2008 19:42:19 -0300
"Ramiro Morales" <[EMAIL PROTECTED]> escribió:

> 
> On Sun, Apr 13, 2008 at 7:36 PM, Gonzalo Delgado
> <[EMAIL PROTECTED]> wrote:
> > Hi there, I'm trying to move my django projects to  0.97-pre (trunk). The 
> > first error I get is this one (when trying to load the admin interface in a 
> > small project):
> >
> >  TemplateSyntaxError at /admin
> >  Template u'admin/base_site.html' cannot be extended, because it doesn't 
> > exist
> 
> Are you extending the admin app UI?.

Not at all. "cannot be extended" refers to the first line of the template being 
loaded: {% extends "admin/base_site.html" %}. For some reason Django can't find 
admin/base_site.html. The same happens to every template which inherits from 
other template.

> >
> >  Is there a guide for this kind of migration?
> 
> Yes, take a look at
> 
> http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
> 

I couldn't find anything resembling to my problem there :(

> Regards,
> 
> -- 
>  Ramiro Morales
> 


-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpwqHtkBgQ6Q.pgp
Description: PGP signature


TemplateSyntaxError when moving from 0.96.1 to SVN

2008-04-13 Thread Gonzalo Delgado
Hi there, I'm trying to move my django projects to  0.97-pre (trunk). The first 
error I get is this one (when trying to load the admin interface in a small 
project):

TemplateSyntaxError at /admin
Template u'admin/base_site.html' cannot be extended, because it doesn't exist

Is there a guide for this kind of migration?

Thanks!

-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpNOe1gkT19T.pgp
Description: PGP signature


Re: Django automatic admin creation

2008-02-25 Thread Gonzalo Delgado
El Mon, 25 Feb 2008 04:12:08 -0800 (PST)
[EMAIL PROTECTED] escribió:

> 
> Hi folks,
> 
> I was trying to automate the creation of the Django admin profile, I
> mean, I have a file with the data for the django admin creation and
> when then I call: python manage.py syncdb < adminsettings.conf
> 
> in the file adminsettings.conf I am giving the right answers but when
> Django asks for the password it simply fails because of some unix
> method which might be verifying if the password is really coming for
> stdin or feeded from a file...
> 
> Do you have any way of automating this?
> 
> 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
> -~--~~~~--~~--~--~---
> 

expect[0] should do the trick. Although there has to be a more 'pythonic' way.


[0] http://expect.nist.gov/

-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpNTX3NWnfDk.pgp
Description: PGP signature


Re: newforms ModelChoiceField queryset

2007-11-06 Thread Gonzalo Delgado
El Tue, 06 Nov 2007 10:28:39 -0800
Chris Brand <[EMAIL PROTECTED]> escribió:

> 
> Gonzalo Delgado wrote:
> >
> >  The question is: why doesn't something like this work:
> >
> > ticketform.fields['server'].queryset = 
> > Server.objects.filter(users=request.user)
> > ?
> >  It doesn't end up on any error, but the rendered form doesn't filter out 
> > the server choices.. any clue?
> >
> >   
> Sounds like you're hitting bug 4787 
> (http://code.djangoproject.com/ticket/4787), where the change in 
> queryset on the field doesn't get propagated to the widget. You can work 
> around by assigning to the widget's choices directly :
> ticketform.fields['server'].widget.choices = 
> ticketform.fields['server'].choices
> (after changing the field's choices, obviously)
> 
> Chris
> 

 Smelled like a bug.. thanks Chris! :)

-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpfN5WqhEDGa.pgp
Description: PGP signature


newforms ModelChoiceField queryset

2007-11-06 Thread Gonzalo Delgado
Hello there,
  I'm using Django 0.96 here. I've got a couple of models 
related by a ForeignKey that look more or less like this:

 class Server(models.model):
 name = models.CharField(maxlength=20)
 users = models.ManyToManyField(User)

 class Ticket(models.model):
 desc = models.TextField()
 server = models.ForeignKey(Server)


 Then, I define a form to load tickets:

 from django import newforms as forms

 class NewTicket(forms.Form):
 desc = forms.CharField(widget=forms.Textarea())
 server = forms.ModelChoiceField(queryset=Server.objects.all())

OK then, what I want to do is filter the servers in the form according to the 
current user (request.user). The only way I've been able to do this (so far) in 
a view is this:

serversbyuser = Server.objects.filter(users=request.user)
ticketform = NewTicket()
ticketform.fields['server'] = 
forms.ModelChoiceField(queryset=serverbyuser)

 The question is: why doesn't something like this work:

ticketform.fields['server'].queryset = 
Server.objects.filter(users=request.user)
?
 It doesn't end up on any error, but the rendered form doesn't filter out the 
server choices.. any clue?

 Regards.

-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpkCM10etD0q.pgp
Description: PGP signature


Re: CSS problem

2007-11-01 Thread Gonzalo Delgado
El Thu, 01 Nov 2007 10:13:13 -
Goutham DL <[EMAIL PROTECTED]> escribió:

> 
> Hi,
> 
> Iam new to django. Iam having problems loading css files (and images)
> using the development server. Is it possible to load css files in the
> development server or should i use mod_python?
> (since iam a newbie to mod_python also i prefer using the development
> server for sometime)
> 
> Goutham
> 
 

http://www.djangoproject.com/documentation/0.96/static_files/


-- 
Gonzalo Delgado <[EMAIL PROTECTED]>


pgpgJU7MKhjNx.pgp
Description: PGP signature


Problems with XMLField+Jing

2007-10-02 Thread Gonzalo Delgado
Hello there, I'm using an XMLField in one of my models. I've downloaded
jing for compilation with gjc from
http://www.thaiopensource.com/relaxng/jing.html (I got the link from
Djano documentation), compiled it and installed it fine. But when I
create a new object  from that model, using the  admin interface (Django
0.96) I get:

 | Traceback (most recent call last):
File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in
get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File
"/var/lib/python-support/python2.5/django/contrib/admin/views/decorators.py"
in _checklogin
  55. return view_func(request, *args, **kwargs)
File
"/var/lib/python-support/python2.5/django/views/decorators/cache.py" in
_wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File
"/var/lib/python-support/python2.5/django/contrib/admin/views/main.py"
in change_stage
  325. errors = manipulator.get_validation_errors(new_data)
File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in
get_validation_errors
  59. errors.update(field.get_validation_errors(new_data))
File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in
get_validation_errors
  362. self.run_validator(new_data, validator)
File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in
run_validator
  352. validator(new_data.get(self.field_name, ''), new_data)
File "/var/lib/python-support/python2.5/django/oldforms/__init__.py" in
isValidXML
  1013. v(field_data, all_data)
File "/var/lib/python-support/python2.5/django/core/validators.py" in
__call__
  539. ignored, line, level, message = error.split(':', 3)

  ValueError at /admin/servidores/software/1/
  need more than 3 values to unpack



Guys at #django told me that this means that django expected a different
output format from jing. How can this be solved? Is there another
location to download jing from (I haven't been able to find an Ubuntu
package up to now).

 Thanks.

PS: That ValueError doesn't happen from a python shell though.
|

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

begin:vcard
fn:Gonzalo Delgado
n:Delgado;Gonzalo
org:Fortix
email;internet:[EMAIL PROTECTED]
tel;work:+543814237797
tel;home:+543814243587
tel;cell:+3815183731
x-mozilla-html:FALSE
version:2.1
end:vcard