Re: Problem with serving static files

2009-11-18 Thread Denis Bahati
how do you make them similar? because its also a problem to with TinyMCE.

On Wed, Nov 18, 2009 at 4:13 PM, jeremyrdavis wrote:

> The document root specified in urlpatterns should match the directory
> where your files are located.  You have "/mysite/media/" in your
> urlpatterns and "C:\django_projects\mysite\media" in your post.  Make
> sure those match.
>
>
> On Nov 18, 6:56 am, "Benjamin W."  wrote:
> > Hi there,
> >
> > I'm new to django and got my first little problem.
> > I want to use a css file in my template. So I read this:
> http://docs.djangoproject.com/en/dev/howto/static-files/
> >
> > I set up everything, but I don't get the file.
> > My config:
> >
> > urls.py:
> > urlpatterns = patterns('',
> > (r'^polls/', include('mysite.polls.urls')),
> > (r'^site_media/(?P.*)$', 'django.views.static.serve',
> > {'document_root': '/mysite/media/'}),
> > )
> >
> > base.html (css include)
> > 
> >
> > Path to media:
> > C:\djanjo_projects\mysite\media
> >
> > When I open the source code of the page and click on the stylesheet, I
> > get this information:
> > Request URL:http://127.0.0.1:8080/site_media/css/design.css
> > /mysite/media/css/design.css does not exist
> >
> > Whats wrong with my pass?
> > Thanks a lot,
> > greets Ben
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Login Error

2009-11-17 Thread Denis Bahati
Hi All,
I have created a login screen for users of the site which is like User
Profile and uses the username and password from django users. When i try to
login to my view i get the error below.

