for client facing POST
requests?
On Sunday, August 14, 2016 at 6:35:49 PM UTC-5, Alex Heyden wrote:
>
> forms.Form makes front-end widgets and some validation logic. models.Model
> defines a database interface and wraps it in a Python class. The two have
> nothing to do with each othe
forms.Form makes front-end widgets and some validation logic. models.Model
defines a database interface and wraps it in a Python class. The two have
nothing to do with each other aside from vaguely similar APIs for defining
the classes.
The intersection of the two is forms.ModelForm, which uses a
Would someone explain to me when you would choose one class over the other?
Does forms.Form not create a database? Can't you just render models.Model
as a form?
I understand forms.ModelForm is a helper class for creating a form from a
model. But I still don't really understand why
I have finally found the time to work on this issue. There is a patch
in the ticket (https://code.djangoproject.com/ticket/20289), and I
think the patch does solve the regression.
I didn't find a simple test case that works in 1.4 but fails in 1.5.
If anybody knows how to reproduce the original re
On 18 huhti, 22:07, Greg H wrote:
> Running into a similar issue on my own project, seems to be when you try an
> cache a model which has a related model which in turn has a many to many
> field. So for example, I have an instance of a Student, which has a
> ForeignKey to Book, which in turn has a
ango-audit-log>witch
> actively creates dynamic models by calling type('%sAuditLogEntry'
> % meta_name, (models.Model,),
> attrs)<https://github.com/SirAnthony/django-audit-log/blob/master/audit_log/models/managers.py#L201>.
>
> In django 1.5 I getting error when
Hello,
I'm using django-audit-log
<https://github.com/SirAnthony/django-audit-log>witch actively creates dynamic
models by calling type('%sAuditLogEntry'
% meta_name, (models.Model,),
attrs)<https://github.com/SirAnthony/django-audit-log/blob/master/audit_log/models
; object programming curve ...
>
> OK, then to be sure how Python works ... let see this code:
>
> 1 from django.db import models
> 2
> 3 class Person(models.Model):
> 4 first_name = models.CharField(max_length=30)
> 5 last_name = models.CharField(max_length=30)
>
>
from django.db import models
2
3 class Person(models.Model):
4 first_name = models.CharField(max_length=30)
5 last_name = models.CharField(max_length=30)
Ligne 1 imports module "models". I've browse the source code of Django. In
the "models" folder, there is a __in
On Monday, 17 October 2011 12:18:00 UTC+1, youpsla wrote:
>
> hello again, sorry for eventually annoying. But later in the Django
> tutorial,
>
> there is this code:
>
> from django.conf.urls import patterns, include, url
> .
> urlpatterns = patterns('',
ot;max_length" parameter of
> class CharField. This parameter is used by an internal method of class
> CharFiled. Is that right ? :-)
>
> Thanks again to all
>
> Regards
>
> Alain
>
I'm having a little difficulty understanding your question (problème de
traduc
> first_name and last_name are instances of CharField.
>
> There's no functional programming here.
>
> -WN.
>
>
>
>
>
>
>
> On Sun, Oct 16, 2011 at 6:43 PM, youpsla wrote:
> > 1 from django.db import models
> > 2
> > 3 class Person(models.Model):
-WN.
>
>
>
>
>
>
>
> On Sun, Oct 16, 2011 at 6:43 PM, youpsla wrote:
> > 1 from django.db import models
> > 2
> > 3 class Person(models.Model):
> > 4 first_name = models.CharField(max_length=30)
> > 5 last_name = models.CharField(max_length=
t; 2
> 3 class Person(models.Model):
> 4 first_name = models.CharField(max_length=30)
> 5 last_name = models.CharField(max_length=30)
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
example of code because things are not so clear for me.
>
> Here is the code example
>
> 1 from django.db import models
> 2
> 3 class Person(models.Model):
> 4 first_name = models.CharField(max_length=30)
> 5 last_name = models.CharField(max_length=30)
>
&
db import models
2
3 class Person(models.Model):
4 first_name = models.CharField(max_length=30)
5 last_name = models.CharField(max_length=30)
Can you say me if I'm wrong or not on the followings:
- line 1 : Import of the" models" method from the "django.db"
module ?
Discovered that save_model() is still available even if I don't
inherit admin.ModelAdmin, which avoids the metaclass conflict.
On May 31, 10:36 am, Lee wrote:
> I'm trying to create a class that inherits from both models.Model and
> admin.ModelAdmin, so that I can use models.Man
I'm trying to create a class that inherits from both models.Model and
admin.ModelAdmin, so that I can use models.ManyToManyField and
save_model() from admin.ModelAdmin. Unfortunately this combination
gives "metaclass conflict: the metaclass of a derived class must be a
(non-strict) subcl
No, I don't talk about model inheritance. Mainly because base class
fields are propagated to subclasses. I'd like to overload some base
methods of the "models.Model" class to making them available from all
classes of a model.
But a metaclass mechanism makes overloading impossib
Are you asking about factoring out certain common functionality shared
between models? It's quite common; for example most of my projects
have something like this as a starting point for many models:
class DatestampedModel(models.Model):
created = models.DateTimeField(default=datetim
Hi everybody,
Is there a way to subclass the 'models.Model' class behavior to
extend
base functionnalities and attributes to all classes contained in an
application model ? It seems that the metaclass mechanism force the
Python inheritance notation to a Database model inheritanc
On Mon, Dec 28, 2009 at 5:15 AM, Karen Tracey wrote:
> On Sun, Dec 27, 2009 at 11:08 PM, Marc Aymerich wrote:
>
>> hi guys!
>>
>> I'm writing my first project with django and I have doubts in how to
>> declare a constraint unique for two fields of the same tabl
On Sun, Dec 27, 2009 at 11:08 PM, Marc Aymerich wrote:
> hi guys!
>
> I'm writing my first project with django and I have doubts in how to
> declare a constraint unique for two fields of the same table using
> models.Model.
>
See:
http://docs.djangoproject.com/en/1.1/ref
hi guys!
I'm writing my first project with django and I have doubts in how to declare
a constraint unique for two fields of the same table using models.Model. In
MySQL would be something like:
CREATE TABLE `virtual_aliases` (
id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
domainid INT(11
2009/2/7 Frank Becker :
Hi,
> My question: I have a CommonInfo(models.Model) and I do subclassing it for a
> couple of models. Getting CommonInfo.objects.all() returns a list of all
> objects of CommonInfo and it's subclasses. Q: How to determine what subclass
> the
> obj
Hi,
First of all thanks for the Django framework. It's fun to work with it.
My question: I have a CommonInfo(models.Model) and I do subclassing it for a
couple of models. Getting CommonInfo.objects.all() returns a list of all
objects of CommonInfo and it's subclasses. Q: How to dete
have a model like this:
>
> > ---
> > class Test(models.Model):
> > testname = models.CharField(max_length=60, null=False,
> > blank=False, unique=True)
> > [... some more fields ...]
> > def __str__(self):
> > return self.testname
&
On Thu, Jan 8, 2009 at 6:14 PM, adrian wrote:
>
> hi,
> i am posting here to follow the "i found a bug" guide ...
>
> let's assume i have a model like this:
>
> ---
> class Test(models.Model):
>testname = models.CharField(max_length=
hi,
i am posting here to follow the "i found a bug" guide ...
let's assume i have a model like this:
---
class Test(models.Model):
testname = models.CharField(max_length=60, null=False,
blank=False, unique=True)
[... some more fields ...]
def __str__(self):
", line 3
>
>class Poll(models.Model)
>
> ^SyntaxError: invalid syntax
>
> i'm working with the tutorial code here:
> http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3
>
> any ideas what's gone wrong?
>
>
Assuming the caret i
ad_app(app_name, True)
File "/usr/lib/python2.4/site-packages/django/db/models/loading.py",
line 72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
File "/usr/local/django-apps/mysite/../mysite/polls/models.py", line 3
clas
On 6/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Advice?
Model inheritance is a planned, but not-yet-implemented feature. Watch
this space!
http://code.djangoproject.com/wiki/ModelInheritance
However, there is a workaround, using OneToOneFields.
http://www.djangoproject.com/document
I hope the subject isn't too confusing but what I want to do seems
pretty
common so I think I might be missing something obvious (or should be
doing
in a different way)
class Person(models.Model):
name = models.TextField()
def get_whatever:
Thanks a lot James,
I've just tried the same modifying an existing file of the cheeserater
source code: to be precise I added the following lines:
class Person(models.Model):
pass
at the end of the file models.py under c:\cheeserater\packages but I
still get the same error
Ma
On 4/9/07, checco <[EMAIL PROTECTED]> wrote:
> Then, these really basic statements give me this error:
>
> >>> from django.db import models
> >>> class Person(models.Model):
> pass
This is somewhat counterintuitive unless you know a bit about how
> import os, sys
>>> os.environ['DJANGO_SETTINGS_MODULE'] = 'cheeserater.settings'
>>> sys.path.append("C:\\")
(The cheeserater package is under the C drive.)
Then, these really basic statements give me this error:
>>> from django.db import
nt:
CHOICES = ()
comment = models.TextField()
choice = models.charField(choices=CHOICES)
class VideoComment(models.Model, Comment):
CHOICES = (('a', 'Apple'), ('p', 'Pear'))
video = models.ForeignKey(Video)
class UserComment(models.Model,
Hi,
some time ago i did something similar and wondered to get some problems
using
the query manager. So when i used
class Comment(models.Model):
class VideoComment(Comment):
and then asked
VideoComment.objects.get(id='xyz')
the Manager tried to to look up the Comment Table
My solut
On 6/28/06, spako <[EMAIL PROTECTED]> wrote:
> is there a way to achieve this? or should i not bother and just do have
> a Comment Model and just have VideoComment and UserComment have a
> OneToOneField to Comment?
Generally when you want to do something like this you define only one
model, and a
A Comment class and the new GenericForeignKey() seems like a good
idea. Allows you to have one Comment model and have it applied to
other models (like Video and User).
I haven't used the GenericForeignKey(), but from what I've read
about it... should fit your problem.
On 6/28/06, spako <[EM
=True)
class VideoComment(models.Model, Comment):
video = models.ForeignKey(Video)
class UserComment(models.Model, Comment):
user = models.ForeignKey(User)
i've also tried a variation, by declarinthe classes like this (the
contents of the classes are the same as above):
class Comment(mo
41 matches
Mail list logo