e simplicity of the question - i'm still trying to get to
grips with django/pythonific best practice...
regards to all,
paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
d to be unique together in shot model.
>
> 2008/9/24 paul <[EMAIL PROTECTED]>
>
>
>
> > hi all,
>
> > i've thrown myself into developing an animation pipeline using
> > django. i'm new to both python and django - but have in the (distant)
> >
now, my app is more of an internal produciton system - so it
doens't need to look pretty. however, i have also read that 'auto
forms' could/should be used instead. can anyone set me straight
please?
many thanks again,
paul
On Sep 24, 9:40 pm, "Alexander Pugachev"
&l
y be
linked to one type at a time. From the manual/book - i belive that
GenericForeignKey is the way to go. ie, insert a GenericForeignKey
field into the Node. Does this sound like a good approach?
Many Thanks in Advance,
Paul
--~--~-~--~~~---~--~~
You received th
s if derived from a common model. or is each derived model
incompatible with each other?
cheers,
paul
On Oct 7, 11:16 am, David Hall <[EMAIL PROTECTED]> wrote:
> Hi Paul,
>
> You've got a couple of options for this. The first uses inheritance:
>
> class Nod
ject - thanks to
you! :-)
-p
On Oct 7, 6:23 pm, David Hall <[EMAIL PROTECTED]> wrote:
> Hi Paul,
>
> So long as the common model is not abstract, it should work. Also, the
> common model must be the one that contains the parent field, and it
> should link to "Node&qu
it=False) properly given
that I have multiple fields in a form with different field names?
Thanks in advance!
Paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to thi
author = form.save(commit=False)
author.title = 'Mr'
author.save()
I hope that helps!
Paul
On Jul 28, 4:58 pm, Streamweaver wrote:
> To be clear. Essentially I just want to merge the object instance and
> POST data with the POST data overwriting the instance where it
y to change the data in my model:
{% for hid in form.hidden_fields %}
{{hid}}
{% endfor %}
On Jul 28, 2:34 am, Paul wrote:
> Hello,
>
> I understand that Django won't let you save incomplete fields in a
> single form created from a Model unless you do this:
>
>
I have the following model (stripped of comments and __unicode__ for
brevity) which defines a comment in my Django app (I'm not using the
comment module provided with Django for various reasons):
class Comment(models.Model):
comment = models.TextField()
added_by = models.ForeignKey(User)
ad
On May 5, 10:12 pm, Daniel Roseman wrote:
> On May 5, 9:30 pm, Paul wrote:
>
>
>
> > I have the following model (stripped of comments and __unicode__ for
> > brevity) which defines a comment in my Django app (I'm not using the
> > comment module provi
hi -- given this example template:
{% for item in items %}
{% extends "example.html" %}
{% endfor %}
When this block is evaluated during template rendering, does the file
"example.html" get opened for every iteration of the loop, or might
the contents of "example.html" get cached the first ti
sorry -- I made a mistake -- I meant include instead of extends :-p
{% for item in items %}
{% include "example.html" %}
{% endfor %}
does example.html get opened for every iteration of the loop, or just
at the first iteration, and then perhaps cached?
On May 21, 12:36 am, p
27;d suspect {% include
%} opens a file every time, as it's within a generic {% for %} loop,
unless {% include %} is structured to be able to reference a file it's
already opened. The reason I'm asking is because there would be a
performance penalty if the file has to be opened for
ve many parts/widgets
with callbacks or events. If you want the page to display without JS,
you still have to generate the page with one request though...
cheers
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this g
On 15 Jun., 18:17, Joel Klabo wrote:
> Thanks, good info. So the template tag can do the DB query and all
> that without going through a view function?
Yes, see the query in the example code I posted:
profiles = UserProfile.objects.order_by('user__date_joined')
[:self.limi
possible to base a
layout on and the initial view only sets the src attribute of
all iframes. When I learned HTML, it was generally accepted that
frames are bad. Unfortunately I don't remember the exact reason and
haven't used them since ;)
cheers
Paul
>
> On Jun 15, 8:09 am, P
Long story short have several django projects running
I log in ok and the projects run fine using the admin interface.
However :
I have added users and given them access to only certian applications
on the django site using the admin interface, however when i log in
with out supervisor access ch
s GET with PostgreSQL.
If this sounds like a bug, I'll try to submit a bug report. I'm using
Django 1.1.1
thanks,
Paul
The traceback with PostgreSQL:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/site-packages/django/core/servers/
basehttp.py", li
x.
thanks,
paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more optio
On Feb 12, 1:54 am, bruno desthuilliers
wrote:
> On Feb 12, 9:40 am, paul wrote:
>
> > hi -- after I do a login that successfully goes through a custom
> > authenticate() and django login(), I get redirected to a web page that
> > is build off of a template that
some more info...
I added "django.core.context_processors.request" to
TEMPLATE_CONTEXT_PROCESSORS
Based on my code below, it seems like the session is storing the
correct user ID for the user that just logged in (I confirmed this by
changing the user ID in the database manually), but for some re
Another post because I think I explain my issue a little better
here...
in my case:
1) a successful log in results in a call to a HttpResponseRedirect
that goes straight to the web page I'm specifying.
2) I checked right before this HttpResponseRedirect is called, and the
User object that was r
t
statement to show the result of request.user.is_authenticated() right
before returning HttpResponseRedirect, I get "True".
However, the view that handles the URL requested by
HttpResponseRedirect returns False when I check
request.user.is_authenticated().
I hope I'm being
On Feb 12, 4:33 pm, pbzRPA wrote:
> Can you please add a dump of your MIDDLEWARE_CLASSES as it is in your
> settings file.
Sure, here it is:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.
est)
return render_to_response(template, context, context_instance=rc)
In this code, if I check request.user.is_authenticated, it returns
False. request.user is actually AnonymousUser. However, if I look at
request.session.items, I see the correct _auth_user_id for the user
that just logged in.
s a get_user function in ModelBackend (whoops), and I managed to
name my function for returning an authenticated User the same way. I
have it working now.
paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to t
like:
{{form.blah}}{{form.mydate.date}}
{{form.blah2}}{{form.mydate.time}}
-Paul
--~--~-~--~~~---~--~~
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@goog
s to make changes to BoundField (maybe adding some
BoundWidget class even) to allow you to get sub-widgets out of a
MultiWidget. Otherwise there simply isn't any way to access the sub-
widget while also passing the data and attrs to that widget.
-Paul
On Jun 14, 12:32 am, Malcolm Tredinnick <[EMAIL
The BaseForm.__init__ sets self.fields to self.base_fields.copy()
before your __init__ is run. The correct way to change the label is:
class TestForm(forms.Form):
somefield = forms.IntegerField(label='foo')
On Jan 30, 1:06 pm, Kirk Strauser <[EMAIL PROTECTED]> wrote:
> I'm using a Newforms
I need to access the context from within a filter. The filter needs
to change its behavior based on the target browser
(context.request.META.HTTP_USER_AGENT).
There doesn't appear to be any way to access this information from
inside the filter. Nor is there any way to pass this info into the
fi
I'm trying to work out how I'm going to setup a model structure a
video section of my website. Say I have this scenario.
- Each video belongs to a set of 4-5 videos.
- Depending on the set the video belongs too, certain information will
need to be attached to that video (ie> recipe/chef informati
Hi Michael,
Thanks a lot. That query made me realize I've got to re-think this.
http://groups.google.com/group/django-users/browse_thread/thread/477915b60c5d160e/ff677bbbf87ea9b3?lnk=gst&q=django+edit+inline#ff677bbbf87ea9b3
On Feb 21, 8:21 am, Michael Newman <[EMAIL PROTECTED]> wrote:
> http:
e 97, in __cmp__
return cmp(self.creation_counter, other.creation_counter)
AttributeError: type object 'UserProfile' has no attribute
'creation_counter'
--
(Sorry if that wraps at the wrong place, Google Groups posting window
wraps things)
Any ideas why th
django/db/backends/util.py", line 19, in execute
self.db.queries.append({
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position
991: ordinal not in range(128)
I understand that it's having problems because the string is identified
as an ASCII string an
Ok, I've dug a little more and I realised I'd got the wrong end of the
stick.
The string I'm assigning to the field is a unicode string. Django is
trying to do a .encode('ascii') on it and failing. Understandable
really
I assume I have to do a .encode('utf-8') on it before I store it. Does
that
Jeremy Dunck wrote:
> I've seen some situations where multiple encodings were stuck into the
> same column, and you don't want to go there.
I can believe that :-/
That for the advice. Things seem to be working now I've encoded into
utf-8. Even Django's admin interface seems to understand utf-8
entry, or posts
under a forum topic, so what have other people done?
If I'm letting the database do the work should I tell the database that
I'm going to be doing this type of operation on it in some way?
Thanks
Paul
--~--~-~--~~~---~--~~
You receive
ne?
I know this isn't really something that SQL supports, but I'm hopeful
it's possible to fake.
Thanks
Paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to thi
, but I'll investigate the core
version first.
Thanks again.
Paul
--~--~-~--~~~---~--~~
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 un
[EMAIL PROTECTED] wrote:
> The core version was built using Luke Plant's work and Ian Holsman's
> work, kind of the best of both worlds.
Yeah, once I started looking at the code I saw the commit logs that
said the same thing. Good to see things growing that quickly.
It's nice to think I was hav
w function? This doesn't
make sense to me because quickly blocks will be generated that are not
actually used; would it be possible to do something smart? Like
specifying block-functions inside the template code?
Many thanks for any directions!
Paul
--
You received this message because you ar
he in memory
data to a PIL image; how to do this?
Thanks for any direction,
Paul
PS: I did read a lot already on google but found no consistent
direction on this.
class rusk(models.Model):
image = models.ImageField(upload_to='uploadedImages')
class RuskForm(ModelForm):
cl
same processors are used
(from TEMPLATE_CONTEXT_PROCESSORS) which is not desired. So i'm
starting to doubt whether this was such a good idea or not
How could i solve this?
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
splay the
'form'
This all works but the only thing left is to disable/readonly all the
fields... how can i do that?
Thanks for any idea's
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
know a better solution is to create custom templates for the field
for example but i'm missing complete and working examples to do that;
anyone advise?
Paul
class CrispyUneditable(UniFormNode):
'''subclass the crispy tag to modify the tags output: each input
field shall be un
eatly appreciated!
Paul
--
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
django-users+unsubscr...@googlegroups.com.
For more opti
Solved it by migrating to the class based generic views, then fed
initial form data to the constructor of the form by overloading
get_initial on the view class.
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this g
?
- I could overload get_object to query for the object based on the pk
and the fk of the user.
- Or should i use a package (from http://www.djangopackages.com/grids/g/perms/)
such as django-guardian?
Paul
--
You received this message because you are subscribed to the Google Groups
"Django
he user field of the
model.
I followed your example by overloading the get_queryset and that
really a simple solution to this issue.
Tests are running now; all 404's; great!
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
T
nyone with more experience than me :) give any directions how this
could look like? How can i work with mysql alongside mongodb in django for
example?
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on
ation is the solution for
this?
Thanks for any directions
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/urE06kkuNBIJ.
To post to thi
gic in the post-logic as well (so for example using custom
validation).
A simpler alternative is to remove the 'update' button altogether, but also
in this case the view should also throw a 404 or 500 just in case someone
manually modifies the url (which is by the way very easy to do
mixin for django-filter; i have a
mixin available but since it also fetches the queryset from get_queryset
i'm expecting that either the ordering or the filtering won't work!?
Anyone with mixin experience willing to give some directions?
Paul
--
You received this message because you
enumerate the model fields in a layout
Paul Bormans
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/5av7W0YQoS8J.
To post to this group, send email to dj
Hey all,
I'm just beginning to look into using django for a personal project. What
I'm wondering is if there are any plugins available or guides which could
help achieve the following functionality.
I want to develop a website with 'sub-sites'/user groups which users may
create and join. Thes
lay = ('id', 'value_unpacked',)
Actually modifying it is obviously more difficult as it can be ... anything
indeed
Paul
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails
w?
Thanks for any tips,
Paul Bormans
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group,
I have a Product model, an Image Model and a Category Model.
A Product can have multiple Images(Foreign Key) and a Product can be in
multiple Categories a Category can contain multiple Products.
A Category can have multiple subcategories(key to itself).
class Category(MetaData):
parent =
First, I know how copy and deepcopy from copy module work for a list.
I'm interested the role of __deepcopy special method inside a class.
I need to create custom widgets in Django and I try to understand the
python code behind.
class Widget(metaclass=MediaDefiningClass):
needs_multi
I have two models Categories and Products.
A Product can have multiple Categories, a Category can have multiple
Products.
The Categories have a circular Foreign key, to itself.
class Product:
categories = models.ManyToManyField(Category)
name = models.CharField(max_length=2
I have two models Category and Products.
- a Product can have multiple Categories
- a Category can have multiple Products.
- Categories have a circular Foreign key, to itself.
- not all Categories have the same depth level
Example:
Category A
- Category A_1
- category A_2
I have the following model:
class Image(models.Model): image = models.ImageField(upload_to=
file_upload_to)
I have a dynamic file_upload function:
def file_upload_to(instance, filename):
base = '_'.join([str(instance.item.pk), instance.item.slug])
return os.path.join('accounts', base,
I did, is not celery related.
The only thing, that maybe is influencing the path, is that the Image model
is used in an inlineformset.
On Wednesday, January 17, 2018 at 6:37:40 PM UTC+2, Matemática A3K wrote:
>
>
> b
> On Wed, Jan 17, 2018 at 12:17 PM, Paul >
> wrot
I have 2 models Product and Image:
class Image(models.Model):
product = models.ForeignKey(Product, related_name='images', on_delete=
models.CASCADE)
parent = models.ForeignKey('self', blank=True, null=True,
verbose_name='original
image', on_delete=models.CASCADE)
image = models.Ima
thanks, outside not in admin, I will check the links provided
On Saturday, July 9, 2016 at 10:52:38 PM UTC+3, ludovic coues wrote:
>
> If you are trying to do it outside of the admin, the previous link
> might not be exactly what you are look for. The doc on inlines formset
> [1] might be more u
By default Django’s class-based views support just a single form per view.
I need more forms per view because I want to combine a ForeignKey relations
with various ModelForm instances and also to appear in the FormModel.
In Django documentation and other tutorials I found formsets, but in the
thanks
On Monday, July 11, 2016 at 11:16:27 AM UTC+3, Mstislav Kazakov wrote:
>
> Try to override `delete` method in your model. You should do something
> like this:
>
> class Example(models.Model):
> f = models.FileField(null=True, blank =True)
>
>
> def delete(self,*args,**kwargs):
>
I'm searching for a good tutrial regarding "inlineformset_factory". the
information about it od Django site is very scarce.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send a
I have a model Product and a model Document. The document has a foreign key
to the product.
I want the user to upload multiple files in the same form for
adding/editing Product.
I modified and example from net, it is working, but not with a FileField.
I know that I need to add request.
I have a model Product which a Foreign Key to a Company model. The Company
Model has a OneToOne Relationship to user.
When a user submits a form to add product I need to associate the product
with the company of the user (the user doesn't need to add manually the
company in the form)
There ar
I have the following message when I try to use reverse or reverse_lazy:
The included URLconf 'ph.urls' does not appear to have any patterns in it.
If you see valid patterns in the file then the issue is probably caused by
a circular import
*When I use the urls (without using reverse or rev
I have a Product Model, foreign key to Company Model, onetoone key to User.
I override the dispatch(method) to check if the user has rights to edit the
object(product).
I'm trying to optimize the queries to the database because some of them are
duplicates.
def dispatch(self, request, *args, *
In a modern Continuous Delivery environment, it's expected that there is an
automated process for deploying code, and therefore performing database
migrations. This is all straightforward.
I haven't been able to find any good solutions for automatic rollback
though. The main problem that I see
t prior to production.
> Don't know of a solution integrated into django.
>
> On Friday, April 14, 2017 at 2:26:51 PM UTC-4, Andrew Godwin wrote:
>>
>> Hi Paul,
>>
>> I have tried this in the past, but it's basically an unsolvable problem
>> in t
I've just hit a tricky migration case, and I'd like to check I'm not
missing something. The summary is that merge migrations make it possible to
add migrations which cannot be unapplied, even if they are the latest
migration to be run.
With the migration graph:
M1
|
+--+
| |
M2a M2b
I have a Product Model and Image Model with a Foreign key to the product
model.
So in a form for Product creation I will have/need multiple Image File
Upload inputs.
I want to replace the default Image file-upload form field with a Image
(like a plus sign, like add a new image, using a w
I'm trying to validate mime types of files uploaded with a predefined list
of validate mime types.
I need to do the check the file in the buffer before save, even if they are
faked or no extensions.
1. python own mimetypes package seems to "guess" only base on extension
2. magic-pytho
I want to do file validation(size,type) on a field on inlineformset.
class ProductDocumentModelForm(ModelForm):
class Meta: model = ProductDocument
fields = ['document']
def clean_document(self):
file = self.cleaned_data['document']
validate_file(file, 'document')
Becau
I have Product and Categories. A product can be in multiple categories and
off course a Category have multiple products.
The Categories can have Subcategories’ which can have Subcategories. I used
a Category Model with a circular Foreign Key.
Each Product can have specifications/attributes
I’m using inlineformsets for an Image Model in combination with a Product
Model.
For the Image Model (using javascript):
1) a remove/delete button will be available to remove an image; the image
can be remove not only on edit, but also on creation(the use upload the
image, but before savin
I have a form with two inline formsets.
.
At the HTML level Django use the hidden fields for the formset management,
and use the prefix to know which fields are related to a formset.
Also it has ids in the html id, to group like in a virtual form the fields.
On retrieve by default I
Hi folks,
I am a newforms newbie who is currently porting a .96 project over to
1.0
I have been trying to coerce the examples in the Django documentation
to
accommodate creating a "Document" .
I have three models:
Document, DocPart --> These are in the doc module. DocPart is an
intermediary
Par
Hello Steve,
SOAPy appears to be moribund. I was once using it within a Python SOA
I'd worked with and chose to abandon it when we moved that system to
Python 2.5. It wasn't an issue for us as SOAP was going nowhere (for
us anyway).
Good news for you (possibly) is the SOAP infrastructure generally
I am converting from .96 to 1.0.
In a template using 0.96, if I wanted to get the value that a
particular field was holding I would use:
{{ form.data.field_name }}
This doesn't work anymore and is breaking my code.
I have tried a number of other ways (guessing mostly), consulted the
docs and br
f valid) ---> Didn't apply so
I didn't try it
form.initial.fieldname (values set for initial) ---> WORKED!!! Thank
you Doug B
On Dec 12, 12:47 pm, Paul Childs wrote:
> I am converting from .96 to 1.0.
>
> In a template using 0.96, if I wanted to get the value that a
> parti
Does anyone know of a better/newer module for creating SOAP services
and not just a client?
BTW, nice find with Suds - this is most helpful!
regards,
/p
2008/12/12 Steve :
>
> Hello Jarek,
>
> That did the trick! I'm still curious to get ZSI working but suds was
> simpler. Here's my first funct
l
>
> {%if is_extend %}
> extend
>
> {# pagination code #}
>
> next previous
>
> as result, there is only one param add in url, either
> is_extend or page
>
> so, how to bind all them in url?
>
> thanks
Should be fairly obvious.
Have fun,
--
Paul
# shrink the page
elif is_extend == 'expand':
# expand the page
Then you have a similar piece of code to handle the 'page' parameter and
so forth.
IMO you shouldn't have too many parameters in the path part of the URL -
the bit be
most projects follow without
repeating the application structure elsewhere or having to do terrible
things to settings.py.
My question is: is the second idea Django-ish enough? I'd like some
feedback from the list before I start work on it as to whether it's a
dead end, whether ther
your templates from.
Just a thought,
--
Paul Wayper
SYSTEMS ENGINEER
TransACT
Telephone: 02 6229 8026
Mobile: 0422 392 081
PO Box 1006, Civic Square ACT 2608
www.transact.com.au
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
gt;>> foo = [1,2,3]
>>> print 'x%sx' % foo
x[1, 2, 3]x
shows that stringifying a list should print the list as you'd expect.
But this may lead you to a solution.
Hope this helps,
--
Paul Wayper
SYSTEMS ENGINEER
TransACT
Telephone: 02 6229 8026
Mobile: 0422 392 081
or raise a DoesNotExist error. You may
want to look into the 'get_object_or_404' helper.
Have fun,
--
Paul Wayper
SYSTEMS ENGINEER
TransACT
Telephone: 02 6229 8026
Mobile: 0422 392 081
PO Box 1006, Civic Square ACT 2608
www.transact.com.au
--~--~-~--~~~-
ordering = ['title']
A ModelForm, by default, gives me a multi-select box for watchers. Is my best
approach to write my own widget to have them type in a comma separated list of
emails? How could I handle email addresses for
Working examples in djangobook /1.0 chapter06
Can not get the Admin Interface to display using suggested urls.py /
settings.py
#urls
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^admin/', include('django.contrib.admin.urls')),
)
#settings.py - # snip
ROOT_URLCONF =
Django 0.96 / mySQL / Apache2 / Ubuntu 8.04
I have created a "wizard" for data input. Rather than have one huge
form I have spread it out over a number of views/templates. After the
user submits data and it has been validated, each view places the
"new_data" into the request.session and redirects
sible with Django too?
Paul
--~--~-~--~~~---~--~~
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 t
How to I get the value from a class verbose_name in a models.Model
based generic list?
I.E. I want to use the value in a class element verbose_name for a table header
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
One option is to create a new table that is a mirror of the target table
except the new table should NOT have any of the keys enabled. Using a bulk
load tool add the data to the new table. Then add the keys to the new
table. Drop the old table and rename the new table to the original target
tabl
e the
Application/Admin more seamless?
* Is there a standard model for running automated tasks? I was thinking
about a cron task that uses lynx or curl to call a URL that performs the
task, but that gets kind of ugly. Is there a better way to do this?
Thanks in advance for your insights!
1 - 100 of 567 matches
Mail list logo