Environment: Request Method: POST Request URL:
http://127.0.0.1/commTrack/commtrack/account/login/ Django Version: 1.1
Python Version: 2.5.4 Installed Applications: ['django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.admin', 'commTrack.commtrack']
Installed Middleware: ('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
"C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs) File
"C:/xampp/htdocs/commTrack\commtrack\views.py" in login_view 71.
login(request, user) Exception Type: TypeError at /commtrack/account/login/
Exception Value: login() takes exactly 1 argument (2 given)

Here is my setting.py

# Django settings for commTrack project. DEBUG = True TEMPLATE_DEBUG = DEBUG
ADMINS = ( # ('Your Name', 'your_em...@domain.com'), ) MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql',
'sqlite3' or 'oracle'. DATABASE_NAME = 'commtrack' # Or path to database
file if using sqlite3. DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = 'localhost'
# Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT =
'3306' # Set to empty string for default. Not used with sqlite3. # Local
time zone for this installation. Choices can be found here: #
http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all
choices may be available on all operating systems. # If running in a Windows
environment this must be set to the same as your # system time zone.
#TIME_ZONE = 'Africa/Dar_es_Salaam' TIME_ZONE = 'America/Chicago' # Language
code for this installation. All choices can be found here: #
http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE =
'en-us' SITE_ID = 1 # If you set this to False, Django will make some
optimizations so as not # to load the internationalization machinery.
USE_I18N = True # Absolute path to the directory that holds media. #
Example: "/home/media/media.lawrence.com/" MEDIA_ROOT =
"C:/xampp/htdocs/commTrack/media/" # URL that handles the media served from
MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component
(optional in other cases). # Examples: "http://media.lawrence.com;, "
http://example.com/media/; MEDIA_URL = "http://127.0.0.1/commTrack/media/; #
URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash. # Examples: "http://foo.com/media/;, "/media/".
ADMIN_MEDIA_PREFIX = "http://localhost/commTrack/media/; # Make this unique,
and don't share it with anybody. SECRET_KEY =
'i##+%y9+1u$vd#!g$=qld(--(nb-b71czx4cill!+1%2)er=' # List of callables
that know how to import templates from various sources. TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source', #
'django.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES =
( 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', ) ROOT_URLCONF =
'commTrack.urls' TEMPLATE_DIRS = ( # Put strings here, like
"/home/html/django_templates" or "C:/www/django/templates". # Always use
forward slashes, even on Windows. # Don't forget to use absolute paths, not
relative paths. #"/media/Otoro/Projects ITIDO/mytemplates"
"C:/xampp/htdocs/commTrack/templates/", ) INSTALLED_APPS = (
'django.contrib.auth', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin',
'commTrack.commtrack', ) AUTHENTICATION_BACKENDS = (
'commTrack.commtrack.models.CustomUserModelBackend', ) CUSTOM_USER_MODEL =
'commtrack.CustomUser'


Here is my view for login


from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from commTrack.commtrack.models import *

def login_view(request): username = request.POST.get('username', '')
password = request.POST.get('password', '') user =
authenticate(username=username, password=password) if user is not None and
user.is_active: # Correct password, and the user is marked "active"
login(request, user) # Redirect to a success page. return
HttpResponseRedirect("/commTrack/") else: # Show an error page return
HttpResponseRedirect("/commTrack/commtrack/invalid/")

and here is my model.py

class CustomUserModelBackend(ModelBackend):
def authenticate(self, username=None, password=None):
try:
user = 

RapidSMS on windows

2009-11-17 Thread Denis Bahati
Hi All,

Does RapidSMS work on windows? Please if it does can anyone show me the
detail on how to go through.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: Password encryption

2009-11-16 Thread Denis Bahati
Nah;
Here is my Model.
class Title(models.Model):
name = models.CharField(max_length=10)

def __unicode__(self):
return self.name

class UserProfile(models.Model):
title = models.ForeignKey(Title)
address = models.TextField()
date_added = models.DateTimeField()

class UserProfileForm(ModelForm):
username=forms.CharField(label=("User Name"), max_length=100)
password_Confirm=forms.CharField(label=("Confirm Password"),
widget=forms.PasswordInput,max_length=100)
first_name=forms.CharField(label=("First Name"), max_length=100)
last_name=forms.CharField(label=("Last Name"), max_length=100)
date_added=forms.DateField()
class Meta:
model = UserProfile

here is my view.py

from django.contrib.auth import authenticate, login
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import get_list_or_404
from django.template import loader, Context
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from commTrack.commtrack.models import *

def UserProfileEditor(request, id=None):
form = UserProfileForm(request.POST or None,
   instance=id and UserProfile.objects.get(id=id))

# Save new/edited User
if request.method == 'POST' and form.is_valid():
form.save()
return HttpResponseRedirect('/commTrack/userProfile/list/')

return render_to_response('userProfile/adduserProfile.html',
{'form':form})

and here is my form.html

{%
block form_top %}{% endblock %}




{{ form.title.errors }}




Title:



{{ form.title }}




{{ form.first_name.errors }}




First Name:



{{ form.first_name }}




{{ form.last_name.errors }}




Last Name:



{{ form.last_name }}




{{ form.address.errors }}




Address:



{{ form.address }}




{{ form.username.errors }}




User Name:



{{ form.username }}




{{ form.password.errors }}




Password:



{{ form.password }}




{{ form.password_Confirm.errors }}




Confirm Password:



{{ form.password_Confirm }}




{{ form.date_added.errors }}




Date Added:



{{ form.date_added }}











It does not save anything when i click the submit button and it remains on
the same interface. Any ideas?


On Mon, Nov 16, 2009 at 7:50 AM, Gabriel Gunderson <g...@gundy.org> wrote:

> On Thu, Nov 5, 2009 at 12:51 AM, Denis Bahati <djma...@gmail.com> wrote:
> > My project require to have my own table for users and roles. Am not using
> > the default auth table.
>
> Does this work for your additional user info?
>
>
> http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
>
> Gabe
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: Increment a value in a database table field

2009-11-15 Thread Denis Bahati
Exactly Karen the model is confusing. Here is the exactly model.

class Resource_Track(models.Model)
users = models.ForeignKey(User)
resources = models.ForeignKey(Resource)
date_tracked = models.DateTimeField('Date Tracked')
description = models.TextField()
status_count_per_week = models.IntegerField()
status = models.ForeignKey(Status)

class Meta:
   verbose_name_plural = 'Track Resources'

Sorry for confusing you.
Regards
Denis.

On Sat, Nov 14, 2009 at 7:43 AM, Karen Tracey <kmtra...@gmail.com> wrote:

> On Sat, Nov 14, 2009 at 10:25 AM, Denis Bahati <djma...@gmail.com> wrote:
>
>> Hi,
>> Here is my model am using to update items status.
>>
>> class User(models.Model)
>> users = models.ForeignKey(User)
>> resources = models.ForeignKey(Resource)
>>date_tracked = models.DateTimeField('Date Tracked')
>>description = models.TextField()
>>status_count_per_week = models.IntegerField()
>> status = models.ForeignKey(Status)
>>
>> class Meta:
>> verbose_name_plural = 'Track Resources'
>>
>> What i want to achieve is that:
>>   When i update the status the item first i should get the date last
>> tracked and compare with tje current date, if the date tracked and
>> the current date are not in the same week it should insert into a new row of
>> status_count_per_week. If the date tracked and the current date are in the
>> same week it should increment the value of status_count_per_week .
>>
>>
> I find your model and description confusing -- I am not sure the model you
> have defined is correct for what you want to achieve -- so I am not going to
> attempt to craft a solution exactly. Instead I'll point you to the two
> building blocks I think you need to achieve what you are looking for.
> First, get_or_create:
>
>
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create-kwargs
>
> which you can use to either get the model containing a specific set of
> fields or create it if it does not exist.
>
> Second, update() with an F() expression can be used to atomically increment
> a counter:
>
>
> http://docs.djangoproject.com/en/dev/ref/models/instances/#updating-attributes-based-on-existing-fields
>
> Karen
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=.
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Re: Increment a value in a database table field

2009-11-14 Thread Denis Bahati
Hi,
Here is my model am using to update items status.

class User(models.Model)
users = models.ForeignKey(User)
resources = models.ForeignKey(Resource)
   date_tracked = models.DateTimeField('Date Tracked')
   description = models.TextField()
   status_count_per_week = models.IntegerField()
status = models.ForeignKey(Status)

class Meta:
verbose_name_plural = 'Track Resources'

What i want to achieve is that:
  When i update the status the item first i should get the date last tracked
and compare with tje current date, if the date tracked and the current date
are not in the same week it should insert into a new row of
status_count_per_week. If the date tracked and the current date are in the
same week it should increment the value of status_count_per_week .
Regards.
Denis.

On Thu, Nov 12, 2009 at 11:58 AM, scot.hac...@gmail.com <
scot.hac...@gmail.com> wrote:

>
> On Nov 12, 7:51 am, Denis Bahati <djma...@gmail.com> wrote:
> > Hi All,
> >
> > I have a field with an integer value which needs to be incremented
> > every time any user updates its status within a week. If that week has
> > passed it should insert a new row. Now i was trying to figure out but
> > didn't get any concept on how to go through. Please any idea?
>
> You don't mention how you're tracking dates or weeks (is that a
> related model, or... ?) but this would be the general idea:
>
> - get the timestamp of the last update to that field and compare it to
> the current timestamp
>
> if ... : #  interval is less than a week:
>foo = MyModel.objects.get(...)
>foo.counter = foo.counter + 1
> else : interval is more than a week
>foo = MyModel()
>foo.counter = 1
>
> foo.save()
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Increment a value in a database table field

2009-11-12 Thread Denis Bahati
Hi All,

I have a field with an integer value which needs to be incremented
every time any user updates its status within a week. If that week has
passed it should insert a new row. Now i was trying to figure out but
didn't get any concept on how to go through. Please any idea?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.




Template not displaying

2009-11-10 Thread Denis Bahati

Hi all, am using xampp as webserver with django 1.1,when i access the
browser the template does not work. The media is in
c:/xampp/htdocs/adc/media/ where i put the css,img and js folders. I
set admin_media_prefix='http:/127.0.0.1/adc/media/' the same to
media_url. The template is at c:/xampp/htdocs/adc/templates/. Please
any idea on how to make the templates working?

-- 
Sent from my mobile device

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Adding a password confirm on modelForm

2009-11-03 Thread Denis Bahati
Hi All,
I have my model which registers users of my system and i created a modelForm
to make all fields of the model appear as html form which has no confirm
password. How can i add a field to let users confirm their password?
Here is my model and modelForm

class User(models.Model):
title = models.ForeignKey(Title)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField()
roles = models.ManyToManyField(Role)
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)
date_added = models.DateTimeField()

class UserForm(ModelForm):
date_added=forms.DateTimeField()
password=forms.CharField(label=("Password"), widget=forms.PasswordInput)
class Meta:
model = User

Thanks in advance.
Regards
Denis.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User Login in django

2009-11-03 Thread Denis Bahati
Am real need to reinvent the wheel because i have a project which needs to
define some user roles, and enable users to update the status of their own
properties and not the other property. Thanks in advance for any help you
give me.

On Tue, Nov 3, 2009 at 4:32 PM, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:

>
> On 3 nov, 13:37, Denis Bahati <djma...@gmail.com> wrote:
> > Hi there,
> > Am creating a login screen using django form but failing to get the
> concept
> > on how can i query from the database to get the user verified as a
> > registered user.
>
> Do you have a real need for reinventing the wheel ?
>
> http://docs.djangoproject.com/en/dev/topics/auth/
> >
>

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



User Login in django

2009-11-03 Thread Denis Bahati
Hi there,
Am creating a login screen using django form but failing to get the concept
on how can i query from the database to get the user verified as a
registered user. I want that a user is validated and displayed with his/her
profile as well update  his/her profile. The user can view only the allowed
pages not viewing other pages.
Here is my model for registering users and the form.
class User(models.Model):
title = models.ForeignKey(Title)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField()
roles = models.ManyToManyField(Role)
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)
date_added = models.DateTimeField()
 def __unicode__(self):
return '%s %s %s' %(self.title, self.first_name, self.last_name)

class UserForm(ModelForm):
date_added=forms.DateField()
class Meta:
model = User

class User(forms.Form):
username = models.CharField(max_length=30)
password = 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 email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Display a value from another table

2009-11-02 Thread Denis Bahati
Here is my model.

TITLE_CHOICES = (
('MR', 'Mr.'),
('MRS', 'Mrs.'),
('MS', 'Ms.'),
)

class Author(models.Model):
name = models.CharField(max_length=100)
title = models.CharField(max_length=3, choices=TITLE_CHOICES)
birth_date = models.DateField(blank=True, null=True)

def __unicode__(self):
return self.name

class Book(models.Model):
name = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)

