I'm just getting familiar with Django and I think I've got all the
basics... and I have lots of experience with Python and MySQL, but I'm
having a hard time figuring out how to do something that would be easy
for me in plain Python. One of the problems I keep finding with
various pieces of docume
I'm hoping to use Django with a legacy database and I'm suspecting
that things are not working as they should because the database has
tables that lack the "id" column that Django generates from the same
model. Searching the documentation, I don't see anything that
indicates this is required, but
On Mon, Nov 2, 2009 at 3:30 AM, Julien Petitperrin <
julien.petitper...@gmail.com> wrote:
> Hello,
>
> I had this kind of issue a few days ago. I found this:
>
>
> http://collingrady.wordpress.com/2008/02/18/editing-multiple-objects-in-django-with-newforms/
>
> I hope this helps you to find a way
I find myself frequently frustrated by examples and tutorials that include
code snippets that don't identify where they live. In particular, I haven't
quite figured out where forms usually are defined and then where they need
to be imported.
I see that forms sometimes are in a file called forms.p
On Tue, Nov 3, 2009 at 11:26 AM, f4nt wrote:
>
> forms.py is pretty standard. You'd end up importing them in your
> views.py.
Thanks... that's what I was guessing. But it appears to me that I sometimes
see ModelForms in models.py... wondering if that's typical.
Nick
--~--~-~--~~-
On Wed, Nov 11, 2009 at 6:48 AM, andreas schmid wrote:
>
> i would need something like:
>
> jan feb mar apr may
> 2007 [...] [...] [...] [...][...]
> 2008 [...] [...] [...] [...][...]
> 2008 [...] [...] [...] [...][...]
>
> i dont think
On Wed, Nov 11, 2009 at 11:28 PM, andreas schmid wrote:
>
>
> ok this is fine for the form representation but how should i extend my
> model to define the field i am going to multiply 12 times a year for x
> years? (actually im using generic create_update view to get the form out
> of the model)
>
On Tue, Nov 17, 2009 at 7:17 AM, Ilya wrote:
> I just developed some code like:
> MyModel.objects.filter(key_to_mymodel2 = MyModel2.objects.all()))
> This query produce SQL:
> SELECT * FROM `test_mymodel` WHERE key_to_mymodel2_id =(select `id`
> from `test_mymodel2`)
>
> It works fine on SQLLite
On Tue, Nov 17, 2009 at 9:03 AM, Ilya Polosuhin wrote:
> I don't fully understood your question. Of course I have more than one row
> at test_mymodel2
> SQL query was formed by django-ORM. I just call
> print (MyModel.objects.filter(key_to_mymodel2 =
> MyModel2.objects.all()))._as_sql())
> and wri
I can't see to figure out how to do something fairly simple - set the
initial value of a model form field at runtime. The form is a simple set of
radio buttons that lets the user choose which project to work on. I'm
storing the selection in a session variable and that's working fine. What I
can'
On Wed, Nov 18, 2009 at 2:01 AM, Ilya Polosuhin wrote:
> Just use "initial" keyword on creation form
> class myForm(forms.Form):
> test = forms.CharField(label = _('test'), max_length=255, required =
> True)
>
> myForm(initial = {'test': 'test string'}).
>
> If you use form that generated
I'm not sure if this is a bug... couldn't find anything quite like it in the
tracker. I'm using Komodo as my IDE. When I step through source, the
filters in a Model.objects.filter method are ignored. Instead of getting
the handful of rows that I want from my database, Django (1.1) grabs the
enti
I have a form that I've tried creating a couple of ways, including as a
ModelForm, which doesn't seem to want to perform an UPDATE operation. I'm
hoping for some help here... If I create it as a ModelForm, it doesn't
validate, I'm guessing because the form doesn't include the foreign keys in
the m
On Sat, Nov 21, 2009 at 7:09 AM, Carlos Ricardo Santos <
carlosricardosan...@gmail.com> wrote:
>
>
>>
>> Obviously I can't use that number in font-size (150pt is too big) and
>> I have to make a proportion (150 -> 20pt, 1 -> 5pt, 50 ~>10pt and so
>> on).
>>
>> How can I accomplish that?
>>
>>
What
On Thu, Nov 26, 2009 at 9:37 AM, cerberos wrote:
> I have a model that has two fields (Django 1.1.1)
>
> class FooBar(models.Model):
>foo = models.ForeignKey('Foo')
>bar = models.ForeignKey('Bar')
>
>class Meta:
>unique_together = (('foo','bar'),)
>
> When is_valid is called i
On Sat, Nov 28, 2009 at 3:21 PM, Mikey3D wrote:
> Windows 7:
>
> My project is in: C:\Python26\Lib\site-packages\mysite
>
> I'm working on this section: Playing with the API
> http://docs.djangoproject.com/en/dev/intro/tutorial01/#playing-with-the-api
>
> When I do (Windows+R >cmd >OK) to do pyth
On Sat, Nov 28, 2009 at 3:05 PM, Gloria wrote:
> Hi all,
> I've spent way too much time getting trying to get this widget to work
> the way I am envisioning.
> In the forms, I want to initialize it, but in the view I need to
> determine which boxes are checked.
> Has anyone done this without writ
On Sun, Nov 29, 2009 at 9:52 AM, Gloria wrote:
> Thanks for the response. I am trying to do this on the server side.
> Here is more detail.
> I am initializing it to all unchecked checkboxes in my forms.py.
> Then, in my view, I am trying to have HTML generate a "checked" value
> for certain chec
On Sun, Nov 29, 2009 at 2:24 PM, The New Hanoian wrote:
> Hi,
>
> I'm learning Django. In the tutorial i find that the client IP address
> can be retrieve through HttpRequest.META["REMOTE_ADDR"]. But I
> couldn't find a way to retrieve the client port number. I think it
> should be obvious. Am I m
On Sun, Nov 29, 2009 at 4:01 PM, Steve Holden wrote:
>
>
>> Not at all. The client will typically use an "ephemeral" port (one it
> obtains by saying to its local TCP layer "gimme a port number, I don't care
> what it is"). The connection (any connection) has *two* endpoints, and the
> port numb
On Sun, Nov 29, 2009 at 8:30 PM, Gloria wrote:
> Here's the line from my model:
> class UserProfile(models.Model):
>some other fields...
>privacy_options = models.ManyToManyField(PrivacyOption,
> blank=True, null=True, db_table = 'usr_privacy_selection')
>
> Here's the bit from my form:
>
On Wed, Dec 2, 2009 at 2:04 PM, Jeffrey Taggarty wrote:
> Hi,
> I am having difficulties with listing this type of data. Scenario is
> as follows:
>
> 1) user1 add's a friend called user2
> 2) user2 confirms that user1 is his friend
>
> what should happen is user2 and user1 see's each others name
On Wed, Dec 2, 2009 at 6:08 PM, Jeffrey Taggarty wrote:
> Hi guys, thanks for responding. I didn't want to have to create 2
> entries in the database for a friendship because of the obvious
> integrity issues such as friendship deleting and friendship
> relationships to files etc seems like a
On Thu, Dec 3, 2009 at 9:05 AM, Todd Blanchard wrote:
> Forms seem nifty, but sometimes I want to display the data in the same
> format but readonly. Is there a to do this? I can't seem to find it.
I found this gizmo for doing that sort of thing:
class ShowOnly(forms.Widget):
"""
Sho
On Thu, Dec 3, 2009 at 2:50 PM, Todd Blanchard wrote:
> I'd gotten nearly a dozen responses to a later question so I figured the
> threshold of awareness had passed on this one.
Never assume correlation implies causation... ;-)
Nick
--
You received this message because you are subscribed to
On Fri, Dec 4, 2009 at 12:56 PM, Christophe Pettus wrote:
>
> On Dec 4, 2009, at 12:37 PM, Phlip wrote:
>
> > could such a method
> > call only send one SQL command?
>
> If you are using PostgreSQL as a back-end, it has a very efficient
> command TRUNCATE for just such a purpose, which you could
On Wed, Dec 9, 2009 at 11:18 AM, HUANG Dong wrote:
> Thank you, Bruno. Your answer is really helpful and covered another
> issue I hadn't noticed yet. But my question may be related to
> different topic. In my example, number of "libraries" is unknown in
> develop time, neither does the classi
On Fri, Dec 11, 2009 at 11:36 AM, Zeynel wrote:
>
>
> So, it seems that, according to documentation, syncdb will create the
> new tables?
Yes, it will create *new* tables. It will not alter existing tables.
If you don't need to save your existing data, the easiest thing is to drop
the old dat
On Sat, Dec 12, 2009 at 7:24 AM, dundeemt wrote:
> I need to access data in other databases. I don't want them listed in
> model.py as I won't be using django's orm for them. Given this, where
> is the preferred place to put the db connection for this data? The
> only references I could find sh
On Thu, Apr 22, 2010 at 6:45 AM, thanos wrote:
>
>
>
> Finally just recently SEC announced that they might require regulatory
> files to be submitted in Python and not in legal English.
> Their rational is that Python is less ambigious and the English and
> more clean, readable and structured tha
I'm stuck on a problem with encoding (or possibly decoding).
I'm extracting dates from web pages with regular expressions. Now I want to
parse those dates into Python date objects. Generally speaking, this is no
big deal. It takes some effort because I'm dealing with a number of
different date
On Wed, Apr 28, 2010 at 8:09 PM, Continuation wrote:
> I'm using MySQL with Django.
>
> MySQL uses clustered index. I have a class AuctionBid for which the
> "natural" PK is (user_id, auction_id).
>
> I'd like to set (user_id, aucton_id) as the PK so that it'll be the
> clustered index. I understa
On Sat, May 1, 2010 at 11:13 AM, Continuation wrote:
>
> On Apr 30, 9:42 pm, Nick Arnett wrote:
>
> > If you don't have data in the table, just drop it and use
> "unique_together"
> > in models.py to define your composite key. You'll find that i
On Sat, Jun 19, 2010 at 9:21 AM, zweb wrote:
> I need to implement search solution over models in mysql.
>
> Anyone has experience with both or has gone through same decision
> making?
>
> What should I consider before choosing one or other?
I'm making a similar decision... as far as I can see,
On Sat, Jun 19, 2010 at 9:21 AM, zweb wrote:
>
> (Mysql text search will not work as I use INNODB. Solr is powerful but
> I heard it is very memory hungry and it is in Java. Whoosh is not yet
> as mature as others. So that leaves choice between Django Sphinx and
> Haystack Xapian.)
I meant to m
On Mon, Jun 21, 2010 at 2:12 AM, ALJ wrote:
> I'm just starting out with Django so using an hourly rate isn't really
> applicable because I'm going to be much slower that a 'real'
> developer. So far I've spent about 6 months part time.
>
> What kind of ballpark amounts would people suggest this
On Mon, Jul 19, 2010 at 10:01 AM, Tereno wrote:
> Web Faction does look like an interesting option. However, looking at
> the memory specs, how would I be able to tell if it's sufficient for
> at least 2 Django applications? For example, if I got with Shared 1, I
> get 80MB (180MB VPS) - I'm assu
I'm thinking that I could get a pretty good performance improvement on a
couple of tables by moving their LONGTEXT columns into their own tables.
Just wondering if there's anybody here who has done something like that - is
there a way to do this transparently to Django, so I don't have to re-write
On Mon, Aug 2, 2010 at 2:34 PM, Steve Holden wrote:
>
> Another alternative would be to create a view of the joined tables using
> SQL CREATE VIEW, then treat the view as a table in Django. You do have
> to be careful that the view should be updatable, though.
Ah... I didn't think of views. Ha
On Mon, Aug 2, 2010 at 9:39 AM, Antoni Aloy wrote:
> My first thought would be to backup the database, then put the project
> under South control. Then create a one-to-one relation between models
> and the possible create a upgrade script.
> Then, if necessary, you could create properties in the
On Sun, Jul 18, 2010 at 10:19 AM, Biju Varghese wrote:
> Eclipse is the best IDE for python and django.
>
>
I don't know if it is actually the best, but I'm happy with it.
Nick
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this gr
I'm having a problem that I can't figure out from reading the docs. I have
a loop that runs the same query every five minutes, to see if there is new
data to process. However, it doesn't return the new data the second and
subsequent times it loops. It's something like this:
while 1:
data =
On Sun, Aug 8, 2010 at 11:52 AM, Daniel Roseman wrote:
>
>
> Where is this query running - in a view, or an external script? And
> how is the data being added to the db?
In both cases -- adding data and analyzing -- it is an external script,
using the Django ORM.
Nick
--
You received this mes
On Sun, Aug 8, 2010 at 3:09 PM, Karen Tracey wrote:
>
> Probably you are seeing the effects of the default transaction isolation
>> level on MySQL/InnoDB, which is "repeatable read". See
>> http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06dfor
>> more explanation.
On Mon, Aug 9, 2010 at 1:50 PM, John Fabiani wrote:
> Hi,
> I recently registered for the group and I must have done something wrong
> because I am receiving every posting twice (duplicates). Can someone fix
> the
> problem or direct me to where I can fix it.
>
>
Have you looked at the headers o
On Tue, Aug 24, 2010 at 7:43 AM, Sithembewena Lloyd Dube
wrote:
> Thanks Reinout. I have been seeing a lot of discussions regarding South
> lately - time to dive in and find out what it is and what it means for me.
>
> I was under the impression that Django would add a field to my table. So,
> is
I was tackling this problem recently and found several approaches by
searching for Django login form. I ended up using a middleware solution
that brings up a login page no matter where the user tries to go, then
redirects them to the page they were trying to view... but that only makes
sense if yo
On Thu, Sep 30, 2010 at 8:34 AM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:
> Is there any way to make a FULL TEXT search not in BOOLEAN MODE?
> I've found only
> http://docs.djangoproject.com/en/1.1/ref/models/querysets/#search
>
> It says it uses BOOLEAN MODE as a default, but doesn
On Fri, Oct 1, 2010 at 3:52 AM, Alessandro Ronchi <
alessandro.ron...@soasi.com> wrote:
>
>
> On Fri, Oct 1, 2010 at 3:35 AM, Steve Holden wrote:
>
>> On 9/30/2010 8:26 PM, Nick Arnett wrote:
>> > Brain is mush, though.
>>
>>
> Thank you.
I can't figure out if there is a way to escape text for raw SQL queries. I
can't use substitution (I think) because I'm building a query like this:
SELECT foo, bar FROM proj_words WHERE foo IN ("bat", "bug", "snip", "snap")
The list of terms for the IN operator can be quite long... I suppose I c
On Tue, Oct 12, 2010 at 9:00 AM, Javier Guerra Giraldez
wrote:
> On Tue, Oct 12, 2010 at 10:46 AM, Nick Arnett
> wrote:
> > Anybody know a good way to do this?
>
> Words.objects.filter(foo__in=mylist)
Didn't even occur to me to not use raw SQL for this, but I could... tr
On Tue, Oct 12, 2010 at 9:53 AM, Steve Holden wrote:
> ...
> but I can't off-hand remember which ones. If the back-end doesn't allow
> that then you have little option but to generate your own SQL. The
> required escape function is extremely simple:
>
> def sqlesc(s):
> return replace("'",
On Wed, Oct 13, 2010 at 4:38 AM, Mattias Linnap wrote:
> Hi Django users,
>
> I'm building an application with Django, and I need some database
> changes to occur at certain times in the future - independently of any
> web request. Things like cleaning up expired sessions, deleting
> expired user
I am having a problem with locking on MySQL and can't quite figure out
what's causing it. Although I have some scripts that do raw SQL, none of
them are running, I see no other transactions in the process list, yet when
I call save() on one of my objects, the transaction locks, seemingly
forever.
On Thu, Nov 25, 2010 at 6:35 AM, bvcelari wrote:
> Hy,
> I'm trying to deploy my first django app, and I'm trying to use
> pagination , I 'm using Django 1.2
> I'm using a simple view with form, and with the request show the
> results paginated. when I try to go to next page
> the message appears
On Wed, Dec 30, 2009 at 7:15 AM, Adam Playford wrote:
> I'm not an expert on this, but a few thoughts.
>
> First, if I'm reading your message right, it sounds like your problem
> probably isn't with the query, but with how many times you're running
> it.
I'll echo that... the problem is not the
On Sat, Feb 27, 2010 at 4:06 AM, jul wrote:
> hi,
>
> when submitting some characters in a charfield of a django form I get
> the following error (e.g. when submitting 'ś')
>
> (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and
> (utf8_general_ci,COERCIBLE) for operation '='")
>
>
On Wed, Mar 31, 2010 at 9:09 PM, jeff wrote:
>
>page_title='Add a Pair'
>if request.method == 'POST':
>form=SymForm(request.POST)
>if form.is_valid:
is_valid is a call - you want this:
if form.is_valid():
Nick
--
You received this message beca
On Thu, Apr 1, 2010 at 10:34 AM, Chris Curvey wrote:
>
> class FoobarForm(ModelForm):
> foo = forms.FloatField(label = '$')
> id = forms.HiddenField()
If you're using newforms, there's no such thing as HiddenField.
Perhaps you want this:
id = forms.IntegerField(widget = forms.HiddenInput)
On Wed, Mar 31, 2010 at 8:13 AM, Wiiboy wrote:
> Hi guys,
> I've gotten two emails from "Mail Delivery Subsystem
> " with the subject "Your message was NOT
> received by django-us...@googlegroups.com!".
> The body is below. Anyone know why I'm getting these? Is anyone else
> getting them? I ha
On Wed, Apr 13, 2011 at 1:38 PM, Sells, Fred
wrote:
> In my case I had to read some legacy data from a different schema on the
> same MySQL server and it was easy (but perhaps not elegant) to just
> establish a separate connection using MySQLdb module.
You shouldn't have to do that. Use this:
On Sat, May 7, 2011 at 6:05 PM, Dug_the_Math_Guy wrote:
> HI I'm new to Django and just getting some models going. I started
> with a more complex model and got errors so I scaled back to a more
> minimalist model to see if I could get that working. I flushed my
> database to get rid of any old in
On Sat, May 7, 2011 at 6:50 PM, George Silva wrote:
> Just drop the old tables and run syncdb again!
I didn't think it was safe to assume that he wanted to throw away all of his
data...
Nick
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
On Sun, Dec 26, 2010 at 11:06 AM, robos85 wrote:
> Hi,
> what engine fo fulltext indexing do you recommend? Small will be rather
> small, about 3000-4000 unique users per day. I need to index content of
> articles. It's avarage about 600-800 words.
>
If you are using MySQL, its indexing is proba
On Tue, Jan 18, 2011 at 12:04 PM, Sithembewena Lloyd Dube wrote:
> Hi all,
>
> I am building a search app. that will query an API. The app. will also
> store search terms in a very simple table structure.
>
> Big question: if the app. eventually hit 10 million searches and I was
> storing every s
Anybody on django-users know why this mail is coming to our group? It's
strange - the "To" header is android-developers, but the reply-to is
django-users.
I can't quite tell if it is a Google Groups problem or the person posting (
nikola1...@gmail.com).
Nick
On Thu, Feb 17, 2011 at 8:47 AM, vnv
On Wed, Feb 23, 2011 at 12:35 PM, Aliciasf wrote:
...and (iv) the Tempting system...
>
That's the whole thing, isn't it?
;-)
Nick
--
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.
67 matches
Mail list logo