Hi,
Try this:
class Entry(models.Model):
...
tags = models.ManyToManyField( Tag )
class Tags(self):
return self.tags.all()
class Tag(models.Model):
...
And now, Entry.Targs() returns all Tags related to the blog entry.
Regards,
Marcin
On Dec 13, 8:54 am, "Young Gyu Park" <[EMAIL
Ye. It works.
But when I work with generic view such as update insert, how can I work with
this code?
On Dec 13, 2007 5:04 PM, Marcin Mierzejewski <[EMAIL PROTECTED]>
wrote:
>
> Hi,
>
> Try this:
>
> class Entry(models.Model):
> ...
> tags = models.ManyToManyField( Tag )
>
> class Tags(self
What do you mean by "backend"? I just started learning Python two
months ago, and Django a couple of weeks later, so I am unfamiliar
with many of the related terms.
So far, I have found that I have to use sqlite3 just to be able to run
the tests. Annoying, but as long as no real database is invol
It should work.
On Dec 13, 9:32 am, "Young Gyu Park" <[EMAIL PROTECTED]> wrote:
> Ye. It works.
>
> But when I work with generic view such as update insert, how can I work with
> this code?
>
> On Dec 13, 2007 5:04 PM, Marcin Mierzejewski <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Hi,
>
> > Try this
Found the problem. There was another copy of django in the python
framework directory (this was all in OS X). I deleted it and 'ln'd my
trunk directory in its place. Everything seems to work well now.
Thanks to Magus on #django.
Randall
On Dec 13, 2:27 am, DjangoFett <[EMAIL PROTECTED]> wrote:
>
Is this code work?
The class can not return. I think only function can return something.
Can you clear the code to prevent ambiguity
On Dec 13, 2007 5:45 PM, Marcin Mierzejewski <[EMAIL PROTECTED]>
wrote:
>
>
> It should work.
>
> On Dec 13, 9:32 am, "Young Gyu Park" <[EMAIL PROTECTED]> wrote:
On 12 Dec 2007, at 6:52 pm, Nathan Fiedler wrote:
> This topic has come up once or twice before, but it doesn't seem like
> a solution exists. Basically I'm looking for a recommended pattern for
> creating Django models that have no association with a database (i.e.
> "tableless").
This may be
Sorry, it should be:
def Tags(self):
return self.tags.all()
On Dec 13, 10:02 am, "Young Gyu Park" <[EMAIL PROTECTED]> wrote:
> Is this code work?
>
> The class can not return. I think only function can return something.
>
> Can you clear the code to prevent ambiguity
>
> On Dec 13, 2007 5:
Excuse me!!
Would you stop for a moment?!
O...man...Haven't you thought-one day- about yourself ?
Who has made it?
Have you seen a design which hasn't a designer ?!
Have you seen a wonderful,delicate work without a worker ?!
It's you and the whole universe!..
Who has made them all ?!!
You know who
You should explain more about what you are trying to do, and where the
difficulties are. Ticket #419 is about abstract base classes for
table-based models. It sounds like you want a model class that has
nothing to do with tables ever. If the latter is the case, then simply
create a Python c
Hi there,
i haven't been developing my django project for some weeks and so i
continued my work today.
there are three links on the right upper corner of the admin interface
(documentation, change password, logout) but all of them point to
"http://127.0.0.1:8000/admin/"; and nothing happens if i
Hi!
I want to use django with AJP. Inspired by
http://blog.webpragmatix.info/category/python-programming-language/django-web-framework/
and http://john.calixto.net/django_benchmarks.html and the thought of
having two completely separated systems that can run under different
uid's made me couriou
How do forums ie PHPBB and gmail know if I've viewed a topic or not?
I can think of only 2 methods - 1 is session, and the second is
database. However, if I change computers and therefore changing my
session it's still able to ensure track what I've viewed. It
therefore leads me to believe that
Hi Ramon,
As far as I understood the apache jakarta docs, the problem you
describe might be caused by using sethandlers.
Therefore, if you have time for further experiments, you might want to
do either
- set up another virtual host for the static files
(e.g.,media.mysite.com) and avoid using SetHa
On Dec 13, 2007 8:59 AM, Roboto <[EMAIL PROTECTED]> wrote:
>
> How do forums ie PHPBB and gmail know if I've viewed a topic or not?
>
> I can think of only 2 methods - 1 is session, and the second is
> database. However, if I change computers and therefore changing my
> session it's still able to
Hi all!
When I try to use Naming URL patterns I get error:
Exception Type: ImproperlyConfigured
Exception Value:Error while importing URLconf 'locations.urls':
invalid syntax (urls.py, line 13)
Exception Location: /home/sector119/devel/django_src/django/core/
urlresolvers.py i
I use django current trunk, if this info is needed.
On 13 Грд, 16:58, sector119 <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> When I try to use Naming URL patterns I get error:
> Exception Type: ImproperlyConfigured
> Exception Value:Error while importing URLconf 'locations.urls':
> in
this one solved it:
http://groups.google.com/group/django-users/browse_thread/thread/ed22e4efc279d68d/d72a2e2f79156e01
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
Hello,
I don't know what line is 13 but it seems to me that for the second
urlpatterns should be:
"""
urlpatterns += patterns(
"""
Let me know if this help.
On 13 déc, 15:58, sector119 <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> When I try to use Naming URL patterns I get error:
> Exception Type:
On Dec 13, 2007 9:58 AM, sector119 <[EMAIL PROTECTED]> wrote:
> urlpatterns = patterns('django.views.generic',
> (r'^location/$', 'list_detail.object_list', location_list_info,
> name='locations-location_list'),
> )
In order to name your URLpatterns, you'll need to use the url() function.
ur
Thank you! I miss "url" at the beginning of all patterns :)
On 13 Грд, 17:14, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> On Dec 13, 2007 9:58 AM, sector119 <[EMAIL PROTECTED]> wrote:
>
> > urlpatterns = patterns('django.views.generic',
> > (r'^location/$', 'list_detail.object_list', location
On Dec 12, 2007 10:12 PM, Justin Bronn <[EMAIL PROTECTED]> wrote:
>
> > Should the example still work with the latest svn revision of
> > GeoDjango? The IPython session is pasted below.
>
> Yes, it should work. You found a bug -- I just fixed it in r6916.
The example works perfectly now. Thanks
Hi folks,
In our app, we're building a simple Issue list app, and within the app
we want to add some basic entries for issue type, issue status and
issue severity. Within our /issue directory, I have created a
management.py file and added this:
from django.dispatch import dispatcher
from django
Hi,
>
> from django.dispatch import dispatcher
> from django.db.models import signals
>
> from hgfront.issue.models import *
>
> def init_issues_database():
> """This injects the database with default values for issues"""
> issue_types = (
> ('Bug', 0),
> ('Enhancment', 1)
Is there a way to express != in a database query?
Suppose I have a field 'status' that can take the values 1, 2 or 3. If I
want to select status!=2 I can use exclude(status=2). But for more
complicated conditions this is harder to do. What if I have two status
fields, s1, s2 and I want to sele
Hey Giorgi!
Thanks for your fast help!
I tried your 1st tips with setting other Location directives and all
the combinations but it didn't work.
I checked out ajp-wsgi but it's currently only available for BSD, Mac
OS X and Gentoo. I will just stick with mod_python and maybe give it a
try anoth
Hi There,
I hope this is Ok to post this to this group - I've seen other job ads
here so I'm assuming it is.
DJANGO/Python Developer position (Contract/Permanent)
Oxford, UK (potential to do some telecommuting)
We are currently expanding our in-house team to take forward the
development of an
I think you want filter's evil twin exclude:
http://www.djangoproject.com/documentation/0.96/db-api/#exclude-kwargs
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send e
Hello,
Based on this thread:
http://groups.google.com/group/django-users/browse_thread/thread/fd450734295e450f/68d466b0d6b24eb7
I have the following code for the SplitDateWidget:
class SplitDateWidget(forms.MultiWidget):
def __init__(self, attrs=None):
widgets = (Select(att
Does anyone have an example on how to sub-class a model field so that
setattr pickles the field and getattr unpickles it? I want to shuffle
a query back and forth between the app and the rendered pages. I
could urlencode the query but the URL could get potentially rather
long so I thought I'd sh
Hi Ned,
Thanks for the response. I have found so far that I can create a
simple "model" that has no fields and this seems to be alright during
runtime, I don't need to set up a database. But, to run the tests at
all, I have to set up a database. Thankfully, I can define "sqlite3"
with an arbitrar
On Dec 13, 2007 10:36 AM, Tane Piper <[EMAIL PROTECTED]> wrote:
> dispatcher.connect(init_issues_database, signal=signals.post_syncdb)
This will set up the code to run every single time an application is
installed. Not just the application it resides in, but *every*
application. You want to look
Doug B wrote:
> I think you want filter's evil twin exclude:
I know about exclude() but I don't see how to use it here.
I want s1==1 OR s2!=1, so for example records (s1=1, s2=1) and (s1=2,
s2=2) would be accepted.
filter(s1=1).exclude(s2=1) is s1==1 AND s2!=1; it will not retrieve
either of
Derek,
> ...If not, what should I be doing?
For one of my projects I import data from a non-django-controlled
database using the MySQLdb python library, populate a django model
object and save it (to my app's django-controlled database table).
Works smoothly.
http://sourceforge.net/projects/mys
Ken,
There was someone else working on this recently as well, so you might
take a look at the conversation,[1] the beginnings of the code,[2] and
probably contact the author directly to see if you two can't share
ideas. It'd be a shame to duplicate effort. It'd be a great candidate
for a snippet.
Heh, I just picked this up, too! I got the field working almost
straight away after your kind help (all apart from queries, which I
haven't fixed yet as I've been traveling up until this evening)
Anyway, what I have is http://dpaste.com/27955/ which seems to work
fine, all apart from the issue I
Ok, I've modified this slightly, however still cannot get this to
work. To test it, I put a print statement at the top of the function
and called syncdb, and sure enough the function was being called 8
times!
So, I modified it so each import is a function, and each has it's own
dispatcher with a
Oh, I also tried using __setattr__ and __getattribute__ to solve this,
but the problem is that Django's ORM will just (unintentionally) call
__getattribute__ when generating the SQL, thereby unpickling the
object again, which will of course raise a SQL error and defeat the
entire purpose.
To see
Doesn't Django have something very similar inbuilt to newforms?
l5x wrote:
> Hello,
>
> Based on this thread:
> http://groups.google.com/group/django-users/browse_thread/thread/fd450734295e450f/68d466b0d6b24eb7
>
> I have the following code for the SplitDateWidget:
>
> class SplitDateWidget(form
I think you need to use Q objects, which can be OR'd together
http://www.djangoproject.com/documentation/db-api/#complex-lookups-with-q-objects
Or you could just write your own SQL (http://www.djangoproject.com/
documentation/db-api/#falling-back-to-raw-sql)
On Dec 13, 6:00 pm, Kent Johnson <[EM
Hey All,
I've just written a custom model field for storing anything which is
pickle-able (generally this will be used for storing dictionaries). It
all works great, apart from when I want to perform a query on objects
using the field as an argument. When doing something like:
SomeModel.objects.
On Dec 13, 2007 3:11 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Heh, I just picked this up, too! I got the field working almost
> straight away after your kind help (all apart from queries, which I
> haven't fixed yet as I've been traveling up until this evening)
Glad to hear you're makin
> Doesn't Django have something very similar inbuilt to newforms?
You mean: SplitDateTimeWidget
But there is no custom 'value_from_datadict'
See:
http://code.djangoproject.com/browser/django/trunk/django/newforms/widgets.py#L459
--~--~-~--~~~---~--~~
You received
On Dec 13, 2007 2:14 PM, Tane Piper <[EMAIL PROTECTED]> wrote:
> So, I modified it so each import is a function, and each has it's own
> dispatcher with a sender (being IssueType, IssueSeverity and
> IssueStatus) - however when the models are created they don't get
> called. Take the sender away
I would like a little help in trying to figure out why my /now/ web
page
is not working. I am running Django 0.96
I followed all the instructions from the beginning of the book to the
letter as far as I can tell. I have all the files that are required
according to Chapter 2, Starting a project.
I think you need to be using 'fixtures' for this purpose.
http://www.djangoproject.com/documentation/models/fixtures/
e.g. I have an application called common, so I created a xml file
called 'initial_data.xml' in the directory:
apps\common\fixtures
the initial_data.xml looks like:
I do, sorry!
On Dec 13, 8:33 pm, l5x <[EMAIL PROTECTED]> wrote:
> > Doesn't Django have something very similar inbuilt to newforms?
>
> You mean: SplitDateTimeWidget
> But there is no custom 'value_from_datadict'
> See:http://code.djangoproject.com/browser/django/trunk/django/newforms/wi...
--~--
OK, you're spot on there. That'll teach me to evan glance at my own
code before posting my cries for help! (And thanks for the tip about
get_internal_type)
Anyway, now I think I have what is needed, but now I get the following
traceback:-
Traceback (most recent call last):
File "", line 1, in
Even if your simple app dosen't do anything with the database, django
still needs those values populated in the settings.py file as the
applications inside the INSTALLED_APPS requires it.
e.g. by default your settings.py will contain:
INSTALLED_APPS = (
'django.contrib.auth',
'django.con
On Dec 13, 5:18 pm, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Is there a way to express != in a database query?
>
> or mayby
>filter(s1=1, !Q(s2=1))
> but I don't see any way to do this in the docs. Hopefully I am just
> overlooking something!
There is an undocumented class called QNot w
Maybe someone could refresh my memory on this... I could swear I've
done this before ... but cannot find my code.. or anything online
about it.
I know to access all items for a relationship in the templates.. I can
do:
{% for object in someobject.relationname_set.all %}
How do I just access the
what is the type of someobject? is it a dictionary?...in that case you
can do:
{% for object in someobject.items() %}
Jim
On Dec 13, 4:21 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Maybe someone could refresh my memory on this... I could swear I've
> done this before ... but cannot f
Jan Rademaker wrote:
> There is an undocumented class called QNot which resides in
> django.db.models.query.
That is just what I was looking for. Thanks!
Kent
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Djan
The font_size shouldn't be 0, ever. Make sure you've restarted your
web server. The font_size is set with this snippet:
tag.font_size = i + 1
Where i is the index in a list. So it _can't_ ever be 0 if the code is
properly executing.
My font sizing is done like this:
style="fon
I have just setup part of my project for the newforms-admin branch.
All seemed ok. But when i modifiy an object with the admin interface,
the changes do not show neither in admin nor in the public area of the
web. I have to restart the internal django webserver to see the
changes.
Any ideas?
--~-
On Dec 13, 2007 5:46 PM, djnz <[EMAIL PROTECTED]> wrote:
>
> I have just setup part of my project for the newforms-admin branch.
> All seemed ok. But when i modifiy an object with the admin interface,
> the changes do not show neither in admin nor in the public area of the
> web. I have to restart
No..that's not it... it's the backward relations in the models...
So I have one class where
class ObjectTypeB(models.Model):
object_typeb_id = models.AutoField(primary_key=True)
some_property =
some_other_property =
class ObjectTypeA(models.Model):
object_typea_id = models.Aut
Hi there,
I have rearranged the structure of my project and made some minor
changes in the code, and suddenly nothing works at all. Every page of
the site fails and give the error "list index out of range".
In fact, the error is generated each time I do a return
render_to_response("my_template.h
Traceback? Template variables?
--~--~-~--~~~---~--~~
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 [EM
This is in the application from http://code.google.com/p/django-registration/
The code is:
class RegistrationProfile(models.Model):
"""
A simple profile which stores an activation key for use during
user account registration.
Generally, you will not want to interact directly wit
Hi,
There's no template variable, at least for the frontpage.
Here's the traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 0.97-pre-SVN-6917
Python Version: 2.5.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'djang
Oops..sorry my dog jumped on keyboard and posted that in the middle of
typing
So in template I'd have:
{% for obj in objecttypebs %}
{{ obj.someproperty }}
# this would loop through all of them
{% for obj objecttypebs.objecttypea_set.all %}
{% endfor %}
# what
Can you give us "class RegistrationProfile" from C:\Python25\Lib\site-
packages\registration\models.py ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to djang
Fantastic!! Thanks for this information. It's exactly what I've been
looking for!
On Dec 8, 6:39 am, Julien <[EMAIL PROTECTED]> wrote:
> Oh, just a precision for those who are interested. I put Alex's code
> in the __init__.py file of my profile app.
>
> On Dec 9, 12:37 am, Julien <[EMAIL PROTE
I just put my local django development setup up onto my web host, and
am trying to make all the necessary adjustments. So far I haven't been
able to get the views to work. I've got:
myproject.app1
myproject.app2
The basic index view lives in myproject.app1.views. When I try to
visit the index, I
do u have a __init__.py in the directory containing app1 and app2?
Jim
On Dec 13, 10:33 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> I just put my local django development setup up onto my web host, and
> am trying to make all the necessary adjustments. So far I haven't been
> able to get t
On Dec 13, 2007 10:04 PM, subgiambi <[EMAIL PROTECTED]> wrote:
> and I can access my site at http://127.0.0.1:8000/ fine. However when
> I, for example, use the website interface to change a user's profile
> by altering the user's "City" - even if I refresh the new City is not
> displayed on the
Yup. The whole project directory tree from myproject on down is
exactly what it has been on my local system (with the exception of
settings.py), which has always worked fine using the django
development server. That's why this is so mysterious to me.
On Dec 14, 11:58 am, jim <[EMAIL PROTECTED]>
I start my development server with:
python manage.py runserver
and I can access my site at http://127.0.0.1:8000/ fine. However when
I, for example, use the website interface to change a user's profile
by altering the user's "City" - even if I refresh the new City is not
displayed on the user's
set ur environment variable DJANGO_SETTINGS_MODULE to 'settings' eg.
export DJANGO_SETTINGS_MODULE=.settings
then open an interpreter and try importing each of the modules
individually.
the resulting error messages should probably lead u t the solution...
Jim
On Dec 13, 11:03 pm, Eric Abraham
Hi,
I ran my code on another server and the error message was more
explicit.
The problem was in fact that in a templatetags file I was referring to
the parent's models package, and it didn't work...
Is it possible to import a model from a parent package?
Apparently in Python 2.5 you can do:
fro
Alternatively u can do this:
python manage.py shell
this will set up a shell with the necessay variables defined...
Jim
On Dec 13, 11:38 pm, jim <[EMAIL PROTECTED]> wrote:
> set ur environment variable DJANGO_SETTINGS_MODULE to 'settings' eg.
>
> export DJANGO_SETTINGS_MODULE=.settings
>
> th
> then open an interpreter and try importing each of the modules
> individually.
>
> the resulting error messages should probably lead u t the solution...
Nope, all that works fine. Going step by step:
>>> from myproject import app1
>>> from myproject import app2
>>> from app1 import models as m
Here's the top section of the traceback, this could be relevant:
MOD_PYTHON ERROR
ProcessId: 4468
Interpreter:'pr.ericabrahamsen.net'
ServerName: 'pr.ericabrahamsen.net'
DocumentRoot: '/home/me/webapps/django'
URI:'/'
Location: '/'
Directory: None
Filename
for the static media part..u probably need this added to ur config...
SetHandler none
Jim
On Dec 14, 12:09 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> > then open an interpreter and try importing each of the modules
> > individually.
>
> > the resulting error messages should probably
what does ur urls.py look like? is everything imported correctly
there...
Jim
On Dec 14, 12:09 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> > then open an interpreter and try importing each of the modules
> > individually.
>
> > the resulting error messages should probably lead u t the solu
On Dec 13, 2007 10:46 PM, Julien <[EMAIL PROTECTED]> wrote:
> But it still doesn't work. To make it work I have to do the whole:
> from myproject.myapp.models import Bla
>
> Not very reusable approach...
While it works well for the tutorial, where keeping all the code in
one place reduces the num
You mean the first one of the set?
{{ objectb.objecta_set.all.0 }}
You can also slice it, etc. But of course, you really need to define
the ordering to get to the "First" one whatever "first" means to you.
P.K.
--~--~-~--~~~---~--~~
You received this message beca
On Dec 14, 1:21 pm, jim <[EMAIL PROTECTED]> wrote:
> what does ur urls.py look like? is everything imported correctly
> there...
>
> Jim
I think so, I don't use generic views so there's hardly anything in
there. Here's the top of the file:
from django.conf.urls.defaults import *
urlpatterns = p
Thanks for your reply. So It could be an issue of my configuration or
code. But What?
My project runs perfect on trunk. I am trying to migrate to the
newforms-admin branch, so i made the required changes in the code as
described in the documentation. I know is very strange, but yes, I
modify a rec
I have a dictionary, and I'd like to iterate over the keys, using the
keys to look up the result, like:
{% for key in myDict %}
The key is {{key}} and the value is {{myDict.key}}.
{% endfor %}
Only, it doesn't work. It seems like . lookups
require the argument to be a literal, not a variable. I'
On 18 Nov, 11:25, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-11-17 at 16:21 -0500, Bryan L. Fordham wrote:
> > So, say I have a model something like this:
>
> > class Bar(models.Model):
> > user = models.ForeignKey(User)
> > name = models.CharField(maxlength=50)
> > d
Hi Guys,
Anybody knows excellent Python expert that would be interested to work
in Beijing - China on a cool Web2.0 venture? We are hiring !
Those interested can email at [EMAIL PROTECTED] for more details
Ludovic
www.Kalibrio.com
--~--~-~--~~~---~--~~
You re
83 matches
Mail list logo