class AuthorForm(ModelForm):
class Meta:
model = Author

class BookForm(ModelForm):
class Meta:
model = Book

What i want is that, if i need to display the book detail it should give me
who is the other for a particular book.

On Mon, Nov 2, 2009 at 9:25 AM, Rishabh Manocha <rmano...@gmail.com> wrote:

> On Mon, Nov 2, 2009 at 1:43 PM, Denis Bahati <djma...@gmail.com> wrote:
>
>> Hi All,
>> Am developing an application where by it links two tables author and book,
>> the id of author is a foreign key to book table. How can i display the name
>> of the author when am displaying the book list.
>>
>>
>>
> I'm not sure how you the id of an author can be a ForeignKey to a Book. Can
> you paste your models so that we can get a clearer picture. Assuming your
> Book model looks something like the below:
>
> class Book(models.Model):
> ...
> author = models.ForeignKey(Author)
>
> You would do:
>
> >>> my_author = Author.objects.create('James Joyce')
> >>> my_book = Book.objects.create(..., author = my_author)
> >>> my_book.author
> 
>
> --
>
> Best,
>
> R
>
> >
>

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Display a value from another table

2009-11-01 Thread Denis Bahati
Hi All,
Am developing an application where by it links two tables author and book,
the id of author is a foreign key to book table. How can i display the name
of the author when am displaying the book list.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Login users

