On Nov 21, 2008, at 11:46 PM, Malcolm Tredinnick wrote:
>
>
> On Fri, 2008-11-21 at 22:37 -0500, Michael Keselman wrote:
>> Hello,
>>
>> http://pastie.org/private/xvqf5tgjnimiolakhawgg (relevant code)
>>
>> Django's QuerySets allow you to do ORs (unions) pretty nicely with
>>
On Fri, 2008-11-21 at 22:37 -0500, Michael Keselman wrote:
> Hello,
>
> http://pastie.org/private/xvqf5tgjnimiolakhawgg (relevant code)
>
> Django's QuerySets allow you to do ORs (unions) pretty nicely with
> Model.manager.filter(Q(...) | Q(...)). However, ANDs don't work quite
> as nicely
Thanks Malcolm,
That was so much easier than I was expecting:
class ItemOptions(admin.ModelAdmin):
def changelist_view(self, request, extra_context=None):
self.list_display = request.session['item_columns']
return super(ItemOptions, self).changelist_view(request,
Hello,
http://pastie.org/private/xvqf5tgjnimiolakhawgg (relevant code)
Django's QuerySets allow you to do ORs (unions) pretty nicely with
Model.manager.filter(Q(...) | Q(...)). However, ANDs don't work quite
as nicely in my situation because I want AND to do what
Malclom,
Thanks for the helpful answer. I need to do numerical work on the
values so I think I'll store the currency type in a separate field.
Cheers,
On Nov 22, 10:54 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-11-21 at 17:49 -0800, dash86no wrote:
> > I'm have a number
On Fri, 2008-11-21 at 12:06 -0800, Andy Young wrote:
> I'm looking for an elegant way of stepping through my models from
> within my template tags.
>
> I have 3 model classes chained by many-to-many relationships, viz
> Category --> Item --> Detail. This model pertains to resume data,
> e.g.,
On Fri, 2008-11-21 at 17:49 -0800, dash86no wrote:
> I'm have a number of "price" fields in my application. I searched
> around the net and it seems to be the case that there are no explicit
> currency types in Django. What is the best data type to use for
> currency? Would it be decimal?
It
You could define the CHOICES as a member of your model class, like so:
class Movie( Relic ):
CHOICES=((u'1','one'), (u'2',u'two'))
disk_type = models.CharField( 'Type', max_length=8,
choices=CHOICES)
Then, in your form:
class MovieForm( BasicRelicForm ):
disk_type =
I'm have a number of "price" fields in my application. I searched
around the net and it seems to be the case that there are no explicit
currency types in Django. What is the best data type to use for
currency? Would it be decimal?
Thanks,
--~--~-~--~~~---~--~~
You
Hello everyone,
I have a quick python question. Is they a better way of calling a
method dynamically then what I have below? Is there a more elegant
approach? Thanks in advance.
try:
push = getattr(self, 'get_%s_content' % self.name)
except AttributeError:
raise "Method does not exist"
You can pass modelformset_factory a kwarg form which should just me
the form class you want to use(aka make a ModelForm with the changes
to the widgets).
Alex
On Nov 21, 7:25 pm, ayayalar <[EMAIL PROTECTED]> wrote:
> Karen,
>
> On this note, is it possible to customize the widget's for formsets
Karen,
On this note, is it possible to customize the widget's for formsets as
well?
Thank you.
On Nov 21, 3:23 pm, ayayalar <[EMAIL PROTECTED]> wrote:
> Thanks Karen. That's exactly the case. Link you provided very helpful.
>
> On Nov 21, 3:00 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
>
Thank you all, it's my first django project and its nice to be
reassured ;)
--~--~-~--~~~---~--~~
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
Thanks Karen. That's exactly the case. Link you provided very helpful.
On Nov 21, 3:00 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Nov 21, 2008 at 4:22 PM, ayayalar <[EMAIL PROTECTED]> wrote:
>
> > I am just simply trying to display all existing objects in a form
>
> > MODEL:
> >
[EMAIL PROTECTED] wrote:
> Where can I get the Host server's IP address?
>
> request.META['SERVER_NAME'] simply returns localhost instead of
> whatever my ip address is
>
>
Try
import socket
socket.gethostbyname(request.META['SERVER_NAME'])
regards
Steve
On Fri, Nov 21, 2008 at 5:14 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:
>
> Where can I get the Host server's IP address?
>
> request.META['SERVER_NAME'] simply returns localhost instead of
> whatever my ip address is
>
Your machine likely has more than one IP address: one for each network
2008/11/21 Tim Chase <[EMAIL PROTECTED]>
>
> > Just wondering where everyone is developing there pythong code?
> > Anyone using development environments, if so which one?
>
> I'm from the old-school of folks that just use a text-editor (Vim
> in my case). I tend to run it within "screen", with
On Fri, Nov 21, 2008 at 4:22 PM, ayayalar <[EMAIL PROTECTED]> wrote:
>
> I am just simply trying to display all existing objects in a form
>
> MODEL:
> class Product(models.Model):
>name = models.CharField(max_length=30)
>
>def __unicode__(self):
>return self.name
>
> VIEW
> def
ChrisK,
I use:
*
from django.contrib.gis.geos import fromstr
gpoly=GPolygon(fromstr(poly.wkt, srid=4326))*
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
> Just wondering where everyone is developing there pythong code?
> Anyone using development environments, if so which one?
I'm from the old-school of folks that just use a text-editor (Vim
in my case). I tend to run it within "screen", with the
following windows/screens:
- editor (vim)
Where can I get the Host server's IP address?
request.META['SERVER_NAME'] simply returns localhost instead of
whatever my ip address is
Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
I'm looking for an elegant way of stepping through my models from
within my template tags.
I have 3 model classes chained by many-to-many relationships, viz
Category --> Item --> Detail. This model pertains to resume data,
e.g., Category='Education', Item='Univ1', Detail='Biology
coursework'.
Well, this is interesting.
The problem seems to be that GPolygon calls
self.latlng_from_coords(poly.shell.coords)
to unpack the coordinates. I handed in 2D points for the shell
coordinates, but somewhere along the line, a third coordinate of
"almost zero" in floating point was added to every
I am just simply trying to display all existing objects in a form
MODEL:
class Product(models.Model):
name = models.CharField(max_length=30)
def __unicode__(self):
return self.name
VIEW
def product(request):
product = Product.objects.all()
form =
Just wondering where everyone is developing there pythong code?
Anyone using development environments, if so which one?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
as soon as i posted i found the fix. my model needs to define the
objects and point to the custom manager, ie
class Raw(models.Model):
objects = DBManager()
On Nov 21, 11:54 am, craic <[EMAIL PROTECTED]> wrote:
> I have a class called Raw which extends model. Much like every other
>
I have a class called Raw which extends model. Much like every other
class. Except, i'm using the method on this page to connect to a
different DB. In the admin tool, all is lovely. I can view and add
new "Raw" objects.
http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/
Shao wrote:
> Dear ALL,
>
> I am very much interested in using a HTML to fire off a data
> processing script to run over the internet.
>
> I will be very grateful if you can advise me on passing parameters
> from an HTML form to a script and fire the script off to carry out
> full execution,
Please note that the result of this is that if you use
'editable=False' this field is not visible in the admin at all.
As far as I know there is no good way (see below) of putting read only
data in an admin page.
You could however, create a read only widget (there are some examples
to be fund on
ok, the view function I'm using appears to be importable - because if
I remove the line "print item.get_absolute_url()", the view function
is called appropriately, with the odd exception that all instances
where the template is calling "get_absolute_url( )" are resolving to
the same page.
A clue
On Nov 20, 3:40 pm, "John.R" <[EMAIL PROTECTED]> wrote:
> I'm working with an Event Model that, when saved (and possibly when
> updated) needs to run some custom Python code to notify some outside
> APIs - Twitter, Pownce, Google Calendar for instance.
>
> I know enough to implement Signals so
> Can I order_by a function within the model? I know you can list them
> in the admin inteface, etc. But can you order_by a model function? Or
> would you have to write a custom piece of code to do that?
In addition to the two solutions that John mentioned, you can do the
following in many
I wanted the same thing long ago, you have a couple of choices: 1. Use
custom SQL functions (but kinda locks u in), 2. Use the python sort
function. This basically takes ur queryset, turns it into a list and
then sorts it.
Since all querysets are just lists in python you can do this:
Spoksss,
I brought this up as a BUG? subject and got some traction from
Malcom. Malcom opened a tracking ticket to get it fixed.
I was able to work around it by sending some querysets to my view
before, instead of using the related sets in the view. If you'd like
to see my work around, please
Check out
http://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by-fields
2008/11/21 Luke Seelenbinder <[EMAIL PROTECTED]>:
>
> Can I order_by a function within the model? I know you can list them
> in the admin inteface, etc. But can you order_by a model function? Or
> would you have
I do something like you are suggesting: I actually write my "flat"
pages in Markdown since I prefer it to HTML, and I keep the contents
in a file instead of the database, so I can edit them with Emacs. Then
I just route these special pages to a trivial template that uses the
markdown filter to
Wiadomość napisana w dniu 2008-11-21, o godz. 15:40, przez goblue0311:
> Thanks for the suggestion!
>
> This code came from the basicApps collection, so I'm not sure why
> they're using a Word regex to match the day, I'm going to try changing
> that to Digit.
>
> However, I did remove the
Can I order_by a function within the model? I know you can list them
in the admin inteface, etc. But can you order_by a model function? Or
would you have to write a custom piece of code to do that?
Thanks,
Luke
--~--~-~--~~~---~--~~
You received this message
On Friday, 21 November 2008 13:46:35 Daniel Roseman wrote:
> There is an alternative, though: instead of overriding the fields
> declaratively, you can define a formfield_callback function.
This seems interesting. I have searched the docs online
for 'formfield_callback' and get no useful
good call - I repeated my concern below before I saw your response, so
please disregard.
On Nov 21, 9:35 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> Wiadomość napisana w dniu 2008-11-21, o godz. 15:22, przez goblue0311:
>
> > Another note if interest is that the error message is citing the
> >
Thanks for the suggestion!
This code came from the basicApps collection, so I'm not sure why
they're using a Word regex to match the day, I'm going to try changing
that to Digit.
However, I did remove the underscore from my slug, so now it's just
'secondPost', and I get the same error. I also
Wiadomość napisana w dniu 2008-11-21, o godz. 15:22, przez goblue0311:
> Another note if interest is that the error message is citing the
> keyword arguments in the order year, slug, day, and month. However,
> get_absoloute_url and the urls.py function use year, month, day, and
> slug. Maybe I
You have an underscore in slug - "second_post" but your regex doesn't allow
it - "[-\w]+". I think it is the problem.
And why you did you choose "\w" for day?
On Fri, Nov 21, 2008 at 17:16, goblue0311 <[EMAIL PROTECTED]> wrote:
>
> Hi all:
>
> I'm receiving this error:
>
>
Another note if interest is that the error message is citing the
keyword arguments in the order year, slug, day, and month. However,
get_absoloute_url and the urls.py function use year, month, day, and
slug. Maybe I have some outdated code here, but where would it reside?
Hi all:
I'm receiving this error:
#*
NoReverseMatch at /blog/
Reverse for 'blog_detail' with arguments '()' and keyword arguments
'{'year': 2008, 'slug': u'second_post', 'day': 21, 'month': 'nov'}'
not found."
#*
when I
Hi!
Is there any way to access request.session from a unit test if I have
a response that is a HttpResponseRedirect. I know HttpResponse have
the attribute session but HttpResponseRedirect does not. I've read
that HttpResponseRedirect is a subclass of HttpResponse, can I access
to the
For posterity, I should point out that Graham's suggestion did indeed
work and the final set of problems stemmed from my django app code. I
had copied over some old code from my development environment to the
production server, but the dev server was running an older version of
django so the code
Yeah, you want to assign that user_id value in the view, when you're
saving the instance:
mydocument.author_id = request.user.id
mydocument.save()
Are you trying to solve for a case where you want the current *admin*
user to be the author_id for the record? You can also add a save
FT wrote:
> class Document(models.Model):
>
> created = models.DateTimeField(
> help_text='Timestamp when the document is created',
> blank=True,
> default=datetime.datetime.now)
>
> author = models.EmailField(blank=True, default=request.user)
>
> Hi there,
>
> I'm
> Although the submit button at the top doesn't seem to work...
the submit button should work now and it is also possible to add
releases to an application. looking forward having your app listed!
have a nice day!
tom
--~--~-~--~~~---~--~~
You received this
No. Request object does not exist when model classes are created.
On Fri, Nov 21, 2008 at 13:47, FT <[EMAIL PROTECTED]> wrote:
>
> class Document(models.Model):
>
>created = models.DateTimeField(
>help_text='Timestamp when the document is created',
> blank=True,
>
On Fri, 2008-11-21 at 03:29 -0800, Caisys wrote:
> Hi,
> I would like to publish some statics files on my website and I have a
> some questions:
> 1- The flatpage app examples like http://www.lawrence.com/about/staph/
> contain elaborate html, is this edited as a text field in the admin
>
On Nov 21, 11:29 am, Caisys <[EMAIL PROTECTED]> wrote:
> Hi,
> I would like to publish some statics files on my website and I have a
> some questions:
> 1- The flatpage app examples likehttp://www.lawrence.com/about/staph/
> contain elaborate html, is this edited as a text field in the admin
>
On Nov 21, 9:09 am, Donn <[EMAIL PROTECTED]> wrote:
> On Friday, 21 November 2008 08:06:32 urukay wrote:
>
> > easy way how to solve it is to put definition of your choices out of model
> > definition:
>
> Yeah, that's what I call a 'global', but is there no way to get the choices
> from the
Hi,
I would like to publish some statics files on my website and I have a
some questions:
1- The flatpage app examples like http://www.lawrence.com/about/staph/
contain elaborate html, is this edited as a text field in the admin
interface, wouldn't it be tedious to maintain?
2- Can i do something
class Document(models.Model):
created = models.DateTimeField(
help_text='Timestamp when the document is created',
blank=True,
default=datetime.datetime.now)
author = models.EmailField(blank=True, default=request.user)
Hi there,
I'm trying to set up a default value the
Hello,
I have the same problem with entry_set in my related_manager.
On 8 Lis, 05:32, John M <[EMAIL PROTECTED]> wrote:
> DR,
>
> Now I have a new problem. When I use this as a related_manager
> (Report.objects.all()[0].task_set.accomplishments()) it returns all
> the accomplishments. I've
On Fri, 2008-11-21 at 02:08 -0800, AndyB wrote:
> I basically would like some way for staff users to choose which
> columns are displaying in an object's changelist.
>
> So far I've got an ugly solution which I can actually have some idea
> how to implement and the 'correct' solution which
I basically would like some way for staff users to choose which
columns are displaying in an object's changelist.
So far I've got an ugly solution which I can actually have some idea
how to implement and the 'correct' solution which requires quite a lot
of digging in the django internals.
The
On Fri, 2008-11-21 at 10:28 +0100, Florencio Cano wrote:
> Hello all,
> I have two models called User and Responsible. When I add a
> Responsible automatically a User is added. I have only one form to add
> a User and a Responsible.
>
> class NewUserResponsibleForm(forms.Form):
> username =
Hello all,
I have two models called User and Responsible. When I add a
Responsible automatically a User is added. I have only one form to add
a User and a Responsible.
class NewUserResponsibleForm(forms.Form):
username = forms.CharField(max_length=30)
password =
u can use ModelForm and you don't have to write choices.
Don't know any other way. But I don't suppose there is other way, these two
"ways" can solve everything, I think.
Or maybe someone else would help
R.
Donn Ingle wrote:
>
>
> On Friday, 21 November 2008 08:06:32 urukay wrote:
>> easy
Oh yeah!! It was that! Thank you veru much Alex :)
I forgot to put the template code, Here it is (mayb useful for some
other):
--upload.html--
{% for field in form %}
{{ field.label_tag }}
{{ field }}
On Friday, 21 November 2008 08:06:32 urukay wrote:
> easy way how to solve it is to put definition of your choices out of model
> definition:
Yeah, that's what I call a 'global', but is there no way to get the choices
from the field in the model class?
\d
hi all, i am using debian etch stable version 0.95
please i would like to know if there is a way to change admin, when
displaying link "Currently" in models.BooleanField.
When i have images locally this can be done just by changing urls.py .
But when i copy this file to another server during
65 matches
Mail list logo