How about checking for the existence of course_id in the view? Then if
it's blank you just send request.POST and if not you grab the instance
in the view and pass it as the instance kwarg.
Alternately you could do the same in the __init__ of the modelform,
before you call the super __init__. It de
Hi,
I'm having trouble figuring out the best way to use ModelForm in the
following situation. I have these post variables coming into the view
course_id
course_department
course_number
And course_id may or may not be an empty string.
If I do
course_form = CourseForm(request.POST)
Then the pro
On 6/09/2011 5:46am, Mario8k wrote:
Hello,
Does anyone knows some solution (reusable app, snippet or any idea) to
model an authorization workflow of data?
That is... supose that a user have restricted some model field, ie,
cannot edit directly this field. And now supose that he could request
to
I use TabularInlines for Many-to-Many join tables, with the foreign
keys appearing in select lists. The Admin interface automatically
provides the stellar "Add-Another" icon (a plus sign) with the select
list, to add a new parent record on the fly. It would be extremely
useful to also have an edit
Never mind. I've found the answer. The problem was that my app name
"messages" somehow clashed with the app "django.contrib.messages"
which was earlier in my INSTALLED_APPS. This didn't prevent my
project from working, but did confuse the test framework, which looked
in "django.contrib.messages"
Figured it out: gotta run autodiscover().
--Steve
--
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...@google
I'm sorry for my inconsistency. I tried to "simplify", but made a
mistake. In fact, I used the app "messages" throughout, in my code
and in the test command. The project containing the app works fine.
In particular, the app "messages" is included in INSTALLED_APPS.
So, if the test "should work"
I'm dutifully following the instructions at the django tutorial
(https://docs.djangoproject.com/en/1.3/intro/tutorial02/). I have
amended admin.py and urls.py as indicated and restarted the server;
however, the admin website does NOT provide any interface to the polls
app. Instead, it tells me: "Si
I don't know if anyone has said this outright, but I think that
ChoiceField and ModelChoiceField are just broken.
It seems that every time I want to do something with them I'm having
to write a custom init function get what I want done.
As a community I think we should be able to improve the "gen
You could use a model with three fields:
A generic foreign key to the instance to be modified.
A char field containing the fieldname on that instance.
The new value.
Of course you'd need another field to store the user (assuming the
person making the authorization will base their decis
Hello,
Does anyone knows some solution (reusable app, snippet or any idea) to
model an authorization workflow of data?
That is... supose that a user have restricted some model field, ie,
cannot edit directly this field. And now supose that he could request
to change that field, seeing the real c
Can you please take a look at here:
http://stackoverflow.com/q/7312029/886669
--
http://yasar.serveblog.net/
--
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 fro
try this
def get_file_path(instance, filename):
path = 'your upload directory'
extension = filename.split('.')[-1].lower()
new_file_name = self.id
return '%(path)s/%(filename)s.%(extension)s' %
{
Hi all
I know this is a bit of a corner case, but I was slightly surprised by
the behaviour of DecimalField with the value -0.0. Given the model:
class Word(models.Model):
word = models.CharField(max_length=50, unique=True)
number = models.DecimalField(max_digits=8, decimal_places=5)
Hello,
I have a model that includes a FileField. When the user uploads a file
via the admin interface, I want the file to be saved as 'upload_to/
primary_key/original_filename'. Since the object will not be saved in
the database when the user uploads the file, it will not have a
primary key at tha
I forgot to mention that i have imported models like this:
import django.db.models as m
This should explain the first two lines.
On Mon, Sep 5, 2011 at 12:28 PM, Stratos Moros wrote:
> Hello,
>
> I have a model that includes a FileField. When the user uploads a file
> via the admin interface, I
On Mon, Sep 5, 2011 at 6:17 PM, Paul Walsh wrote:
> Anyone?
> I really want to use class-based views, but it is hard with so much missing
> in terms of examples/tutorials.
Hi Paul,
First off, apologies for the current state of the Class-based views
documentation. It's one of the known weak point
> Exception Value: Reverse for 'entry' with arguments '('my 1st post',)'look at
> urls.py
> Date: Sun, 4 Sep 2011 22:25:50 -0700
> Subject: sitemap
> From: veva...@yandex.ru
> To: django-users@googlegroups.com
>
> Would You please help me to find a mistake?
> --- blog.model.py:
> from djan
On Sep 4, 7:20 pm, Kevin Anthony wrote:
> hi, how do i join two models on something OTHER then the primary key?
You didn't search for long, did you ?
https://docs.djangoproject.com/en/1.3/ref/models/fields/#django.db.models.ForeignKey.to_field
Please do the minimal required homework before askin
On Sep 5, 5:18 am, Rodney Topor wrote:
> I'm trying to use unit tests for the first time.
>
> In app/tests.py I have:
>
> import unittest
> from django.test.client import Client
>
> class IndexTest(unittest.TestCase):
> def test_index(self):
> client = Client()
> response = cli
Take a look at Sentry: http://readthedocs.org/docs/sentry/
It works pretty well, uses polling to update the log view, can track
multiple sites with separate Sentry Server, etc.
Good luck,
Uros
On Sep 5, 12:58 am, Gelonida N wrote:
> Hi,
>
> Im am debugging a django application.
>
> If I set DE
I did change the model from DateField to DateTimeField, removed the
table, synced the database and restarted the wsgi instance. As I found
out I should have restarted the wsgi server right after deleting the
table from the database.
The second time I did remove, recreate and restart in the same
se
On 2011-09-05, at 14:08 , Jirka Vejrazka wrote:
> OK - I can't see anything wrong with your code that'd jump at me. Can
> you check your database table format? Maybe you've declared your model
> fields as models.DateField first and then changed to DateTimeField
> without changing the underlying tab
OK - I can't see anything wrong with your code that'd jump at me. Can
you check your database table format? Maybe you've declared your model
fields as models.DateField first and then changed to DateTimeField
without changing the underlying table? Just a guess :)
Jirka
--
You received this mess
On 2011-09-05, at 13:13 , Jirka Vejrazka wrote:
> Can you tell us what is the "[0:6]" supposed to be doing in your time
> conversion funcions?
strptime returns a struct_time[0] which is a 9-tuple.
The datetime constructor takes up to 8 arguments, but the last 2 are
microseconds and a tzinfo obje
On 5 sep, 13:40, bik...@gmail.com wrote:
> Just call it a hunch, but can you try [0:8] please..?
I get this error in that case
TypeError: tzinfo argument must be None or of a tzinfo subclass, not
type 'int'
I think that the strptime works correctly, because the returned
datetime is: datetime.date
Just call it a hunch, but can you try [0:8] please..?
Sent from my BlackBerry® from Vodafone
-Original Message-
From: "het.oosten"
Sender: django-users@googlegroups.com
Date: Mon, 5 Sep 2011 04:30:44
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: time part of dat
It is a python 2.4 workaround for using strptime. Without the '[0:6]'
I get this error:
TypeError: function takes at most 8 arguments (9 given)
--
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@goo
Can you tell us what is the "[0:6]" supposed to be doing in your time
conversion funcions?
--
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
Oh btw, it is all about importing a facebook eventcalendar (in
icalendar format) into a database.
--
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,
Here is a code dump (still work in progress :-) ):
http://pastebin.com/szQKRw7d
--
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
Anyone?
I really want to use class-based views, but it is hard with so much missing
in terms of examples/tutorials.
thx.
--
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
*dump your code ?! *
*BTW, *
*You can set auto_now_add = true in the model, which will assign the current
datetime, while saving without any code at all.
*
On Mon, Sep 5, 2011 at 11:54 AM, het.oosten wrote:
> I have a model start = models.DateTimeField()
>
> In my view I create a datetime:
> x =
I have a model start = models.DateTimeField()
In my view I create a datetime:
x = datetime.datetime(*(time.strptime(str(component.get('dtstamp')),'%Y
%m%dT%H%M%SZ')[0:6])) .
This return a valid datetime:
>>> x
datetime.datetime(2011, 9, 4, 8, 45, 32)
The problem is that only the date part is sav
On 09/05/2011 03:05 AM, Reinout van Rees wrote:
> On 05-09-11 02:25, Gelonida N wrote:
>> I see my own log traces.
>> In many situations I do see error messages in the log output.
>
> An important thing that's not mentioned too clearly in Django 1.3's
> logging docs: *add a root logger*. So a logg
35 matches
Mail list logo