2009-10-29 Thread Denis Bahati
Hi All,

Am creating application using django/python, i want to create a login form
where by normal users can login through the web and access the system, i
have a background with PHP but new to python/django. How can I implement
this login? Currently am using the Django Admin page for login the system.
Thanks in advance.
Regards
Denis.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using django form

2009-10-29 Thread Denis Bahati
Hi Daniel,
Thanks  for the document. I real appreciate.
I have another question:
  How can I use my model and ModelForm to create a login screen?

On Thu, Oct 29, 2009 at 10:14 AM, Daniel Roseman <dan...@roseman.org.uk>wrote:

>
> On Oct 29, 6:38 am, Denis Bahati <djma...@gmail.com> wrote:
> > Hi all,
> > I've gone through and successfully made the poll application and I've
> > begun to play around and tried to change a few things. The first thing
> > I would like to do is have the user vote without login to django admin.
> ie
> > creating my own form where users can vote and update the database without
> > using the django admin. I'm thinking of using html files or using the
> django
> > form library but i dont no the exactly solution to go through this. Can
> any
> > one show me how to do the staff using django form or using the html
> forms? I
> > have followed the tutorial like in the Django Book Chapter 7: Forms but i
> > dont see where i can insert data into the table in the database.
> > Thanks in advance.
> > Regards
> > Denis.
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
> --
> DR.
> >
>

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using django form

