Hello,
I've decided to play around a bit with Django (since I've heard so much about it). I'm walking through the tutorial here:
http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01
about halfway through the tutorial, i'm asked to run this from my command line:
python manage.py syncdb
However, I'm getting this e...
What would be the best way to import multi-million record csv files into django.
Currently using python csv module, it takes 2-4 days for it process 1 million record file. It does some checking if the record already exists, and few others.
Can this process be achieved to execute in few hours.
Can memcache be used somehow.
Update: Th...
My original though was to simply put the email address into both username and email fields when creating accounts, this doesn't work as Django limits the username field to 30 characters which may not be enough for email addresses.
My second thought was to md5 the email address, put the hash into username, and that would make it always ...
I am trying to get the following setup up going.
Flatpages: Where all my static sites are (like: about, contact,..)
Dynamic Pages:
Here I am trying to link from one of the Flatpages to a start site:
the regex in the url conf of this startsite I tried was:
(r'^myapp/start/(\d+)/$', 'mysite.views.def_that_should_just_show_hello_worl...
Hello all,
I am working on a membership application. I would like to make a membership reminder. (member during a period of time which is not member for another period of time).
Currently, I am using set for making this calculation. See the code below.
class Member(models.Model):
...
class Membership(models.Model):
member = ...
In runserver, I can view my website no problems. (viewing it through lynx on the same machine)
But when I view the same thing through apache, (passenger) I get an error like the following:
Could not import PROJ.APP.views Error was: No module named PROJ.views
It looks like a problem with the urlconf, but again that is the same between...
hi, my model is basically a chain of objects linked by a foreign key:
class Object1(object):
object1_id = models.AutoField()
object1_name = models.CharField()
class Object2(object):
object2_id = models.AutoField()
object2_name = models.CharField()
object1 = models.ForeignKey(Object1)
class Object3(object):
obje...
Hi all,
How can I redirect from view to another url, passing my queryset to another view?
I tried this:
return simple.redirect_to(request, 'some_url', **{'queryset': results})
and this
return redirect('some_url', queryset=results )
but it does not work....
How can i do it?
Gabi.
...
Hi Guys, Django newbie here, I'm using
render_to_response('example.html', {
'error_message': error_message,
}, context_instance=RequestContext(request))
How do I use the request in the template? (e.g. the request.host etc.)
...
I have a table describing files with a datetime field. I want to somehow create a report that gives me the number of files grouped by each year, number of files grouped by each year and month and number of files grouped by each year, month and day. I just want records where count(*) > 0. Preferably using the ORM in django or if that`s no...
What is the best way to pass request information to a model class method?
I'm wondering whether I have my logic in the wrong place. Maybe I need to move it out of my model.
I want to be able to pass in POST variables or a form to filter the model by country or institution.
I can't do that from the template, but the question is whethe...
from django.conf.urls.defaults import *
from django.conf import settings
from Website.Blog.models import Post
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
index = {
'queryset': Post.objects.all(),
'date_field': 'created_on',
'template_name':...
For a project I'm working on, we're still undecided whether the site will launch on an invite-only basis, or be open to the general public immediately. Notwithstanding the management of invites, how would one go about to render a public site invite-only in Django?
One way I can come up with is adding @login_required to all views, but th...
This is the settings.py file for python. I set mysql up via macports (mysql5 & mysqldb) The problem is that I am unsure if I have settings.py configuration correct before I sync the db. Should the PORT be left blank? I believe it should. I know on my Mamp install I have it set to 3306. Thanks....
DATABASES = {
'default': {
'...
Ultimately, my goal is to extend Django's ModelAdmin to provide field-level permissions—that is, given properties of the request object and values of the fields of the object being edited, I would like to control whether or not the fields/inlines are visible to the user. I ultimately accomplished this by adding a can_view_field() method ...
Hello
Assume I have a such model:
class Entity(models.Model):
start_time = models.DateTimeField()
I want to regroup them as list of lists which each list of lists contains Entities from the same date (same day, time should be ignored).
How can this be achieved in a pythonic way ?
Thanks
...
As title says, how can I override it - specifically, how to change its widget from default TextInput to HiddenInput? And why isn't it hidden to begin with :S
I tried passing custom callback function as formfield callback to modelformset_factory but it only changed the default fields originating from model.
I also tried specifying anothe...
Really basic question. Learning Django and now working on development server with nginx set up for me. I've edited my urls.py file in my django project but its not registering the change. Do i need to restart nginx every time I edit the urls.py file? I don't have root access so this wouldn't be possible or is there a local level way of...
if this is my models.py:
class Category(models.Model):
name = models.CharField(max_length=500)
slug = models.SlugField(unique=True)
def __unicode__(self):
return self.name
def get_absolute_url(self):
return "%s" % self.slug
class Item(models.Model):
name = models.CharField(max_length...
I monkey-patched User model with the following two lines:
User._meta.get_field_by_name('email')[0]._unique = True
User._meta.get_field_by_name('email')[0].max_length = 125
-- and noticed, that models loaded after those two lines are executed, are not reachable from User.objects.filter(). For example, I have UserProfile model, ...