How you do that? Everywhere I look, documentation states that view is a
"function" (well there is few places where is mentioned "callable").
Small example would be nice.
George Song kirjoitti:
> There's no reason a view needs to be a function. You can easily make
> views out of classes. In whi
On 5/6/2009 11:18 PM, Lee Hinde wrote:
> On Wed, May 6, 2009 at 11:15 PM, Lee Hinde wrote:
>> On Wed, May 6, 2009 at 10:54 PM, George Song wrote:
>>> On 5/6/2009 10:34 PM, Lee Hinde wrote:
On Wed, May 6, 2009 at 10:22 PM, George Song wrote:
> On 5/6/2009 9:57 PM, Lee Hinde wrote:
>
On Wed, May 6, 2009 at 11:15 PM, Lee Hinde wrote:
> On Wed, May 6, 2009 at 10:54 PM, George Song wrote:
>>
>> On 5/6/2009 10:34 PM, Lee Hinde wrote:
>>> On Wed, May 6, 2009 at 10:22 PM, George Song wrote:
On 5/6/2009 9:57 PM, Lee Hinde wrote:
> I have this as part of the model for a cl
On Wed, May 6, 2009 at 10:54 PM, George Song wrote:
>
> On 5/6/2009 10:34 PM, Lee Hinde wrote:
>> On Wed, May 6, 2009 at 10:22 PM, George Song wrote:
>>> On 5/6/2009 9:57 PM, Lee Hinde wrote:
I have this as part of the model for a class called "Class"
def save(self, force
On 5/6/2009 10:34 PM, Lee Hinde wrote:
> On Wed, May 6, 2009 at 10:22 PM, George Song wrote:
>> On 5/6/2009 9:57 PM, Lee Hinde wrote:
>>> I have this as part of the model for a class called "Class"
>>>
>>>
>>> def save(self, force_insert=False, force_update=False):
>>> start = default
On Wed, May 6, 2009 at 10:22 PM, George Song wrote:
>
> On 5/6/2009 9:57 PM, Lee Hinde wrote:
>> I have this as part of the model for a class called "Class"
>>
>>
>> def save(self, force_insert=False, force_update=False):
>> start = defaultfilters.slugify(self.Name)
>> count =
On 5/6/2009 9:57 PM, Lee Hinde wrote:
> I have this as part of the model for a class called "Class"
>
>
> def save(self, force_insert=False, force_update=False):
> start = defaultfilters.slugify(self.Name)
> count = Class.objects.filter(Slug__equal=start).count()
> if
I have this as part of the model for a class called "Class"
def save(self, force_insert=False, force_update=False):
start = defaultfilters.slugify(self.Name)
count = Class.objects.filter(Slug__equal=start).count()
if count != 0:
filterme = "%s_%d" % (self.
Externalizing text for I18N is a great idea. But size of the text can
vary quite a lot depending on the language. How do you make sure space
for the text on web page resizes appropriately so that string does
not get cutoff or page does not look ugly.
How do you design and build such a page/form
I’m looking to create an Admin so that when a user from one Site logs
into the admin they will not be able to see or modify entries for
other sites.
An example might help. Say you have a blog application and you use
the django.contrib.site framework so that you can run multiple blogs,
each with
Thanks for the advice, and the link.
I ended up putting in something like "the website's response time and
user load will be optimized according to the client's needs and
hardware configuration".
On May 6, 3:36 pm, Doug B wrote:
> There is no way you can give an answer based on an application th
On Wed, May 6, 2009 at 8:37 PM, matt barto wrote:
> I am a novice django user, and I am curious why there is no ability to
> send emails with a CC list? If there is, how is this done? The
> current documentation only talks about a Bcc list which is not what I
> want.
Django provides a couple o
On 5/6/2009 5:32 PM, snorkel wrote:
> I am passing a model to a template that also has foreign keys to other
> models, so in my template I can do things like
> {% for a in a_list %}
>{% for b in a.b_model.all %}
> this is b.name b.value b.date
>{% endfor %}
> {% endfor %}
>
> Is th
Hello Django Users!
I am a novice django user, and I am curious why there is no ability to
send emails with a CC list? If there is, how is this done? The
current documentation only talks about a Bcc list which is not what I
want.
Thanks in advanced.
Matt
--~--~-~--~~~-
I am passing a model to a template that also has foreign keys to other
models, so in my template I can do things like
{% for a in a_list %}
{% for b in a.b_model.all %}
this is b.name b.value b.date
{% endfor %}
{% endfor %}
Is there some way to filter the b_model in the template or
I have an admin page set up where I have two inlines for this one
model I have. Both inlines have extra=3 so theres three instances per
inline. One of the inlines behaves badly by saving all three objects,
even if two of them are completely empty. The other inline behaves
nicely by only saving the
What apps or techniques do you use/prefer/recommend for defining
different sections of the site and navigation menu? Is that dynamic
and configurable by the end user/content administrator? How would you
imagine a comfortable user interface to define different sections and
the content from differen
Ooh. Will definitely have to check that out.
On May 6, 7:16 pm, George Song wrote:
> There's no reason a view needs to be a function. You can easily make
> views out of classes. In which case you can stuff some of these things
> in the class __init__ and not have to about them for each view.
>
There's no reason a view needs to be a function. You can easily make
views out of classes. In which case you can stuff some of these things
in the class __init__ and not have to about them for each view.
On 5/6/2009 3:37 PM, ringemup wrote:
> Hm, and RequestContext has to be instantiated from e
Hm, and RequestContext has to be instantiated from every view for
which one wants to use the context processor anyway, huh?
I always feel like I'm repeating myself when passing global context to
every single template.
On May 6, 5:13 pm, George Song wrote:
> On 5/6/2009 1:37 PM, ringemup wrote:
On 5/6/2009 1:50 PM, mediumgrade wrote:
> I know of the "standard" way of serving static files in Django for
> development purposes, but I want to create my own function which reads
> the contents of a file then serves it to the user (I want to put some
> security around the downloading of the fil
On 5/6/2009 1:37 PM, ringemup wrote:
> I've got some context that every view in one of my apps needs to pass
> to its templates... but that I don't want to have to run for pages
> that don't use that app, since it executes a lot of queries. Is there
> a way to execute the context processor only f
I know of the "standard" way of serving static files in Django for
development purposes, but I want to create my own function which reads
the contents of a file then serves it to the user (I want to put some
security around the downloading of the file).
What is the best way to accomplish this?
--
I've got some context that every view in one of my apps needs to pass
to its templates... but that I don't want to have to run for pages
that don't use that app, since it executes a lot of queries. Is there
a way to execute the context processor only for views defined in that
app's URL conf or so
Phil,
Thanks for the pointers. I guess my thinking on this is that if
someone feels a question is too trite to warrant and answer, they
shouldn't answer. I don't think this group is called 'advanced django
users', thus I don't really feel bad for posting 'newbie' questions.
I appreciate all ans
Well, this still isn't working. I was able to get rid of the
exception described above by creating a custom form to attach to the
Inline. But now I'm just getting a "Please correct the errors below"
error message whenever I submit the form... with no fields
highlighted.
On May 6, 8:53 am, ringe
Thanks! This is a great starting point. My real queryset requires me
to go a few joins deeper, however. I will try nesting loops to get
there, but this seems frightfully like querying in a loop (maybe I'm
wrong, I'll check the end query to find out). It also seems like a
frightening amount of
Got it working, the magic of public monologue :)
the solution was simply to assemble the insert "semi tuple" by had and
pass object references for foreign keys:
l = Location.objects.get(id=22)
r = DeviceFloormatSummary(loc_id= l, status= int(record[4]) ,
log_time= record[1], time_start= record[5
There is no way you can give an answer based on an application that
doesn't exist, and a server that doesn't exist. What I would do is
give them real numbers based on an application you -can- test. Build
a tiny Django application that does something resonably representitive
of what the real appl
Responding to myself:
If I specify the object.id instead of just a reference to the object
as the initial field value, the selections work correctly.
E.g.
'product': item.product.id
instead of
'product': item.product
--~--~-~--~~~---~--~~
You received this
I don't exactly want to save the full path of the image in the
database, just the image extension. I am trying to convert the
current implementation of a PHP web page to Django. Here's how the
table looks like, I'll be more explicit with the img ext this time:
idname img_ext
--
On Wed, May 6, 2009 at 8:48 PM, jrs_66 wrote:
>
> Hi,
>
> I have 2 models...
>
[skip]
>
> e = FlattenedCategory.objects.select_related('category').filter
> (member_of_category=15)
>
> which works... This, however, doesn't
>
> e = e.category
>
> How do I access the related records from the Cat
On Wed, May 06, 2009 at 10:17:29AM -0700, jrs_66 wrote:
> This is definitely the most angry forum I've ever seen... the
> kicker is that the anger is almost always coming from the people
> associated with the django project... hmmm..
In your previous thread, someone from the Django project helpfu
I'm rewriting an app with django (my first django app) and was hoping
to import data into my newly created models. I have modified the
schema slightly so I'm querying my old database and formatting data
but I'm unsure how to proceed for import into Django.
so far I'm querying the old db direclty
>
> In your case e is a QuerySet, with multiple FlattenedCategory objects.
>
> So the proper code would be to loop through them:
>
> {{{
> for fc in e:
> fc.category_set
> }}}
>
Indeed,
but category being a ForeignKey field,
{{{
for fc in e:
fc.category
}}}
will work here.
--
Clément
--
perfect. Thank you George.
On May 6, 2:42 pm, George Song wrote:
> {{{
> return '%s'
> %Cheque.objects.aggregate(cheque_sum=Sum('amount'))['cheque_sum']
>
> }}}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Dja
On 5/6/2009 10:27 AM, mamco wrote:
> I have two models "Deposit" and "Cheque". I'm trying to show total
> the amount of cheques in the admin area using the method name in the
> list_display. It seems to work (although I think the documentation
> suggests it may not because it requires the lookup
In your case e is a QuerySet, with multiple FlattenedCategory objects.
So the proper code would be to loop through them:
{{{
for fc in e:
fc.category_set
}}}
On 5/6/2009 10:17 AM, jrs_66 wrote:
> No... 'QuerySet' object has no
> attribute 'category_set'
>
> George,
>
> I have read the
jrs_66:
you may find some comfort in the
http://ubuntuforums.org/forumdisplay.php?f=39
forum - not specific to django, but quite a friendly bunch and lots of
python folks willing to assist with the learning process.
tag your posts with 'django'
On May 6, 2:17 pm, jrs_66 wrote:
>
> This is defi
thanks George - working on it - nearly there.
On May 2, 12:17 pm, George Song wrote:
> On 5/2/2009 7:40 AM, George Song wrote:
>
> > Pass `entries` and `schedule` as context vars to your template, and
> > you can iterate through your schedule using ordered list of entries.
>
> There's also `djan
I have two models "Deposit" and "Cheque". I'm trying to show total
the amount of cheques in the admin area using the method name in the
list_display. It seems to work (although I think the documentation
suggests it may not because it requires the lookup for each row
shown).
I've got this in the
I'm using Fabric for deployment of my django apps, and I quite like
it. It's still probably not as feature-rich as capistrano, but it's
written in python, has a *very* active community right now, and solves
the problems that I have, anyway. YMMV.
http://www.nongnu.org/fab/
On May 6, 8:12 am, Ti
No... 'QuerySet' object has no
attribute 'category_set'
George,
I have read the docs... MANY times... from the docs...
'Django also creates API accessors for the "other" side of the
relationship -- the link from the related model to the model that
defines the relationship. For example, a Blog
On 5/6/2009 9:48 AM, jrs_66 wrote:
> I have 2 models...
>
> class Category(models.Model):
> name = models.CharField(max_length=255)
> parent = models.ForeignKey('self', null=True)
> has_children = models.BooleanField(default=False)
> language = models.ForeignKey(Language, null=Fal
Hi,
I have 2 models...
class Category(models.Model):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self', null=True)
has_children = models.BooleanField(default=False)
language = models.ForeignKey(Language, null=False, default=1)
active = models.BooleanFi
On 5/6/2009 6:56 AM, Felix wrote:
> I have the next models:
>
> class Place(models.Model):
> currency = models.CharField(_('currency'), max_length=128,
> blank=True, null=True)
> language = models.CharField(_('official language'),
> max_length=128, blank=True, null=True)
> class Meta:
On 5/6/2009 4:02 AM, Graham Dumpleton wrote:
>
>
> On May 6, 4:38 am, George Song wrote:
>> On 5/5/2009 6:48 AM, Michel Thadeu Sabchuk wrote:
>>
>>
>>
>>> Hi guys,
>>> I'm having a weird problem with TIME_ZONE settings. Some view list
>>> objects based on the time, future time objects are not s
I have a formset with initial data for foreignkey fields.
Unfortunately, the values of the foreignkey fields are not selected in
the formset.forms.
Not sure if I am doing something wrong or if this is a bug or known
limitation.
I have cut the code down to a small example that reproduces the
prob
On Wed, May 06, 2009 at 08:12:30AM -0700, Tim wrote:
> I am working on a Django project which has gotten to the point
> where I need some sanity and repeatability in deployment. My
> first instinct was to just start building things from scratch
> with shell scripts and to manage db migrations with
On 5/5/2009 5:13 AM, Alfonso wrote:
> I'm using the following to pull all cost prices that match a
> particular product by the company that supplied the product:
>
> View:
>
> cost_prices = ProductCostPrice.objects.filter
> (product_id__product_id=product_id)
>
> Template:
> ...
> {% regroup co
Hi django coders!
In order to realize some kind of registration wizard, I created a view
named registerBuddy which does nothing else than showing some infos,
waits for the user to click on "go on" and redirects him to the "next"
form. This form redirects back to the wizard after valid submission.
On 5/6/2009 6:07 AM, atik wrote:
> When i create a ModelForm from a Model with a ManyToManyField in it,
> the default widget creates a select drop down with all the foreign key
> objects in it. I want to replace the widget with a textarea with a
> comma separated list of names.How can i do this? I
Hi!
I am using ImageField to add optional images to my articles from admin.
image2 = models.ImageField(upload_to="upload", blank=True)
I added one image from my server to this field
Is there a way to remove the image. If i for example decided not to use the
image on the article at all?
Thanks,
O
On May 6, 4:48 pm, PierreR wrote:
> I don't seem to find a good way to have a hidden field in the admin
> console. I can of course get the hidden field easily but the label is
> still showing up. This problem is really related to the Admin app.
>
> I have been trying to "hack" the "fieldset.html"
I am working on a Django project which has gotten to the point where I
need some sanity and repeatability in deployment. My first instinct
was to just start building things from scratch with shell scripts and
to manage db migrations with one-off sql scripts. But then I started
thinking that there'
Hey,
On Wed, May 6, 2009 at 3:27 PM, Chris Dew wrote:
>
> I'd like to develop a Django application with the following
> properties:
>
> A page (list of items) will have a link to a page with a form to add a
> new item.
>
> If there is no javascript, the link will take the user to the new page
>
I need help. Is it possible? Plz help me.
--~--~-~--~~~---~--~~
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 e
I had the same problem but it turned out to be me, not django. See
http://code.djangoproject.com/ticket/11013#comment:1 (your ticket I
believe).
Regards,
-Robin
On Apr 28, 1:02 pm, Filip Gruszczyński wrote:
> I am trying to write a tests and want to try out calling some wrong
> addresses, to se
I am in the process of signing a contract to develop a website for a
fairly large IT company using Django. They requested that the contract
nclude:
1) number of concurrent visitors that the site will support
2) maximum response times for typical requests
I've explained that both items will depen
I don't seem to find a good way to have a hidden field in the admin
console. I can of course get the hidden field easily but the label is
still showing up. This problem is really related to the Admin app.
I have been trying to "hack" the "fieldset.html" but it is not that
easy. "is_hidden" is onl
Greetings,
I found one file browser package, which seems decent -- you look at
the directory, select (potentially many) files to upload, and it does
that. Has anyone had experience with similar functionality? Can
anybody recommend something that works? I don't want to reinvent the
wheel.
Many th
Thanks! So I just need to replace "forms" with "models and it'll work?
-- djangomax
On May 5, 8:50 pm, Malcolm Tredinnick
wrote:
> On Tue, 2009-05-05 at 21:42 -0300, Gabriel wrote:
> > djangomax escribió:
> > > According to the Django Book for version 1.0, the following should
> > > work:
>
> >
I think you need to look at a Javascript library like jQuery, YUI,
etc, for the popup. It isn't really a Django app, but having a
Javascript popup on hover of an image. This is something that would
most likely be in your template.
--~--~-~--~~~---~--~~
You received
On May 6, 10:47 am, NicoEchániz wrote:
> On May 6, 8:57 am, Daniel Roseman
> wrote:
> > On May 6, 5:26 am, NicoEchániz wrote:
> > > Hello,
>
> > > I have a model which has a ForeignKey to itself. I'm doing this to
> > > represent a hierarchy which I then need to display in the
> > > correspondi
I have the next models:
class Place(models.Model):
currency = models.CharField(_('currency'), max_length=128,
blank=True, null=True)
language = models.CharField(_('official language'),
max_length=128, blank=True, null=True)
class Meta:
abstract = True
class Country(Place):
Thanks, I'll try the django-evolution :)
On 6 Maio, 16:44, Daniel Roseman
wrote:
> On May 6, 3:03 pm, Gil Sousa wrote:
>
> > Hi!
>
> > I already read that django doesn't do an update to the DB (tables
> > structure) when we do the syncdb command, just create new tables if
> > necessary..., but
In addition to Malcolms comments, you'll need a way to track if the
agent was fired or not, you could do this in several ways: 1. a date
fired field (you may want a date hired), a fired boolean field, or a
more complicated way, an archive type setup that moves the fired
agents to another table (th
On May 6, 8:57 am, Daniel Roseman
wrote:
> On May 6, 5:26 am, NicoEchániz wrote:
> > Hello,
>
> > I have a model which has a ForeignKey to itself. I'm doing this to
> > represent a hierarchy which I then need to display in the
> > corresponding select field of my form.
>[]
> > You can find t
On May 6, 3:03 pm, Gil Sousa wrote:
> Hi!
>
> I already read that django doesn't do an update to the DB (tables
> structure) when we do the syncdb command, just create new tables if
> necessary..., but how do I know which tables were created and which
> ones should I do the manual update?
>
> Now
I'd like to develop a Django application with the following
properties:
A page (list of items) will have a link to a page with a form to add a
new item.
If there is no javascript, the link will take the user to the new page
and let the user submit the form, then return them to the initial page
w
When i create a ModelForm from a Model with a ManyToManyField in it,
the default widget creates a select drop down with all the foreign key
objects in it. I want to replace the widget with a textarea with a
comma separated list of names.How can i do this? I am using django
1.02. Plz help me.
--~
Hi!
I already read that django doesn't do an update to the DB (tables
structure) when we do the syncdb command, just create new tables if
necessary..., but how do I know which tables were created and which
ones should I do the manual update?
Now I am only using my local server, but I am concern
Ah, that's perfect. Thank you!
--~--~-~--~~~---~--~~
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
d
Ah, that's where i was going wrong. I was trying to populate the
field in save_model in the Inline definition, but the exception was
being thrown before that code was executed. I'll try creating a
custom form, since I don't want to maintain changes to the actual
model code for a contrib app.
T
On May 6, 5:26 am, NicoEchániz wrote:
> Hello,
>
> I have a model which has a ForeignKey to itself. I'm doing this to
> represent a hierarchy which I then need to display in the
> corresponding select field of my form.
>
> I've come up with a simple custom Form which represents my select
> choice
Hi guys,
>> That is very odd indeed. Are there other Django instances within the
>> same virtual host?
> It doesn't strictly have to be other Django instances, it can be PHP
> or mod_perl as well. Basically anything that runs embedded in Apache
> processes and which expects a different timezone
On May 6, 4:38 am, George Song wrote:
> On 5/5/2009 6:48 AM, Michel Thadeu Sabchuk wrote:
>
>
>
> > Hi guys,
>
> > I'm having a weird problem with TIME_ZONE settings. Some view list
> > objects based on the time, future time objects are not shown.
>
> > The problem is that sometimes all objects
Wiadomość napisana w dniu 2009-05-05, o godz. 18:38, przez Raashid
Malik:
> I have a file upload functionality which works perfectly fine
> locally using django dev server. but same functionality doesn't work
> on server and i get "An unhandled exception".. No stack trace
> available ev
Thanks very much, Clement
waruna
2009/5/6 Clément Nodet
> Hi,
>
> as mentioned in the tutorial, on generic views (
> http://docs.djangoproject.com/en/dev/intro/tutorial04/#use-generic-views-less-code-is-better),
> your second template will have the variable 'object' in its context (not
> 'obje
Thank you George the 'limit_choices_to' param is exactly what I was
looking for. I had never used or seen it before.
Bastien
On May 5, 10:45 pm, George Song wrote:
> On 5/5/2009 12:29 PM, Bastien wrote:
>
> > This is quite new to me, I have done a recursive (self) many to many
> > relation betw
On May 5, 10:15 pm, Thierry wrote:
> How can I set picture to the image extension? I don't think
> "instance.picture = ext" works:
>
> def pet_picture_upload(instance, filename):
> name, ext = os.path.splitext(filename)
> instance.picture = ext
> return '/usr/django/images/%s%s'
81 matches
Mail list logo