2009-10-29 Thread Denis Bahati
Hi all,
I've gone through and successfully made the poll application and I've
begun to play around and tried to change a few things. The first thing
I would like to do is have the user vote without login to django admin. ie
creating my own form where users can vote and update the database without
using the django admin. I'm thinking of using html files or using the django
form library but i dont no the exactly solution to go through this. Can any
one show me how to do the staff using django form or using the html forms? I
have followed the tutorial like in the Django Book Chapter 7: Forms but i
dont see where i can insert data into the table in the database.
Thanks in advance.
Regards
Denis.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hi All: __unicode__(self)

2009-10-12 Thread Denis Bahati
Thank in advance for the advices.

On Mon, Oct 12, 2009 at 8:55 AM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:

>
> On Mon, Oct 12, 2009 at 1:44 PM, Kenneth Gonsalves
> <law...@thenilgiris.com> wrote:
> >
> > On Monday 12 Oct 2009 11:05:38 am Denis Bahati wrote:
> >> class Poll(models.Model):
> >> question = models.CharField(max_length=200)
> >> pub_date = models.DateTimeField('date published')
> >> def __unicode__(self):
> >> return self.questiona
> >> def was_published_today(self):
> >> return self.pub_date.date() == datetime.date.today()
> >> def was_published_today(self):
> >> return self.pub_date.date() == datetime.date.today()
> >> was_published_today.short_description = 'Published today?'
> >
> > please learn some python!
>
> Kenneth - please learn some manners. You have repeatedly demonstrated
> on this list that you have a deep yearning for brevity. However, let
> me assure you that it really doesn't take that much effort to write in
> whole sentences (with capitalization and everything). If you throw in
> some politeness while you are at it, all the better.
>
> Yours,
> Russ Magee %-)
>
> >
>

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Hi All: __unicode__(self)

2009-10-11 Thread Denis Bahati
Hi all,

I have a problem with __unicode__(self) function it doesn't give any changes
to the display of poll list it just display the Poll object when i code like
below:


from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

if i change the code like the one shown below it gives me the traceback
about indents, i also included below.

from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
eturn self.choice

Environment:

Request Method: GET
Request URL: http://localhost/testproject/admin/polls/poll/5/
Django Version: 1.1
Python Version: 2.5.4
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'testproject.polls']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
  83. request.path_info)
File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve
  216. for pattern in self.url_patterns:
