steveneo wrote:
> I try to use Django in a new project. Honestly, it is very bad
> experience. It looks not boosting my development speed. Today, I
> almost give up and begin to look up another Python framework
Go for it :-)
Chris
--
Simplistix - Content Management, Zope & Python Consultin
steveneo wrote:
> BooleanField limits only to CheckBox? But I set
> widget=HiddenField It does not report error. HTML renders
> correctly, but actually, you can not use like that?!
Didn't you hear me: I said go find another framework, Django obviously
sucks because one new user can't get hi
Rob B (uk) wrote:
> Solved it by doing this:
>
> def profile_detail(request, name):
> p = get_object_or_404(Profile, name=name)
> return render_to_response('profile_detail.html', {'name': p})
How about using the detail generic view:
from django.views.generic.list_detail import object_de
Rob B wrote:
> Great I didn't know about that one. I'm curious to what are the
> benefits of doing it that are?
Less code for you to write and maintain :-)
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--~--~
Bobby Roberts wrote:
> I'm generating the
> response in my view as such:
>
>response = render_to_response("spreadsheet.html", {
> 'tms': tms,
> })
This is an evil hack, don't be surprised if weird things happen with it.
You should be using xlwt to generate your spre
Thomas Guettler wrote:
> Hi,
>
> this is offtopic: How can you draw lines in a (django) web application?
>
> I think you need to use flash or java to do it. I googled for it, but found
> only beta
> quality projects.
>
> Has anyone experience with this?
Depends on why you want to draw lines..
hyuen wrote:
> When I use aggregators, I do something like
>
> T.aggregate(Max('LastName'))
>
> but the problem is that for aggregators, it expects a float, not a
> string. Is it possible to use strings as maximum/minimum values?
Where are you importing Max from?
What is the error and traceback
Brandon Taylor wrote:
> I would like to do some obscenity filtering on posts, and I see there
> is a setting: PROFANITIES_LIST
>
> But, how to I invoke the hasNoProfanities validator? I searched the
> django source code for this, but the only thing I could find was the
> setting in conf > global_
kam wrote:
> We have to integrate of web outlook using HTTP protocol. We are
> trying to connect outlook with form based authentication to connect
> using HTTP protocol. We are able to connect outlook using HTTPS and
> COM object but this is not work on Linux & using COM object we are
> able to a
Rodrigo Aliste P. wrote:
> OH! It does it alone! Another awesome thing to my awesomeness list of
> django.
What was your solution in the end? I'm always interested this kind of
batching of results, and I'm very new to Django...
Chris
--
Simplistix - Content Management, Zope & Python Consulti
Kenneth Gonsalves wrote:
> I personally would put everything in one app at the start. If things start to
> grow and you want to reuse that part in another project, or release it to the
> public (and become famous), then it makes sense to factor it out into a
> separate app - maybe a separate pr
Hi Jeroen,
What's the best mailing list to ask questions about djangorecipe on?
I'm CC'ing django-users in the meantime, let me know if there's a better
list...
I'm just coming to Django myself but I've been a heavy buildout user for
a year or so now...
I'm curious as to why djangorecipe does
Jeroen Vloothuis wrote:
> Afaik there is no proper list. I don't follow dango-users but I'm fine
> with also discussing it there.
Yeah, this list is pretty busy! I'll try and keep an eye out for
djangorecipe related posts and forward them your way ;-)
> I'm curious as to why djangorecipe
James Bennett wrote:
> On Thu, Sep 17, 2009 at 5:23 AM, Chris Withers wrote:
>> Well, I'm certainly not setuptools-happy, but Django appears to be
>> wrapped up as a standard distribution on PyPI (sorry, should have said
>> distro, not egg), so it would make sense to u
Hi All,
Will the Django testrunner really only find tests in a file called test.py?
It strikes me that if a reasonable-sized app is fully tested, that
tests.py is going to be unpleasantly long.
How come the testrunner doesn't look for a package called tests like
most of the other python testi
Javier Guerra wrote:
> reasonable-sized apps aren't too big; reasonably-factored projects
> have lots of apps
>
> but, yeah, you're right that using a 'test' directory with an empty
> __ini__.py and the tests files inside that should work...
Nope, only finds them if you have a suite() function i
James Bennett wrote:
> On Thu, Sep 17, 2009 at 6:01 AM, Chris Withers wrote:
>> All of your problems seem to center on zipped eggs. These are evil
>> things anyway, and can be avoided by simply putting zip_safe=False as a
>> parameter to setuptools (whether it actually come
Hi All,
Is it really the case that the Django ORM doesn't support composite
primary keys?
I'm looking to do the equivalent of the following sqlalchemy model:
Base = declarative_base(...)
class Month(Base):
__tablename__ = 'months'
username = Column(
String,ForeignKe
Hi Jeroen,
I use two libraries a lot of the time when I'm testing:
http://pypi.python.org/pypi/testfixtures
http://pypi.python.org/pypi/mock
However, I only use these in testing and don't really want them deployed
for bin/django, only for bin/test.
How would I go about doing this?
cheers,
Hi All,
Where can I find docs on the actual serialisation formats used by
Django's serialisation support?
http://docs.djangoproject.com/en/dev/topics/serialization/#id1
...lists them, but doesn't actually describe them :-S
cheers,
Chris
--
Simplistix - Content Management, Batch Processing
Hi All,
I have this view function:
def index(request,model,pk=None):
return list_detail.object_list(
request,
queryset=model.objects.all(),
paginate_by=10,
template_name='index.html',
extra_context=dict(
column_titles = [f.name for
Maksymus007 wrote:
> {{object.name}} ?
no, that is the equivalent of:
getattr(object,'name')
I want:
getattr(object,name)
Subtle, but rather important, difference...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
-
Daniel Roseman wrote:
> It's an intentional limitation of the template language that you can't
> do that. You'll need to write a custom tag or filter - luckily it can
> be done very trivially as a filter:
>
> @register.filter
> def get_attr(obj, val)
> return getattr(obj, val)
>
> Now in the
Hi All,
I tried this:
from django.db import models
signins = models.IntegerField(
default=0,
db_index=True,
verbose_name='Total Signins'
)
class User(models.Model):
name = models.CharField(
max_length=50,
primary_key=True,
verbose_name='Usern
Hi All,
I have the following in a view:
objects = model.objects.all()
paginator = Paginator(objects,10)
return render_to_response(
'index.html',dict(
objects = paginator.page(page),
total_objects = len(objects),
)
)
Is that
Chris Withers wrote:
> objects = model.objects.all()
> paginator = Paginator(objects,10)
> return render_to_response(
> 'index.html',dict(
> objects = paginator.page(page),
> total_objects = len(objects),
>
Brian McKeever wrote:
> .count is definitely the way to go. Although, I would probably pass it
> to your template instead of determining it there.
What difference does it make?
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co
Ethan Jucovy wrote:
> What happens if you wrap the definition in a function?
> {{{
> def signins(): return models.IntegerField(...)
>
> class User(models.Model):
> name = models.IntegerField(...)
> signins = signins()
> }}}
Yeah, this is sort of what I ended up with:
from django.db import mod
Jani Tiainen wrote:
> Chris Withers kirjoitti:
>> Brian McKeever wrote:
>>> .count is definitely the way to go. Although, I would probably pass it
>>> to your template instead of determining it there.
>> What difference does it make?
>
> len(qs) evalu
Pythoni wrote:
> Is Django thread safe?If so, from which version?
> Thanks for reply
The answer is most likely "no, but it doesn't matter".
Why are you asking?
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--~--~-
andreas schmid wrote:
> then i wanted to try my apps which i have on my subversion repository
> and i added a [site-packages] section to the buildout.cfg using
Why not turn your apps into python packages and serve them from a
private egg server?
> to the [django] section. now i have my project
Torsten Bronger wrote:
>> Why are you asking?
>
> Can it be safely used with Apache's Worker MPM?
I guess that would depend on a lot of things, not least of all whether
you use mod_python or mod_wsgi to deploy. Certainly if it's the latter,
you're likely to get better help on the mod_wsgi list
Hi All,
I need to import data from a legacy app (non-relational database).
I was planning to do an xml dump from the old app (which is now done and
working) but turns out that the app has rather more data in it than I
realised ;-)
I need to import about 40 million rows into one table.
I take
Hi All,
I have a set of models structured roughly as follows:
class Month(models.Model):
monthname = models.CharField(
max_length=14,
db_index=True,
verbose_name='Month'
)
...
class Service(models.Model):
month = models.ForeignKey(Month)
s
grant neale wrote:
> Does anyone have a hint on where I should start, re: making the
> website ready to receive this information?
Doesn't the iPhone have a web browser?
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
-
Tim Chase wrote:
> I wouldn't try to do it from within the web app itself --
> I'd schedule some wee-hours cron job to do the deletion.
I plan to, don't worry ;-)
But, I would like to do it from within the Django environment to make it
immune to changes of database...
> 6mo boundary. Your Mont
Hi All,
I have a set of models that all have the same implementation for a
method, so I thought I'd create a base class for these:
class UrlModel(models.Model):
def get_absolute_url(self):
return reverse(index,kwargs=dict(fk=self.pk))
...and then have the relevant models subclass
Hi All,
I have a piece of template that looks like this:
>
>{% for cell in row %}
>
>{% if forloop.first and row.url %}{% endif %}
>{{cell}}
>{% if forloop.first and row.url %}{% endif %}
>
>{% endfor %}
>
How can I structure this such that I don't have to repea
Streamweaver wrote:
> You could set this up as a custom manage.py command and run a cron on
> that. Gives the advantage of both initiating from outside the app and
> using Django's DB abstraction layer.
That's prettymuch what I was planning to do :-)
> Then just iterate over the month names mor
Daniel Roseman wrote:
> If your base model doesn't contain any fields, you should probably
> mark it as abstract.
> http://docs.djangoproject.com/en/dev/topics/db/models/#id6
Thanks, knew there'd be some magic I needed to invoke ;-)
Chris
--~--~-~--~~~---~--~~
Y
british.assassin wrote:
> You could do this:
>
>
> {% for cell in row %}
>
> {% if forloop.first and row.url %}{{cell}}
> {% else %}
> {{cell}}
> {% endif %}
Then you're violating DRY on {{cell}}, which of course may be a lot mroe
complicated than {{cell}}...
cheers,
Chris
--
Simplistix -
Hi All,
Assuming this model:
class Month(models.Model):
month = models.DateField(
db_index=True,
verbose_name='Month'
)
def __unicode__(self):
return unicode(self.month.strftime('%B %Y'))
Now, I could have sworn this used to throw an error if I did:
danin wrote:
> I am just learning django from last 2 weeks. while learning i get
> confused in validation. Can anyone plese provide me reference to some
> material so that i can read and underatand it from ther.
http://lmgtfy.com/?q=django+validation
How about getting and reading the Django b
Tim Chase wrote:
> Is there something obvious I missed?
Hi Tim,
I do wonder if you might get more help with these problems on the Django
developers list?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--~--~-
Hi All,
I have a function that looks like:
def get_or_create(model,**kw):
try:
obj = model.objects.get(**kw)
except model.DoesNotExist:
obj = model(**kw)
return model
Does something like this ship with django?
If not, should it?
cheers,
Chris
--
Simplistix
Hi All,
I need to host my django project from /some/folder in my apache instance.
I have the following:
WSGIScriptAlias /some/folder /path/to/django.wsgi
Does this now mean I have to prefix all my entries in urls.py with
/some/folder?
I hope not, but give that going to:
http://myserver/some
Jani Tiainen wrote:
>> What am I doing wrong?
>
> "nothing".
Well, it turned out I was editing a backup copy of the apache config
file :-( My bad. Once I started editing the right file, things worked as
expected ;-)
> And if you're using authentication in your app you must provided full
> ab
buttman wrote:
> you could also do it this way:
>
> http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html
url whacking like that is pretty evil...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.
Shawn Milochik wrote:
> I know this doesn't answer the hard part of your question, but here's
> a simple way I delete old stuff from a database via an external script
> that's run by cron:
>
> Item.objects.filter(date_updated__lte = datetime.now() - timedelta
> (days = 30)).delete()
Yep, th
Peter Bengtsson wrote:
>> Yep, that's prettymuch what I ended up writing. Wow, Django's ORM
>> expressions are ugly compared to SQLAlchemy ;-)
>>
> Then just
> import sqlalchemy
Yes, because that obviously provides a drop-in replacement for all users
of Django's ORM ;-)
> If the db is a legacy
Kenneth Gonsalves wrote:
> On Monday 02 Nov 2009 1:17:01 pm Kashif Azeem wrote:
>> I am interested. If you can write a little bit about yourself, type of
>> work, how to apply?
>
> please take this offlist
It was probably a mistake. Google groups is pretty annoying in the way
it sets the Reply
James Bennett wrote:
> On Tue, Nov 3, 2009 at 1:17 AM, Low Kian Seong wrote:
>> There is a query page where the start_date and end_date is being sent.
>> Then the do_defender_advanced will process it and generate an Excel
>> using the template.
>
> One other thing is that the Django template sys
Hi All,
Where can I find good examples of django unit tests?
I currently just want to test my models and some helper functions, but
they will do a .save() on a bunch of model instances.
Any help gratefully recieved!
Chris
--
You received this message because you are subscribed to the Google
Hi All,
I have a Transaction model with a DecimalField called "amount" and a
CharField called "action".
How do I sum all the transactions, multipling the amount by -1 when the
action is REFUND?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
John M wrote:
Sounds like two queries to me, sum all the refunds and then subtract
them from all the non-refund amounts. does that work for ya?
Not really, that requires two queries. I know this can be done in one
query in SQL, just wondering how to express that in Django ORM speak...
Chris
Hi All,
I have the following models:
class Event(models.Model):
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=4,decimal_places=2)
class Ticket(models.Model):
number = models.IntegerField(db_index=True)
event = models.ForeignKey(Event)
class Tick
Okay, so I noticed that it's the following code, and it's only when I
filter on user *end* event:
Chris Withers wrote:
queryset = TicketStatus.objects.filter(active=True)
if user_id:
queryset = queryset.filter(owner=User.objects.get(id=user_id))
queryset = query
Chris Withers wrote:
queryset = TicketStatus.objects.filter(active=True)
if user_id:
queryset = queryset.filter(owner=User.objects.get(id=user_id))
queryset = queryset.filter(ticket__event=event)
return list_detail.object_list(
request,
queryset
Hi All,
I have an existing Django app with lots of data in it. For reasons
beyond my control, this app needs to move from Postgres to MySQL.
What's the best way of going doing this?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://w
Hey all,
I hope this is still on topic, but what tool sets do people around here
use for doing load testing of Django projects?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
You received this message becaus
On 13/10/2010 09:17, Chris Withers wrote:
I hope this is still on topic, but what tool sets do people around here
use for doing load testing of Django projects?
Thanks for the answers...
...now to ask the question in a different way again ;-)
Anyone recommend any load testing services
On 11/10/2010 14:03, Shawn Milochik wrote:
One way would be to use the dumpdata command to export everything, change your
settings to point to the new database, then loaddata to restore.
Okay, so I'm using buildout and djangorecipe for my deployment.
On the postgres-backed server, I did:
bin/
On 21/10/2010 14:06, Jeff Green wrote:
When I was using loaddata I found out that if I did not have a True or
False value for any boolean fields, I would have an issue loading the
data. Once, I set the value for any records to True or False I was
successfully able to use loaddata. Hope that helps
On 21/10/2010 14:48, David De La Harpe Golden wrote:
On 21/10/10 13:31, Chris Withers wrote:
...which is a little odd, given that the file was created by 'dumpdata'.
Any ideas?
Do you see any genuine wierdness in the format of any stringified
datetimes in the dumped json? Yes I k
On 21/10/2010 15:40, ringemup wrote:
MySQL has a tool (mysqldump) that will output the contents of an
entire database to a SQL file that can then be loaded directly into
another database. Does Postgres not have anything analogous?
Sure, pg_dumpall. Now, what're the chances of the SQL that spit
Hi All,
My django site is served up with the following in Apache's config:
WSGIScriptAlias /studio /django/studio/bin/django.wsgi
My urls.py looks like:
urlpatterns += patterns(
'django.contrib',
(r'^admin/', include(admin.site.urls)),
(r'^accounts/login/$', 'auth.views.login'),
Karen Tracey wrote:
> Can anyone tell me what I'm doing wrong?
>
>
> No idea. I can't recreate by copy & pasting you urlpatterns. Tried on
> Django 1.1.1 and current trunk. I've got mod_wsgi 2.3 instead of 2.5
> but I doubt that makes a difference for this -- everything else the same
>
Graham Dumpleton wrote:
>
> As I told you when you tried to use private email to get me to help on
> this,
Apologies for that, I was actually trying to use Google's web UI to
reply to that thread in context. Their UI obvious sucks more than I
realised as it just sent a private mail to you :-(
Graham Dumpleton wrote:
>
>> How can I step through execution from the django.wsgi file and see where
>> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the
>> django.wsgi file won't do what I want?
>
> Sort of, but you have to run Apache in single process mode. See
> further d
Chris Withers wrote:
> Graham Dumpleton wrote:
>>> How can I step through execution from the django.wsgi file and see where
>>> I get to? I'm guessing putting an "import pdb; pdb.set_trace()" in the
>>> django.wsgi file won't do what I want?
>&g
Karen Tracey wrote:
> On Sat, Dec 26, 2009 at 5:32 PM, Chris Withers <mailto:ch...@simplistix.co.uk>> wrote:
>
>
> If anyone can tell me how to do "httpd -X" on a debian or ubuntu host
> I'd be very grateful...
>
>
> /usr/sbin/apach
Graham Dumpleton wrote:
>
>> I also added a {{request}} to the base.html of the django
>> app. Here's the output of the request's SCRIPT_NAME for various urls:
>>
>> /studio - u''
>> /studio/ - u'/studio'
>> /test - '/test'
>> /test/- '/test/'
>
> Hmmm, that would suggest that it is Dj
Karen Tracey wrote:
> In my case, environ.get('SCRIPT_URL', u'') and
> environ.get('REDIRECT_URL', u'') both return empty.
I wonder what SCRIPT_URL is and why it's empty for you but not for me?
I wonder if SCRIPT_URL having a value is something that came along with
a later version of mod_wsgi?
Continuation wrote:
> Now if I change the single quotes to double quotes, it seems to work:
> (1, "I'm looking for..."),
Double quotes are absolutely fine and a lot nicer to look at than
'I\'m hard to read'.
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
neridaj wrote:
> I don't see why this error is happening, the var is assigned.
>
> def moderate_comment(sender, **kwargs):
> instance = kwargs['instance']
> if not instance.id:
> content = instance.content_object
> if isinstance(content, Tweet):
> de
Karen Tracey wrote:
> There is at least one bug open on empty PATH_INFO handling:
>
> http://code.djangoproject.com/ticket/9435
>
> though it doesn't sound like it's focused on exactly the same issue,
No, I had as thorough a look as I could and could find no issue which
directly covered this i
neridaj wrote:
> File "/Users/jasonnerida/django-apps/blog/models.py" in
> moderate_comment
> 142. if delta.days > 30:
Okay, now the line numbered code for the whole of the moderate_comment
function...
Also, check you're not mixing tabs and spaces in that models.py file...
Chris
--
davathar wrote:
Unfortunately adding the rewrite rule mentioned as a work around
hasn't worked for me.
Please post the relevant section of your Apache config (including your
wsgi *and* rewrite lines), there's no reason the rewrite rule workaround
shouldn't work for you...
Chris
--
Simplist
Alessandro Ronchi wrote:
I cannot use an SMS gateway for my app (I must use a SIM and an hardware
modem).
Why? This is not a sane requirement for a web app...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
You receiv
Alessandro Ronchi wrote:
Because of the number of the SMS I must write. I need a web app that
makes intense use of SMS without any external dependences (like Unicef
app).
If you want to send a *lot* of sms'es then you definitely want to be
using a gatway sending service rather than trying t
80 matches
Mail list logo