You can use the shell.
Run python manage.py shell within your project path.
Import your model:
from app.models import foo
f = foo( bar=2 )
f.save()
now you can check all the variables you want. f.id returns the id of
the new created object.
On Aug 9, 1:29 pm, "Lic. José M. Rodriguez Bacallao"
Vincent Foley ha escrito:
> Hello,
>
> I work for a company who develops web sites and web applications for
> clients in Quebec. People in Quebec mainly speak french, but there
> are english speaking people too. Most sites we make eventually want
> to have a french and english version with
Hi,
When I update a register that has a ImageField, the old file is not
deleted from the disk, so I have created a custom save method like
this:
def save( self ):
path = self.get_foto_filename()
delete_file(path)
super(Perfil, self).save()
But path is set to the new
Hello, I'm writing an application for publishing news, one of the
fields is:
author = models.CharField( maxlength=100)
I want that that field is filled automatically when someone add a new
from the administration zone.
Is there any way of defining a default parameter with the username who
is
I think I found the answer here:
http://www.b-list.org/weblog/2006/11/02/django-tips-auto-populated-fields
Grupo Django ha escrito:
> Hello, I'm writing an application for publishing news, one of the
> fields is:
> author = models.CharField( maxlength=100)
>
> I want
Hello, I'm preparing a search form to perform searches against the db
(Postgre ).
well, Imagine the form with a category field, and a words field.
My view is something similar to this:
def my_view( request ):
items = a_model.objects.all()
if request.GET:
...
if
Yes sorry, In this example I didn't realize about that, but in my code
I have Q objects.
I wrote it very quick.
On 21 ago, 10:27, Collin Grady <[EMAIL PROTECTED]> wrote:
> That probably isn't what you want, though it will work (technically
> speaking)
>
> The way you're doing it, that's going
This is not a django related problem, but I thought that maybe someone
could help me.
I have a Debian 4 server with apache2, modpython 3.3., python2.4 and
python2.5
PYthon 2.4 is required by Debian to solve some dependency problem, I
have just installed python2.5 and made it the default
Hello, I'd like to know if there is some way for reutilizing a view.
In my case, I have an application to show some data, but I want to
show the same data in the front page, among other data from other
models.
Well, I have figured out this method:
def myview(request, returnHTTP=True):
t =
recompile your apache/mod-python. When you
> > compile the mod-python you'll need ro inform the python path
> > that you want to use.
>
> > Grupo Django escreveu:
>
> > > This is not a django related problem, but I thought that maybe someone
> > > c
xtra options to
> view
> functions in url_dispatch.txt).
>
> Here's a quick rewrite for the records:
>
> def myview(request, *args, **kwargs):
> if kwargs['returnHttp']:
># do stuff here
>...
>
> Cheers,
>
> Etienne
>
> On Wed, 29 Aug 2007 04:0
; Hash: SHA1
>
> You're welcome, and thanks for the Spanish tip..
>
> (I thought entrada was the appropriate word for front door,
> but my Spanish skills arent very sharp..)
>
> Have to go catch a bus now.. =]
>
> Gracias,
> Etienne
>
> On Wed, 29 Aug 2007 05:45
Hi!
I'm trying to create a generic form template for a custom admin zone.
I'm doing it this way:
http://www.djangoproject.com/documentation/newforms/#complex-template-output
But I need to modify the output depending of the field type.
It's easy to add a javascript calendar in a DateField if you
Maybe it could help you.
>
> On 31 mar, 13:46, Grupo Django <[EMAIL PROTECTED]> wrote:
>
> > Hi!
> > I'm trying to create a generic form template for a custom admin zone.
> > I'm doing it this
> > way:http://www.djangoproject.com/documentation/newforms/#comp
Hello,
I have this template code:
{% block title %}{% endblock %}
And I get the error: 'block' tag with name 'title' appears more than
once.
What could I do to make this work?
I have this in all my templates:
{% extends index.html %}
{% block title %}Here the title{% endblock %}
Thank you.
HI,
I'm trying to make a custom Q-like object as Malcolm recommended me. I
have this code:
class FT:
def add_to_query( self, query, used_aliases ):
select={
'rank': "ts_rank_cd(tsv, query, 32)",
}
query.add_extra( select,None,('tsv @@
Hello,
I'd like to know the status in the newforms-admin branch, I have seen
the todo list:
http://code.djangoproject.com/query?status=new=assigned=reopened=%7Enfa-blocker=priority
but it would be great the current state (80%,90%...). The reason I'm
starting a new project and newforms admin
On 2 jun, 00:26, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> Grupo Django wrote:
> > When newforms-admin is merged to the trunk, what will happen with all
> > the sites that are currently using the current admin application? It's
> > completely different. Should we
Hi! Just a simple question.
The Form Wizard application stores the data hashed in hidden fields.
Why not in a session? Why is it better? I just want to learn best
practices.
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
On 7 jun, 00:05, Grupo Django <[EMAIL PROTECTED]> wrote:
> Hi! Just a simple question.
> The Form Wizard application stores the data hashed in hidden fields.
> Why not in a session? Why is it better? I just want to learn best
> practices.
>
> Thank you.
Another quest
storage of the final result of the form submission (ie encrypted credit
> card numbers).
>
> The line is always a bit fuzzy, but basically store state in hidden
> fields as a first resort unless you really need to allow the user to
> leave the form in which case store state in a c
Hello,
In a view, I have:
from app.models import something
def my_view( request, mod_name ):
m = __import__('app.models',globals(),locals(),['something'] )
Now I'd like to do:
items = m.filter( ... )
for item in items:
...
What I need is to load a model dynamically and then use
Thanks a lot! get _model works.
Only one thing, I've been reading the code in te file django/db/models/
loading.py and I don't understand how it works, and now I need to know
or I won't sleep :-)
What should I do to reference stuff?
app = __import__('app_name',{},{},['models'])
mods =
I figured out this code to get the permissions of a dynamic module:
def my_view( request ):
...
app_label = module._meta.app_label
add_p = app_label+'.'+module._meta.get_add_permission()
chg_p = app_label+'.'+module._meta.get_change_permission()
del_p =
On 17 nov, 01:28, "Ramiro Morales" <[EMAIL PROTECTED]> wrote:
> On Nov 16, 2007 8:18 PM, Grupo Django <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks a lot! get _model works.
> > Only one thing, I've been reading the code in te file django/db/mod
Hello, I'm programing a kind of admin zone for users, where users can
add, manage and delete objects.
I want to do it generic, but I have a big problem now.
Imagine these models:
from django.contrib.auth.models import User
class Library ( models.model ):
library_name = models.CharField(..)
On 20 nov, 20:46, RajeshD <[EMAIL PROTECTED]> wrote:
> From what I understand, you want a generic ability to declare an owner
> item for any model object.
>
> Django's generic relations work that way. Take a look at the examples
> here:
>
>
RajeshD ha escrito:
> From what I understand, you want a generic ability to declare an owner
> item for any model object.
>
> Django's generic relations work that way. Take a look at the examples
> here:
>
> http://www.djangoproject.com/documentation/models/generic_relations/
>
> Specially,
On 20 nov, 21:54, RajeshD <[EMAIL PROTECTED]> wrote:
> > That's interesting, but I think that leaving the models untouched
> > would be better.
> > Do you think there is a different way?
>
> There might be. First, you'd have to explain what you didn't like
> about doing queries like:
>
>
Hello, it seems that when I create this code, doesn't work as
expected.
baseForm = forms.form_for_model( MyModel )
class Form ( baseForm ):
extra_field = forms.CharField()
I'd like to have the fields defined in MyModel and add the
extra_field, but it doesn't work.
Besides, I'd like to have
On 13 ene, 01:24, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Jan 12, 2008 11:04 PM, Grupo Django <[EMAIL PROTECTED]> wrote:
>
>
>
> > IMHO Internationalization is useless if there is no support for
> > multilingual translations in the dat
I can't understand how django.utils.translation.ugettext_noop() is
used for translation, could someone give me an example please?
Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
int in time, such as when the string is presented to the user.
>
> Grupo Django wrote:
> > I can't understand how django.utils.translation.ugettext_noop() is
> > used for translation, could someone give me an example please?
>
> > Thank you!
Yes I read that, but still I don
I have a Menu app that takes data from the database and renders it
into a template. I was wondering if I can translate the output from
the database. There are only a few entries.
Can I add the text that the menu will render that is stored in the db
and add it to the .po file?
How can I do it?
On 16 ene, 20:59, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > I have a Menu app that takes data from the database and renders it
> > into a template. I was wondering if I can translate the output from
> > the database. There are only a few entries.
> > Can I add the text that the menu
On 16 ene, 21:35, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi again,
>
> Please see some questions below:
>
>
>
> > This is the function, I'm sorry it's written in Spanish but I think
> > you can understan what I'm saying
>
> > def items(bloque, padre):
> > if padre == 0:
> >
On 16 ene, 22:21, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> > Hi! Here I answer your questions:
> > I don't have the translations anywhere right now, I'd like to have
> > them in the po file. The menus don't change often, this is the reason
> > I think that it's better to keep translations in
Hello, I need some help to set up an apache+lighthttpd server.
Now I have an apache server serving everything, including the media,
but I'd like to follow the suggestions of the documentation and serve
the media throught lighthttpd.
I only have one server so I must run apache and lighthttpd in
Hello, I'm having a problem using the cache system with different
languages.
I have used the vary_on_cookie decorator in my view:
@vary_on_cookie
@cache_page(60 * 60 * 12)
def my_view(request):
...
I've even test with:
@vary_on_headers('Cookie')
and:
my_view = vary_on_headers(my_view,
Hi,
I need to optimize some code related to django db api.
Imagine a model like this:
class Languages( models.Model ):
name = models.CharField( max_length=255 )
...
class Object ( models.Model ):
name = models.CharField( max_length=255 )
languages = models.ManyToManyField(
This code:
for language in languages:
objects = Object.filter( languages__id = language)
doesn't work, so I'd be happy to receive some suggestions.
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
On 4 mar, 11:40, Evert Rol <[EMAIL PROTECTED]> wrote:
> > I need to optimize some code related to django db api.
> > Imagine a model like this:
>
> > class Languages( models.Model ):
> >name = models.CharField( max_length=255 )
> >...
>
> > class Object ( models.Model ):
> >name =
On 5 mar, 10:52, Grupo Django <[EMAIL PROTECTED]> wrote:
> On 4 mar, 11:40, Evert Rol <[EMAIL PROTECTED]> wrote:
>
>
>
> > > I need to optimize some code related to django db api.
> > > Imagine a model like this:
>
> > > class Langu
On 5 mar, 11:25, Evert Rol <[EMAIL PROTECTED]> wrote:
> >>> I need to optimize some code related to django db api.
> >>> Imagine a model like this:
>
> >>> class Languages( models.Model ):
> >>> name = models.CharField( max_length=255 )
> >>> ...
>
> >>> class Object ( models.Model ):
> >>>
On 5 mar, 12:02, Grupo Django <[EMAIL PROTECTED]> wrote:
> On 5 mar, 11:25, Evert Rol <[EMAIL PROTECTED]> wrote:
>
>
>
> > >>> I need to optimize some code related to django db api.
> > >>> Imagine a model like this:
>
> > >>
Hello, this is not directly related to django, but I'm pretty sure
someone could help me here.
I'm building a complex Web site using Django of course, and I have to
start the documentation this week.
I'd like some suggestions about this.
I want to make the documentation available through the web
On 5 mar, 23:54, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I'm building a complex Web site using Django of course, and I
> > have to start the documentation this week. I'd like some
> > suggestions about this. I want to make the documentation
> > available through the web and a PDF file.
>
>
On 6 mar, 01:54, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Wed, Mar 5, 2008 at 3:52 PM, Grupo Django <[EMAIL PROTECTED]> wrote:
> > These anotations are not 100% real, I've been looking only for a few
> > hours documentation about them, I don't know
Hi!
I need to create a custom user profile, and I was going to do it as
James said in his blog [1], but first I'd like to know how is the
model inheritance going.
Is still the James way the best way to do it?
Thank you.
[1]
I know this is not the right place for asking about python, but it's a
simple question.
I need to load an object given in a string. Example:
#I have a class called foo
class foo:
def Hello():
return "Hello World"
object = 'foo'
print object.Hello()
Something like this.
Is it
Thank you!
What I'm doing is to load a model from a template.
I have in a template something like this:
{% block menu %}
{% block rss %}
I want to load "menu" and "rss", but I think that is too much work for
now, I have no idea how to implement it and I probably won't do it.
Thank you very much
Hello!
I was building a gallery image, and everithing went fine with mysql,
but lately, I changed my mind and I changed the database to postgres,
it's the django recommendation.
Well, sudenly I got this message:
ProgrammingError?: ERROR: current transaction is aborted, commands
ignored until end
','media/fotos/')
I'm gonna check what you said about referential integrity. I'll post
again if I solve it and if I don't.
On 15 abr, 08:48, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On Apr 15, 1:46 am, "Grupo Django" <[EMAIL PROTECTED]> wrote:
>
&
Don't worry! If you are one of the developers, I only have to say
thank you for the excelent job. I really like django.
Just a question:
When will it be available in the trunk?
On 20 abr, 16:53, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-04-20 at 07:44 -0700, Gru
Hello, I think that the atom feeder is not working properly.
The subtitle item is not shown.
Here is the code:
class UltimasNoticias(Feed):
feed_type = Atom1Feed
description_template = "noticias/sindicacion_resumen.html"
title = "Title of my site"
link = "http://www.mysite.com/;
I'm happy to announce that I've released my first site based in
django, I'm very happy, and I want to say thank you to all the people
who made it possible, the django developers, and all the users of this
forum.
The site is:
http://www.universoheroes.com
(The server needs more RAM at this
You are right, I didn't know about add javascript in the model
definition, is good to know it :-)
I was thinking about doing an admin zone using a bit more of Ajax, and
autoload a select widget depending of a previous select... stuff like
that.
First I thought that I could create a second admin
I used to use tinymce too, but it doesn't generate well formed xhtml,
and I found http://www.wymeditor.org/ which looks great, it's still
very simple, but it has a lot of interesting features, and now It'll
become a jquery plugin, and that's great because I use to work with
jquery.
Anyway, I must
Hello, I'm going to start a new multilingual site. I think that the
django tools are very powerful for this purpose, but I need a bit
more.
I have to translate the content from the database and I have a few
options:
- Translate it using the standard way, I mean, using po files.
Problems:
> > - Could it be implemented in futures django releases?
>
> I think something like this could go in django.contrib. But I'm not sure
> how many people need this.
IMHO I think it's quite useful and it would be a great improvement.
Django is so good that it's possible to use it for very
Can you please provide me some document where I can find some
information and examples?
Thank you.
On 31 mayo, 12:11, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> Grupo Django napisał(a):
>
> > Hello, I'm going to start a new multilingual site. I think that the
> > django
Hello, I read that it's possible to add custom javascript to the admin
zone using:
class Admin:
js = (
'/templates/jscripts/admin.js',
)
How can I add a customs stylesheet? I had to do it appending it to the
document, using javascript and the DOM.
Thank you.
Hello, I have set up a cache system, storing the cache data in disk.
I have a kind of static pages, that usually, it never change, but just
in case, I have set a cache for 12 hours.
If I change a page and I need to make the changes visible inmediatly,
I delete the cache file from disk.
Now I'm
I can't afford it right now. I would be good anyway.
In bluehost, they offer me modpython, but i have some questions about
that.
First of all, modpython is running through cgi. As Nathan said, this
would be a a loss of permormance, but what about security? I have read
that with fastcgi, only one
They told me that modpython is running through cgi, I have no idea
about that.
I want that all my objects are privated, and that nobody is able to
see anything from my code.
To be honest, I just read about this, I don't know anything about this
and I'd like to learn.
What is the best in a vps?
Hello, I want to know which of these two databases are prefered by
django. I can choose and I'd like to know if there is some differences
in performance or integration (like foreign keys).
If someone knows a comparative between both of them it would be good,
not only about django integration but
Hello, I have created an app named "menu". I want to build an easy way
of adding items to the menu in the admin zone. I want to render this
menu in every view of others applications (blog, static pages...).
I'd like some suggestions about how to implement it in the template
system.
I thought
Hello, I have created an app named "menu". I want to build an easy way
of adding items to the menu in the admin zone. I want to render this
menu in every view of others applications (blog, static pages...).
I'd like some suggestions about how to implement it in the template
system.
I thought
Hello, I have been looking around about some information about how to
do recursion in templates but what I found didn't help me.
This is the case:
class Menu(models.Model):
id = models.AutoField('id', primary_key=True)
parent = models.ForeignKey('self','id',null=True,blank=True)
Hello!
I want to add a block in the site that shows the "Last topics" of the
forum.
The forum is a MyBB. I'd like to know the best approach to do it.
- Create a model based in the tables that I want to retrieve and use
it as a normal model in django.
- Use pure SQL to do the same.
Thank you!
Hello, I have two questions:
-Where can I browse the django API?
- I have made a news app. One of the fields is author, i want to set
its default value to the username logged in the admin zone. How could
I do it? What do I have to import to use request.username? so I would
do: default=
Thank you for your help!
I think I'll create a form to intorduce the news.
Thank you.
On 10 mar, 08:26, "risomt" <[EMAIL PROTECTED]> wrote:
> Actually, what I said is a bit wrong.
>
> To fill the author field correctly you should use a foreign key that
> points to the User model (again, assuming
Hello, I'd like to know how is the work going with newforms. I don't
want a release date or something like this, just to know how is it
going, and the documentation as well.
I'm programming a website in django and I'd like to know more about
newfors, since I left the forms to the end, but now I
Hi!
I have created a form using newforms, and one field is author which I
want to fill using the current username, I did this:
request.POST['author']="Username I want"
and I got this error:
"QueryDict instance is immutable"
Ok, what should I do? I thought about create a hidden widget for this
Hello, I'm having some problem using newforms. When I introduce a
string with special characters like ñ it just cut it. example:
Añadir
output: A
Does anybody know why?
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
Hello, I have noticed that the field DateField in the newforms library
doesn't validate all right when introducing data.
I have this code:
FormClass = forms.models.form_for_model(Model)
form = FormClass(data)
data = request.POST.copy()
data['author'] = request.user
formulario = FormClass(data)
Hello, I think I have seen some way to fill a select field with data
from a table, but I'm not 100% sure and I can't find it anywhere. Is
it possible?
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
On 15 mar, 19:38, "Rubic" <[EMAIL PROTECTED]> wrote:
> On Mar 15, 10:06 am, "Grupo Django" <[EMAIL PROTECTED]> wrote:
>
> > Hello, I think I have seen some way to fill aselectfield with data
> > from a table, but I'm not 100% sur
Hello, does someone know how can I configure eclipse with pydev
installed to debug django apps.
I just need to watch some variables, dictionaries...
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Ok, I knew that, but I don't know how to check the value of a var
while running the app.
Thank you anyway.
On 17 mar, 19:04, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 3/17/07, Grupo Django <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello, does someone kno
Ok, I got it, sorry for the not-very-intelligent question.
On 17 mar, 19:35, "Grupo Django" <[EMAIL PROTECTED]> wrote:
> Ok, I knew that, but I don't know how to check the value of a var
> while running the app.
> Thank you anyway.
>
> On 17 mar, 19:04, "Kar
Does Django support referential integrity?
--~--~-~--~~~---~--~~
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,
Thank you very much both of you!
On 19 mar, 20:32, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 3/19/07, Grupo Django <[EMAIL PROTECTED]> wrote:
>
>
>
> > Does Django support referential integrity?
>
> Django does its best to emulate
I have written a custom tag.
Here is the code:
register = template.Library()
def bloque_menu(posicion):
def items(bloque, padre):
entradasMenu = bloque.menu_set.filter(padre = padre,visible=1)
salida=""
if entradasMenu:
Hi, I need to know how can I access data stored in the session out of
a view.
I have created a custom template tag which has to check a variable
stored in the request.session. It's strictly necessary to store the
data in a session variable at this moment.
Inside the custom template tag, I don't
very good.
Thank you.
On 3 abr, 23:37, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 4/3/07, Grupo Django <[EMAIL PROTECTED]> wrote:
>
> > Inside the custom template tag, I don't get the request object since
> > it's not a view.
>
> Look into
86 matches
Mail list logo