File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns
  245. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module
  240. self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python25\lib\site-packages\django\utils\importlib.py" in
import_module
  35. __import__(name)
File "C:/xampp/htdocs\testproject\urls.py" in 
  5. admin.autodiscover()
File "C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
autodiscover
  56. import_module("%s.admin" % app)
File "C:\Python25\lib\site-packages\django\utils\importlib.py" in
import_module
  35. __import__(name)
File "C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in

  128. admin.site.register(Group, GroupAdmin)
File "C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in
register
  90. validate(admin_class, model)
File "C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
validate
  22. models.get_apps()
File "C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps
  100. self._populate()
File "C:\Python25\lib\site-packages\django\db\models\loading.py" in
_populate
  58. self.load_app(app_name, True)
File "C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app
  74. models = import_module('.models', app_name)
File "C:\Python25\lib\site-packages\django\utils\importlib.py" in
import_module
  35. __import__(name)

Exception Type: IndentationError at /admin/polls/poll/5/
Exception Value: unexpected indent (models.py, line 10)




Please any help.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: __unicode__(self) doesn't work

2009-10-11 Thread Denis Bahati
Did you see my second post? I changed it still a problem

On Mon, Oct 12, 2009 at 8:19 AM, Denis Bahati <djma...@gmail.com> wrote:

> Hi all,
> I have a problem with __unicode__(self) function it doesn't give any
> changes to the display of poll list it just display the Poll object when i
> code like below:
>
>
> from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
> return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
> was_published_today.short_description = 'Published today?'
>
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> def __unicode__(self):
> return self.choice
>
> *if i change the code like the one shown below it gives me the traceback
> about indents, i also included below.*
>
> from django.db import models
> import datetime
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
>  return self.question
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>  def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>  was_published_today.short_description = 'Published today?'
>
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> def __unicode__(self):
> return self.choice
>
> Environment: Request Method: GET Request URL:
> http://localhost/testproject/admin/polls/poll/5/ Django Version: 1.1
> Python Version: 2.5.4 Installed Applications: ['django.contrib.auth',
> 'django.contrib.contenttypes', 'django.contrib.sessions',
> 'django.contrib.sites', 'django.contrib.admin', 'testproject.polls']
> Installed Middleware: ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
> "C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
> 83. request.path_info) File
> "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 216.
> for pattern in self.url_patterns: File
> "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
> _get_url_patterns 245. patterns = getattr(self.urlconf_module,
> "urlpatterns", self.urlconf_module) File
> "C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
> _get_urlconf_module 240. self._urlconf_module =
> import_module(self.urlconf_name) File
> "C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
> 35. __import__(name) File "C:/xampp/htdocs\testproject\urls.py" in 
> 5. admin.autodiscover() File
> "C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
> autodiscover 56. import_module("%s.admin" % app) File
> "C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
> 35. __import__(name) File
> "C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in 
> 128. admin.site.register(Group, GroupAdmin) File
> "C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in register
> 90. validate(admin_class, model) File
> "C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
> validate 22. models.get_apps() File
> "C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps 100.
> self._populate() File
> "C:\Python25\lib\site-packages\django\db\models\loading.py" in _populate 58.
> self.load_app(app_name, True) File
> "C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app 74.
> models = import_module('.models', app_name) File
> "C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
> 35. __import__(name) Exception Type: IndentationError at
> /admin/polls/poll/5/ Exception Value: unexpected indent (models.py, line 10)
>
> *
> *
>
>
> Please any help.
>

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



__unicode__(self) doesn't work

2009-10-11 Thread Denis Bahati
Hi all,
I have a problem with __unicode__(self) function it doesn't give any changes
to the display of poll list it just display the Poll object when i code like
below:


from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

*if i change the code like the one shown below it gives me the traceback
about indents, i also included below.*

from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

