i am using Django Version: 1.2.1
I follow this Tutorial http://docs.djangoproject.com/en/1.2/intro/tutorial01/
and
Edit the polls/models.py file so it looks like this:
class Poll(models.Model):
# ...
def __unicode__(self):
return self.question
class Choice(models.Model):
#
On 6/11/10, Joel Klabo wrote:
> yeah, still 403. CSRF token missing or incorrect.
>
try add the 'django.core.context_processors.csrf' in your settings.py
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.csrf',
)
>
> --
> You received this
Hi guys,
I don't know whether the built-in permissions system would be
appropriate here, but I want to control access to objects in one of my
models, based on profile fields, like gender, age, etc.
I planned to create a model "MyModelPermissions" like so:
class MyModelPermissions(models.Model):
Wel what I have in mind is wondering if it would be useful to build
full implementations of what would normally be called "Analysis
Patterns", like Designed Patterns but commone object modeling
solutions to common domain problems. The simplest is problem the Item-
ItemDecription pattern, which as
Hello all,
The line <
http://code.djangoproject.com/browser/django/trunk/django/db/models/options.py#L15
> in the trunk at this moment is where the action is happening. We
get "foo d_des" because the "_D" in the model name is matched in the
regular expression pattern and the substitution
This is totally off the top of my head and may not compile or work :)
But something like this might be what you're looking for:
# Example Model
class MyModel(models.Model):
start_time = models.TimeField()
# Example query
from django.db.models import Q
from django.db.model import Max
# Get
I'm not sure how to do directly in Django ORM, but if you use plain
SQL queries, you could do try:
select * from conference_room cr1
where cr1.start_time >=
(select max(start_time) from conference_room cr2 where cr2.start_time
< :yout_filter_time)
and cr1.start_time < :your_filter_time
On 11 Cze, 12:19, tsmets wrote:
> The problem was just the naming convention ...
> They should have been named initial_data.json as mentionned in the URL
> provided by Xavier.
>
> Any help on how to run python scripts directly to create my data
> sets ?
> What I do now is
Hello Dan,
On Jun 11, 11:48 am, Dan Harris wrote:
> If verbose_name isn't provided the docs say that "Django will use a
> munged version of the class name: CamelCase becomes camel case."
Thanks again for the info.
> This
> might explain your problem, it looks at FOOD_DES
Still looking for an clue on this. Permissions are simply not there.
On Jun 7, 3:03 pm, "bax...@gretschpages.com"
wrote:
> OK, I'm going nuts. For some reason, my user-levelpermissionshave
> disappeared. I can changepermissionsat the group level, but at the
> user level I
If verbose_name isn't provided the docs say that "Django will use a
munged version of the class name: CamelCase becomes camel case." This
might explain your problem, it looks at FOOD_DES and assumes that the
first F and first O are camel cased words and splits them into two
words, hence the space.
Hello Dan,
Thanks for the info. verbose_name does take care of the display
problem and I may end up using that option for a more user friendly
experience.
@ALL: I would like to understand where the space is being added. I
have looked around a bit in the source for Django but I haven't seen
Alex,
Thanks for the answer.
I tried doing something like the first thing you proposed (MEDIA_URL
as a callable) but I had to tweak it a little bit because the template
wasn't calling the callable, but rather printing 'function
object .'.
What do you think of the solution I posted?
Best,
Steven and Alex,
This is what I coded, and tried it out and works. I still have to
benchmark it.
from django.conf import settings
class RoundRobinMediaUrl():
current_url = 0
try:
media_urls = settings.MEDIA_URLS
except:
media_urls = (settings.MEDIA_URL,)
def
I'm not sure why you are seeing the space in the admin, but here's a
bit of info regarding changing what is displayed:
You can change a meta option on your model to set what the name will
be displayed as in the admin like so:
class MyModel(models.Model):
field =
Steven,
Thanks again for the answer.
I couldn't quite understand the comment regarding the round robin
server setup. In order to workaround the browser's limitations to
simultaneous connections that can be opened to a host, the links to
static content in the HTML content must be to different
Hello,
>From what I have read it looks like you want to provide your clients
the assurance that the information being presented is not compromised
in addition to meeting the HIPAA and HITECH requirements. This is not
entirely a Django/Python implementation, but falls in line with the
Database
Apologies for the "__initial__" stuff -- damn iPhone autocomplete!
On Jun 11, 11:15 am, rahul jain wrote:
> It was rw-r--r-- . I also modified it to 777 by" chmod -R 777". But
> did not fix my problem.
>
> This is the error which I am getting
> ImportError: cannot import
"Is there some .py file in your install directory that matches the
name of an app you have listed in installed apps?"
I think this was the problem. Thanks!!
On Jun 11, 11:37 am, Karen Tracey wrote:
> On Fri, Jun 11, 2010 at 9:11 AM, Stodge wrote:
> > I'm
Hello all,
I have a model named FOOD_DES (the name if from an existing schema
that I'm trying to mirror). When I view it in the admin it's name is
shown as "foo d_des", notice the space.
Any thoughts on why/where the space is added and how I can get rid of
it?
I'm wondering if this something
I have configured my url to call ^time/$, current_datetime
ive also imported datetime into my views.py file which the django
tutorial ahs told me.
I keep getting an import error unable to import current datetime
I also have tried simply reateign the module now which calls the
current dateime
I really appreciate your help Dan, but I don't think the answer to my question
is in the docs. I did my due diligence there before asking.
Regarding your suggestion, from the docs: "It's an error to use both a list of
fields and the depth parameter in the same select_related() call, since they
http://code.google.com/p/django-ajax-selects/
satisfies all requirements
the channels will allow even finer customization for the queries and
the display.
On Jun 11, 12:01 pm, akaariai wrote:
> Hello all,
>
> I am looking for an m2m autocomplete field which should have
On Fri, Jun 11, 2010 at 6:19 AM, tsmets wrote:
...
>
> Any help on how to run python scripts directly to create my data
> sets ?
> What I do now is fine but could be better automated ?
>
...
One possibility is to write yourself one or more management commands
which you
On Jun 10, 8:41 pm, Joel Klabo wrote:
> yeah, still 403. CSRF token missing or incorrect.
Not to state the obvious, but are you positive you're working with the
right set of templates? I only ask because this happened to me
recently - the CSRF tokens not showing up in the
Can't you use XMPP?
On Fri, Jun 11, 2010 at 12:36 PM, Euan Goddard
wrote:
> If you're worried about the data getting out of order use a counter in
> JS and always ensure that you only update the page when you get the
> correct (i.e. current) counter back.
>
> I
On Fri, Jun 11, 2010 at 9:11 AM, Stodge wrote:
> I'm writing an install script that resides in django_project/install
> and one of things it does, is programmatically run syncdb. My current
> code for this is correct if I do:
>
> cd ..
> python
> import os
>
If you're worried about the data getting out of order use a counter in
JS and always ensure that you only update the page when you get the
correct (i.e. current) counter back.
I think what you're talking about isn't possible in normal HTTP. I
think you have a one request, one response situation.
It should be easy enough to write your own tag providing you're
expecting your input in the form . I've written
a bit of code that should do this:
import re
LABEL_RE = re.compile(r'^(\w+) (\d+)$')
def order_by_number(unordered_data):
tokenized_data = []
for item in unordered_data:
Good point. I tried adding the Django project's path to sys.path and
tried your suggestions for the settings, but it still gives me the
same error. Thanks
# Add the Django project path to sys.path.
sys.path.append(config.INSTALL_DIR)
# Add the parent path too.
I'd just create a related model and use a many-to-many field.
Alternatively you could write your own field, but this would restrict
your application to postgres only.
Euan
On Jun 10, 1:03 pm, bjja wrote:
> Hi
>
> Psycopg2 supports array types but I can not find any
Hi,
normally in views.py I have a function that takes a request and
returns a render_to_response or the like. I, however, would like it to
take a request and have Django reply with multiple responses. Is there
a way to do this, or is this not possible with HTTP anyway?
What I am trying to
It was rw-r--r-- . I also modified it to 777 by" chmod -R 777". But
did not fix my problem.
This is the error which I am getting
ImportError: cannot import name
--RJ
On Fri, Jun 11, 2010 at 7:59 AM, Tom Evans wrote:
> On Fri, Jun 11, 2010 at 3:47 PM, rahul jain
This sounds like a path type issue and these sorts of things are a
PITA to sort out. Have you tried setting the settings path a bit more
explitly:
os.environ["DJANGO_SETTINGS_MODULE"]="django_project.settings"
I had some trouble with kind of thing in a project I was working on
Hi,
I've done something similar to this using annotation. It is a bad
nasty, but should work.
Firstly annotate all the MyModel instances with the max value of the
pk of the MyOtherModel:
qs = MyModel.objects.annotate(last_pk=Max('myothermodel__pk'))
Then filter these based on the myString:
qs
Contra question... do You use something like geoip in your
application?
On Jun 11, 5:48 pm, Ariel wrote:
> Hi everybody, I write in my settings.py LANGUAGE_CODE = 'fr' to make french
> the default language but it does'nt seem to work because the spanish is
> still the
On Fri, Jun 11, 2010 at 3:47 PM, rahul jain wrote:
> Hi Tim,
>
> Here is my structure
>
> app
> |-- __init__.py
> |-- models.py (all my models)
> |-- auth.py (python functions referencing models defined in models.py)
> |-- blogs.py (python functions referencing models
Please try 'fr-FR'
On Jun 11, 5:48 pm, Ariel wrote:
> Hi everybody, I write in my settings.py LANGUAGE_CODE = 'fr' to make french
> the default language but it does'nt seem to work because the spanish is
> still the default language, Do I need to do something else to make
Hi everybody, I write in my settings.py LANGUAGE_CODE = 'fr' to make french
the default language but it does'nt seem to work because the spanish is
still the default language, Do I need to do something else to make french
the default language ???
I need help !!!
Thanks in advanced
Regards
--
You
Hi Tim,
Here is my structure
app
|-- __init__.py
|-- models.py (all my models)
|-- auth.py (python functions referencing models defined in models.py)
|-- blogs.py (python functions referencing models defined in models.py)
|-- views.py (python functions referencing models defined in models.py)
On 11 juin, 15:26, Marcus Whybrow wrote:
> I have found a ticket already open for this problem (http://
> code.djangoproject.com/ticket/13684),
> The problem was in fact that I had a settings.py file and a module
> called settings with default and local settings residing
On 11 Jun., 15:30, Karen Tracey wrote:
> Yes, you've got your admin registrations in your models.py file. models.py
> won't necessarily be loaded early in a production environment with
> DEBUG=False, so these registration calls are not running before you start
> using admin.
I'll give you the benefit of the doubt since it seems some of this is
getting lost in translation.
Your app must have this sort of structure:
app
|-- __init__.py
|-- models
| |-- __init__.py
| |-- auth.py
| `-- blogs.py
`-- views.py
If app/models/auth.py defines a User class, and
@also I meant .objects. all().
It will give import error that cannot be imported.
On Fri, Jun 11, 2010 at 7:09 AM, rahul jain wrote:
> Yes I have the __init__.py inside my app directory. Also, all my split
> files are inside the same directory. If possible can you
Yes I have the __init__.py inside my app directory. Also, all my split
files are inside the same directory. If possible can you test
Create views1.py (not views.py)
>
> import your model class
>
> and in one of the functions do
> .objects. all()
>
> and then run python manage.py runserver. I
@bruno: yes functions.
So in some other file I want to use models methods like
.objects. all
For that I have to import the . But I am not able to.
Import works fine on views.py
Also, can you test this for me
Create views1.py (not views.py)
import your model class
and in one of the
On Fri, Jun 11, 2010 at 2:53 PM, rahul jain wrote:
> Yes they are in the same directory. How to use __initial__.py ?
>
It's called __init__.py. It must exist in any python module
(directory), and need not contain anything.
You were linked to this earlier in the thread,
Yes they are in the same directory. How to use __initial__.py ?
On Fri, Jun 11, 2010 at 3:38 AM, Scott Gould wrote:
> Did you put Test1.py and Test2.py into a "models" directory where
> models.py would normally be, and add an __initial__.py file to it?
>
> On Jun 10, 5:18 pm,
On Fri, Jun 11, 2010 at 4:49 AM, Jan Meier wrote:
> And my model my_app/models.py looks as follows:
>
> from django.db import models
> from django.contrib import admin
>
> class Blubb(models.Model):
>x = models.IntegerField()
>
> admin.site.register(Blubb)
>
> Any
The examples are pretty slick.
On Tue, Jun 8, 2010 at 1:22 AM, simon wrote:
> Hi everyone,
>
> ImageFlow is a platform-independent JavaScript picture gallery
> inspired by the Cover Flow technique currently used in iTunes and the
> file browser of OSX. The standard ImageFlow
I have found a ticket already open for this problem (http://
code.djangoproject.com/ticket/13684),
The problem was in fact that I had a settings.py file and a module
called settings with default and local settings residing inside it.
There must have been some confusion and moving the settings.py
I'm writing an install script that resides in django_project/install
and one of things it does, is programmatically run syncdb. My current
code for this is correct if I do:
cd ..
python
import os
os.environ["DJANGO_SETTINGS_MODULE"]="settings"
from django.core.management import call_command
Hi,
I am serving my django project with mod_python and ran into a problem
regarding the admin interface (django.contrib.admin). If DEBUG = False
is set in settings.py the admin interface generates 404 error messages
when clicking on any of my models, for example to add a new entry. The
django
On 11 juin, 00:45, Marcus Whybrow wrote:
> mod_wsgi (pid=2639): Exception occurred processing WSGI script '/home/
> webapps/apache/tinygraph.wsgi'.
> Traceback (most recent call last):
> File "/home/webapps/.virtualenvs/tinygraph/lib/python2.6/site-
>
I have these two rather simple models that looks something like this:
class MyModel(models.Model):
myName=models.CharField(max_length=60)
class MyOtherModel(models.Model):
myString=models.CharField(max_length=60)
myModel=models.ForeignKey(MyModel)
I will eventually have
On 10 juin, 23:18, rahul jain wrote:
> HI Dan,
>
> Thanks for your response but that will not solve my problem.
>
> I am not splitting models. I am splitting actions
I assume you mean "functions" ?
> defined in the
> models across multiple files.
(snip)
>
> But I
On 11 juin, 12:38, Scott Gould wrote:
> Did you put Test1.py and Test2.py into a "models" directory where
> models.py would normally be, and add an __initial__.py file to it?
>
s/__initial__/__init__/
--
You received this message because you are subscribed to the Google
That looks ok from a code readability point of view, however you will
still need to cast the form values to float or cast the float values
(i.e. pow(2,2) and pow(2*math.pi*v,2) to Decimals otherwise will you
will get an UnsupportedOperation exception.
Dan Harris
dih0...@gmail.com
On Jun 11, 6:58
It's not really a matter of "working around" it. Your .xxx method/
property is an attribute of the object. What you evidently want from
the database is *not* a list of those objects, but rather a summary
representation of them. Trying to apply your .xxx is meaningless as
you don't have a discrete
Just modify your server configuration to directly serve the folder and
do not sent it to django. It's the same you'll do for media files.
Hope it helps!
--
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net
--
You received this message because you are subscribed to the Google
Dan,
Do you speak for me to do this? for the example...
http://paste.pocoo.org/show/224233
On 10 jun, 16:51, felix wrote:
> use
>
> float( form.cleaned_data['a'] )
>
> etc
>
> also, when retreiving the field from the db it will be a Decimal
> object and needs to be
Did you put Test1.py and Test2.py into a "models" directory where
models.py would normally be, and add an __initial__.py file to it?
On Jun 10, 5:18 pm, rahul jain wrote:
> HI Dan,
>
> Thanks for your response but that will not solve my problem.
>
> I am not splitting
I have a XML fixture with the language codes if you need it:
http://pastebin.com/U4cAxXzY
On Fri, Jun 11, 2010 at 12:19, tsmets wrote:
> The problem was just the naming convention ...
> They should have been named initial_data.json as mentionned in the URL
> provided by
The problem was just the naming convention ...
They should have been named initial_data.json as mentionned in the URL
provided by Xavier.
Any help on how to run python scripts directly to create my data
sets ?
What I do now is fine but could be better automated ?
[code]
from
¿Are you setting the variable FIXTURES_DIR in settings.py?
On Fri, Jun 11, 2010 at 12:03, Kenneth Gonsalves wrote:
> On Friday 11 June 2010 14:20:59 tsmets wrote:
> > But I have json's files in multiple "fixtures" directories.
> > [code]
> >
Hello all,
I am looking for an m2m autocomplete field which should have the
following characteristics:
1. It should not at any point execute choices.all(). I have about
2 choices, so this will be a performance killer.
2. It should allow the user to type in some text, and select from a
list
Hello,
Fixtures are described in the documentation, especially there:
http://docs.djangoproject.com/en/dev/howto/initial-data/#automatically-loading-initial-data-fixtures
You have to follow the name convention to get them automatically loaded.
Regards,
Xavier.
--
You received this message
I think it is all explained in here :
http://docs.djangoproject.com/en/dev/howto/static-files/
As mentionned by every body around...
It is ok in DEV but ... you should not do so in other environment.
\T,
On Jun 11, 8:12 am, lalaba wrote:
> Hi all,
> I am wondering how I
When I run the syncdb :
[code]
Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ ./manage.py syncdb
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating
On Jun 11, 7:12 am, lalaba wrote:
> Hi all,
> I am wondering how I can serve an html file without having to have
> Django think it's a template file.
>
> In my html file, because there are markups that confuse Django, I'd
> like to serve it as it is. I tried to read the html
Thank you very much to make it clear for me.
Regards
Michal
On 11 čvn, 02:26, Russell Keith-Magee wrote:
> On Thu, Jun 10, 2010 at 9:05 PM, Plovarna wrote:
> > Hello,
> > I recently migrated from Django 1.1.2 to 1.2.1. When I run my test now, I
> >
Hi all,
I am wondering how I can serve an html file without having to have
Django think it's a template file.
In my html file, because there are markups that confuse Django, I'd
like to serve it as it is. I tried to read the html file directly into
Django, and use HttpRespont(htmlText) to get
On Friday 11 June 2010 12:05:50 Sam Lai wrote:
> That error message looks like Windows to me. try adding the word
> python at the start of that command.
>
yes, it did not look like a linux error message - although last time I looked
windows would say 'bad command or file name'
--
Regards
That error message looks like Windows to me. try adding the word
python at the start of that command.
If you are indeed on Windows, how did you install Python? The easiest
one I've used is the ActiveState's ActivePython distribution for
Windows; sets everything up properly, including proper file
On Friday 11 June 2010 00:32:38 JRMAbock wrote:
> I did finally get Django 1.2.1 downloaded but now it wont install.
>
what do you mean by 'won't install'? all you need to do is symlink django to
the site-packages directory and symlink django-admin.py to somewhere in your
path and you are done
75 matches
Mail list logo