Stephen Sundell schrieb:
> I really was just looking for a way
> to separate models into different modules or files within the same
> application. Is this possible?
>
Hi,
I do it like this:
Directory myapp/models/ contains:
__init__.py
myclass.py
file __init__.py:
from myclass
Is there a django module dealing with processing a credit card
payment? I noticed in one of the django snippets (
http://www.djangosnippets.org/snippets/907/ ) a line:
from virtualmerchant import VirtualMerchant
--~--~-~--~~~---~--~~
You received this message
On 26 sep, 06:40, Karish <[EMAIL PROTECTED]> wrote:
> I am using {{ MEDIA_URL }} in my templates for images, CSS and JS. For
> example, {{ MEDIA_URL }}img/abc.gif
>
> I want to do something similar when I need absolute URLs, and I was
> wondering what approaches exist.
I'm in the process of developing a site in Django that includes the
following in the models.py:
def image_path(page, filename):
return "content_images/page/%s/original/%s" % (page.pk, filename)
def image_scaled_path(page,filename):
return "content_images/page/%s/scaled/%s" % (page.pk,
On Sep 25, 8:41 pm, "Frédéric Sidler" <[EMAIL PROTECTED]>
wrote:
> What it the best Django stack today.
>
> In django doc, it says that apache with mod_python is the best
> solution in production. But in the same time I see that everyblock use
> nginx (probably in mode fastcgi).
>
> Did you
Hi everybody.
my django website has to deal with a set of workers, each of them
earning a given amount of money for their own work.
So I have:
class Worker(models.Model):
name = models.CharField(max_length=30)
hourly_wage = models.DecimalField(max_digits=10, decimal_places=2)
A part
On 25 Set, 22:31, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> You should consider using a custom ModelForm[1] instead of this
> approach. Override its clean() method to perform your checks and throw
> a ValidationError when you don't want the save to proceed. You can
> then also make the Admin use
I've got that. Here's my directory structure:
-blog
-templatetags
-__init__.py
-get_latest.py
On Sep 25, 11:39 pm, Rock <[EMAIL PROTECTED]> wrote:
> You need an empty __init.py__ in the directory or else the python
> files there will not be found.
>
> On Sep 25,
That's just what I needed, thanks very much.
Tim.
On Thursday 25 Sep 2008, Rock wrote:
> from django import template
> from django.conf import settings
> from django.template.defaultfilters import stringfilter
>
> register = template.Library()
>
> @register.filter
> @stringfilter
> def
On 26 sep, 12:02, Fabio Natali <[EMAIL PROTECTED]> wrote:
> Hi everybody.
>
> my django website has to deal with a set of workers, each of them
> earning a given amount of money for their own work.
>
> So I have:
>
> class Worker(models.Model):
> name = models.CharField(max_length=30)
>
Hi,
i have a problem with the form.ImageField using ModelForm.
I define a ImageField in my model and I configure all path in the
settings file. I have no problem when i use the django admin
interface : the images are uploaded correctly to the directory and
correctly added in the DB. But when
This example doesn't work for me:
Error: 'super' object has no attribute 'filter'
At the Django Wiki (http://code.djangoproject.com/wiki/
NewformsAdminBranch) I found this:
class BookAdmin(admin.ModelAdmin):
def queryset(self, request):
"""
Filter based on the current user.
Hello everyone,
I would like to share a model with all my apps. I moved it from the app
to the project's root dir, but now the admin interface can't find it!
Does anyone know how to do this? I thought of createing empty models in
each app and importing everything from the shared model, but I
Hi all,
I'm trying to have a formfield filled with a correlctly formatted date value.
Validation is already in place. It only accepts "dd-mm-" on submitting but
when it gets the existing value from the model it shows it in the formfield
like "-mm-dd"
So the sequence is almost
Gabriel Rossetti wrote:
> Hello everyone,
>
> I would like to share a model with all my apps. I moved it from the app
> to the project's root dir, but now the admin interface can't find it!
> Does anyone know how to do this? I thought of createing empty models in
> each app and importing
I don't think virtualenv will help you set up your project running
with Apache. But it's a good practice nevertheless.
If your hosting provider supports custom FastCGI handlers/processes,
you could look into setting up Django with FastCGI. It's quite easy.
Also if you don't have a way to set
This might be off topic, but maybe you should consider splitting your
application into multiple smaller reusable applications? If the models
of a single application need categorizing, you might have a sign of
needing to split them up.
A talk on reusable applications by James Bennet from
You don't have to put your model to the root of your project to be
able to share it amongst your apps. You can reference models across
applications. You might consider creating another application for that
shared model, too.
Erik
On 26.09.2008, at 15:46, Gabriel Rossetti wrote:
>
>
Using Django v1.0.
One of my models is a standard address table. I knew about
us.models.PhoneNumberField, so I used that for a phone number field. It
uses us.forms.USPhoneNumberField so that validation works nicely on an
Admin form. Same thing for USStateField.
While there is are phone
Hello,
is there a general solution for required fields in models? It would be
nice if there could be a class "required" attribute for the label if
the field is required.
I think this solution is implemented in the django admin, because in
the admin the required fields are bold and when I look at
this works
>>>from django.template import loader
>>>loader.get_template('myfile.html')
but how do i get this syntax to work?
>>>get_template('myfile.html')
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django
Satchmo - http://www.satchmoproject.com is a Django-based store framework
with several credit card processing modules. Feel free to use that code as
the basis.
-Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Getting closer. This works: product.period_start_date.strftime('%d-%m-%Y')
But I definitely do not want this in all view handlers. It should go in the
model .. or the modelform.
Thanx again!
Gerard.
Gerard Petersen wrote:
> Hi all,
>
> I'm trying to have a formfield filled with a
On 26 sep, 16:00, Gerard Petersen <[EMAIL PROTECTED]> wrote:
> Getting closer. This works: product.period_start_date.strftime('%d-%m-%Y')
>
> But I definitely do not want this in all view handlers. It should go in the
> model .. or the modelform.
>
> Thanx again!
>
> Gerard.
>
> Gerard Petersen
I have a model with a m2m field "provincia".
I want to order my objects in this way:
If the object has a provincia = 'AA' on m2m relation must be the
bottom of my list.
I tried query = query.order_by('-provincia') and it works correctly
(because AA is the first of the values), but I duplicates
Hi,
I've been reading the documentation around forms and templates but I
can't find what I'm looking for, I'd be grateful if somebody could
point me to the right documentation.
In the situation where a bound form object has been passed back to a
template, I would like to get hold of the field
Hi Koen,
I'm using modelform, having tried the 'output_format' there does not seems to
work. In the mean time I figured out a solution within the model like this:
def __init__(self, *args, **kwargs):
super(Product, self).__init__(*args, **kwargs)
if not
Oops sorry for the duplicate post!
I am looking to get controll of a specific field. The docs say I can
get my hands on the following parts of a field:
{{ field.label }}
The label of the field, e.g. E-mail address.
{{ field.label_tag }}
The field's label wrapped in the appropriate HTML
bruno desthuilliers scrisse:
[...]
> #
> http://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany
That seems exactly what I was looking for! I'll use it in my app,
using your code as a starting point.
Thank you very much,
Fabio.
--
Fabio Natali
Found an error in the model code. It should be this:
if isinstance(self.period_start_date, datetime):
Regards,
Gerard,
koenb wrote:
> On 26 sep, 16:00, Gerard Petersen <[EMAIL PROTECTED]> wrote:
>> Getting closer. This works: product.period_start_date.strftime('%d-%m-%Y')
>>
>> But I
I have been trying to reference a model from another application I
wrote for the same project. basically what I need to do is asign a
relationship between two model classes in different apps.
example
module Product has a model class that belongs to the inventory app and
the tax field of
I have a last problem before finishing my first django application.
I have a many to many relationship that connects two models.
Everything is fine in the admin, with the exception that I would like
to filter the shown items in the corrponding widget.
I tried by overwriting queryset, but it
Converting a .96 site I was working on to the 1.0 set-up.
Is there a quick way to list all my models in the admin?
Or do I have to :
from HCVGM.systems.models import System
admin.site.register(System)
for every one?
b.t.w. I presume the
class Admin:
pass
in the Models.py
Hello
I'm making a small app that holds data of servers in our organisation
(the database existed previously, and I've created the models.py using
the inspectdb as described in:
http://docs.djangoproject.com/en/dev/howto/legacy-databases/ )
The admin site works OK, but each server is displayed
Oops - I just saw the relevant bit in the tutorial, so it is done like
this:
class Server(models.Model):
def __unicode__(self):
return self.question
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Efrain Valles wrote:
> I have been trying to reference a model from another application I
> wrote for the same project. basically what I need to do is asign a
> relationship between two model classes in different apps.
>
> example
>
> module Product has a model class that belongs to the
I have a public form that's used to email details of stuff on my site
to an email address.
Here is a snippet of the email received:
Fred says:
**
Hi, I thought youd like this.
Hi,
I thought I'd ask before rolling my own (at tedious pace) widget/whatever:
If you have a foreign key field to a table of thousands of, say, author names,
the drop-down control becomes a real problem:
1. It's not paged so all the items have to be stuffed into the html.
2. It's damn hard to
You might want to remove the id field as it's not needed. You also
might consider converting siteid and authid to ForeignKey fields to
the Model that corresponds to the table that these fkeys are
referencing. So if you have Auth and Site models, you could do:
site = models.ForeignKey(Site,
On Sep 26, 2008, at 5:54 AM, Peter Bengtsson wrote:
> On Sep 25, 8:41 pm, "Frédéric Sidler" <[EMAIL PROTECTED]>
> wrote:
>> What it the best Django stack today.
>>
>> In django doc, it says that apache with mod_python is the best
>> solution in production. But in the same time I see that
On 26 sep, 17:53, "Efrain Valles" <[EMAIL PROTECTED]> wrote:
> I have been trying to reference a model from another application I
> wrote for the same project. basically what I need to do is asign a
> relationship between two model classes in different apps.
>
> example
>
> module Product has a
On 26 sep, 18:19, gv <[EMAIL PROTECTED]> wrote:
> Oops - I just saw the relevant bit in the tutorial, so it is done like
> this:
>
> class Server(models.Model):
> def __unicode__(self):
> return self.question
The answer is 42 !-)
Hi,
I try to use AdminDateWidget outside of the admin page, like documented:
http://docs.djangoproject.com/en/dev/topics/forms/media/
form.media returns:
But still some files are missing: jsi18n and core.js:
Now the widget is usable, but looks ugly. Some css files are missing
from django.template.loader import get_template
I recommend learning some general python before you dive into django.
There are lots of great sites for this, for example www.diveintopython.org
/H
26 sep 2008 kl. 15.44 skrev NoviceSortOf:
>
>
> this works
>
from django.template import
On 26 sep, 18:07, "Lance F. Squire" <[EMAIL PROTECTED]> wrote:
> Converting a .96 site I was working on to the 1.0 set-up.
>
> Is there a quick way to list all my models in the admin?
>
> Or do I have to :
>
> from HCVGM.systems.models import System
>
> admin.site.register(System)
>
> for every
Hi everyone. I'm quite new to Django and have been using the web
tutorials as well as the two Django books extensively. If have tried
searching for a solution to my problem, but in truth, I barely know
how to ask, so I'll explain the scenario as briefly as possible.
I'm building a document
On Sep 26, 1:53 pm, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
>
> # relative import is simpler and safer
> import models
>
> # using introspection
> from django.db.models import Model
> for name in dir(models):
> obj = getattr(models, name)
> if obj is not Model and issubclass(obj,
Hi Folks-
Is it possible to access a specific form (i.e. form 1 of n) within a
formset and print that form within a template file? All the examples
on the Django documentation page show accessing formset forms via a
forloop and I have not been able to find my answer within the docs.
For
It may be as simple as creating an intermediary field between Document
and agency called Study. (See the Django docs regarding adding extra
fields to a many-to-many relationship.)
In any event, it is wise not to think of models as objects so much as
stand-ins for DB tables (which is what they
Oops. I meant intermediary class, not intermediary field.
On Sep 26, 1:39 pm, Rock <[EMAIL PROTECTED]> wrote:
> It may be as simple as creating an intermediary field between Document
> and agency called Study. (See the Django docs regarding adding extra
> fields to a many-to-many relationship.)
Hmmm... Here are some guesses:
If that return statement in render is a single doublequote instead of
2 singlequotes, then your code probably won't parse and, even if it
does, get_latest certainly won't be found.
It seems to me like you need to coerce the string being assigned to
self.num as
I run my own installation of python out of my home dir. It's not hard... All
you need to do is to compile your own version of python (or use your hosts
mine was 2.3 so i got 2.5.1) and change your PATH. Everything should work
from there.
James
On Fri, Sep 26, 2008 at 6:01 AM, Erik Allik <[EMAIL
I freely admit my biggest problem is that I am quite used to thinking
in terms of classes, and almost not at all in terms of database
schema. I'll check into that reading you recommended.
Kind regards,
Robert
On Sep 26, 12:42 pm, Rock <[EMAIL PROTECTED]> wrote:
> Oops. I meant intermediary
Thanks Karen, its working fine now,
Brian, I will have a look at slug fields, for now i'm trying just to
get a basic site going, but then I'm going to try and come back and
improve things so i will take a look at then then.
Regards,
Andrew
--~--~-~--~~~---~--~~
Gee, sorry about my bad wording of the problem, I think I tried
importing the models from a different application, however when I try
to do the variable asignment to a ForeignKey Model it does not take
the Model.
I import the models:
import rocola_erp.fact_rocola.models
I create the class
David Christiansen wrote:
> The idea is that image_scaled has a version that is a thumbnail of the
> originally updated photo. I've removed that code for testing
> purposes, and this still happens. What happens is that two images are
> created in content_images/page/PAGE_ID/scaled/, one with an
Hi all,
When I run my test suite, commands like these 'admin.site.register(Product,
ProductAdmin)' in models.py break my tests with this error:
django.contrib.admin.sites.AlreadyRegistered: The model Product is already
registered
When I (temporarily) remove them the tests run properly.
What
On Fri, Sep 26, 2008 at 12:12 PM, Donn <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I thought I'd ask before rolling my own (at tedious pace) widget/whatever:
>
> If you have a foreign key field to a table of thousands of, say, author names,
> the drop-down control becomes a real problem:
> 1. It's not
Hello
I have just made my first django site for my uncles wedding photos. It
is very simple, just photos and tags, with a ManyToMany relationship.
I have only made views for viewing the photos and am using the django
admin system for uploading and tagging.
I am wondering what is the best way to
As stated before, by changing the PYTHONPATH, you it is NOT possible
to change the python interpreter when using mod_python. Certainly you
can load your own libraries, but the python itself remains the same.
Erik
On 26.09.2008, at 22:07, James Matthews wrote:
> I run my own installation of
Yes i am using FastCgi
On Fri, Sep 26, 2008 at 12:46 PM, Erik Allik <[EMAIL PROTECTED]> wrote:
> As stated before, by changing the PYTHONPATH, you it is NOT possible to
> change the python interpreter when using mod_python. Certainly you can load
> your own libraries, but the python itself
On 26 sep, 21:10, Robert <[EMAIL PROTECTED]> wrote:
(snip)
> > On Sep 26, 1:39 pm, Rock <[EMAIL PROTECTED]> wrote:
>
> > > It may be as simple as creating an intermediary field between Document
> > > and agency called Study. (See the Django docs regarding adding extra
> > > fields to a
With sorl.thumbnail you don't have to do that at all. It allows you to
specify resize size on the fly, then caches the resulting image and
always recreates the image if the size changes automatically.
Erik
On 26.09.2008, at 22:50, ssam wrote:
>
> Hello
>
> I have just made my first django
My online store keeps everything in a cart. When someone makes an
order, it sends the order to the bank's server for payment processing
then sends them back -- similar to paypal.
What I'm trying to do is pass their cart, complete with everything in
it, over to the bank and back again. This is
On Sep 26, 2:50 pm, ssam <[EMAIL PROTECTED]> wrote:
> Hello
>
> I have just made my first django site for my uncles wedding photos. It
> is very simple, just photos and tags, with a ManyToMany relationship.
> I have only made views for viewing the photos and am using the django
> admin system for
I have an application that is getting incorrect cache headers set,
including pragma "no-cache". It is running via mod_apache without
mod_expires or mod_cache.
I am setting the upstream cache headers in the view with the
cache_control decorator, which should override anything set by the
On 26 sep, 22:03, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> My online store keeps everything in a cart. When someone makes an
> order, it sends the order to the bank's server for payment processing
> then sends them back -- similar to paypal.
>
> What I'm trying to do is pass their cart,
On 26 sep, 19:12, Donn <[EMAIL PROTECTED]> wrote:
> Hi,
> I thought I'd ask before rolling my own (at tedious pace) widget/whatever:
>
> If you have a foreign key field to a table of thousands of, say, author names,
> the drop-down control becomes a real problem:
> 1. It's not paged so all the
Donn,
You could use the filter_(horizontal|vertical) solution available on
Admin.
For more details:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#filter-horizontal
[]s,
Diego Ucha
http://www.diegoucha.com/
On 26 set, 18:28, bruno desthuilliers <[EMAIL PROTECTED]>
wrote:
> On 26 sep,
It was the quotes.
Thanks for the tips!
--~--~-~--~~~---~--~~
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
Erik Allik wrote:
> I don't think virtualenv will help you set up your project running
> with Apache. But it's a good practice nevertheless.
Yes virtualenv can be used to get it to work. The problem is that one
can't explain the way it would be used without the OP posting how the
hosting
I have a form field that will render as a drop-down in which I need to apply
a css class to each of the tags within the . A
complicating factor is that each of the 's will have a different css
class. The Form class uses a ModelChoiceField to create the form field.
Works great w/o needing any
On Wed, 2008-09-24 at 06:20 -0700, [EMAIL PROTECTED] wrote:
> I have an app that tracks football stats, I'd like to use bar graphs
> similar to what's on Everyblock. This is their code:
>
> http://dpaste.com/80211/
>
> I was curious, how, if possible at all, in the template I could get
> the
On Wed, 2008-09-24 at 02:36 -0700, bruno desthuilliers wrote:
> Hi all
>
> I don't know wether it's me doing something wrong, or if it's a normal
> limitation of Django's templates, or else, but anyway, here's the
> problem:
>
> I have a custom tag that sets a variable in the context (the
On Wed, 2008-09-24 at 20:45 -0700, Chris wrote:
> I'm trying to debug a usage of callproc, which doesn't return any rows
> when used inside Django. Is there anyway to view the SQL and escaped
> values sent from db cursor?
There is no public API in the Python database wrappers to determine how
On Thu, 2008-09-25 at 20:20 -0400, Xian Chen wrote:
> Hi All,
>
> I have a problem with Django v0.95 ( I cannot convince the
> administrator to install 1.0 for me.)
>
> I got this feedback:(
>
> AttributeError at /xianchen/
> 'function' object has no attribute 'rindex'
You might have
On Fri, 2008-09-26 at 16:29 +0200, Alessandro wrote:
> I have a model with a m2m field "provincia".
> I want to order my objects in this way:
> If the object has a provincia = 'AA' on m2m relation must be the
> bottom of my list.
>
> I tried query = query.order_by('-provincia') and it works
Hi,
I just upgraded to Django 1.0, and I've just finished fixing all my unit
tests. However, streaming file uploads are still broken. The behaviour I'm
seeing is as follows:
When I start the upload of the file, a file which looks like eg.
/tmp/tmpGjWpee.upload appears almost immediately,
78 matches
Mail list logo