Environment: Request Method: GET Request URL:
http://localhost/testproject/admin/polls/poll/5/ Django Version: 1.1 Python
Version: 2.5.4 Installed Applications: ['django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.admin', 'testproject.polls']
Installed Middleware: ('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
"C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
83. request.path_info) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 216.
for pattern in self.url_patterns: File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns 245. patterns = getattr(self.urlconf_module,
"urlpatterns", self.urlconf_module) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module 240. self._urlconf_module =
import_module(self.urlconf_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File "C:/xampp/htdocs\testproject\urls.py" in 
5. admin.autodiscover() File
"C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
autodiscover 56. import_module("%s.admin" % app) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File
"C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in 
128. admin.site.register(Group, GroupAdmin) File
"C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in register
90. validate(admin_class, model) File
"C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
validate 22. models.get_apps() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps 100.
self._populate() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in _populate 58.
self.load_app(app_name, True) File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app 74.
models = import_module('.models', app_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) Exception Type: IndentationError at
/admin/polls/poll/5/ Exception Value: unexpected indent (models.py, line 10)

*
*


Please any help.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



__unicode__(self) doesn't work

2009-10-11 Thread Denis Bahati
Hi there i have the problem with unicode function it doesn't give me any
changes. the poll list is displayed as Poll object and does doesn't give me
error if i write the models.py like this:from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __unicode__(self):
return self.choice

If i change to the way below it give me the below below:

Environment: Request Method: GET Request URL:
http://localhost/testproject/admin/polls/poll/5/ Django Version: 1.1 Python
Version: 2.5.4 Installed Applications: ['django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.sites', 'django.contrib.admin', 'testproject.polls']
Installed Middleware: ('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File
"C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response
83. request.path_info) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in resolve 216.
for pattern in self.url_patterns: File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns 245. patterns = getattr(self.urlconf_module,
"urlpatterns", self.urlconf_module) File
"C:\Python25\lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module 240. self._urlconf_module =
import_module(self.urlconf_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File "C:/xampp/htdocs\testproject\urls.py" in 
5. admin.autodiscover() File
"C:\Python25\lib\site-packages\django\contrib\admin\__init__.py" in
autodiscover 56. import_module("%s.admin" % app) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) File
"C:\Python25\lib\site-packages\django\contrib\auth\admin.py" in 
128. admin.site.register(Group, GroupAdmin) File
"C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in register
90. validate(admin_class, model) File
"C:\Python25\lib\site-packages\django\contrib\admin\validation.py" in
validate 22. models.get_apps() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in get_apps 100.
self._populate() File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in _populate 58.
self.load_app(app_name, True) File
"C:\Python25\lib\site-packages\django\db\models\loading.py" in load_app 74.
models = import_module('.models', app_name) File
"C:\Python25\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name) Exception Type: IndentationError at
/admin/polls/poll/5/ Exception Value: unexpected indent (models.py, line 10)


Thanks in advance.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Xampp and django

2009-10-11 Thread Denis Bahati
Thanx a lot for the information, but i managed to get it working before this
information.
I have another problem that the __unicode()__ is not working. It just gives
me Poll object instead of the name of data from the database, i put the
function at the beginning of the line, but if i put a tab to indent so that
it is read as the function of the poll, it gives me error. any idea?

On Sat, Oct 10, 2009 at 8:59 AM, Daniel Roseman wrote:

>
> On Oct 10, 3:43 pm, djbahati  wrote:
> > Hi All,
> > Am new to django,
> > am developing application but i face a problem in displaying template.
> > The browser does not display any template it just display plain text.
> > am using django 1.1 and xampp 1.7.1. Any idea?
>
> http://docs.djangoproject.com/en/dev/howto/static-files/
> --
> DR.
> >
>

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem with cookies and template

2009-10-10 Thread Denis Bahati
Hi all,
Am new to python and django but am facing aproblem with templates and login
the admin page.
1) I cannot login to admin page page because django keeps giving me a
message Look for your browser cofiguration to allow cookies but am sure my
browser allows all cookies.
2) Am using xampp 1.7.1 as webserver, django doesn't display its template.
Any idea for this.

--~--~-~--~~~---~--~~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---