Dear ALL,

i have a form in a page  so i added this to views.py :


from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from globalc.models import newsletter
from django import forms

class newform(forms.Form):
    email = forms.CharField(max_length=100)
    question = forms.CharField(widget=forms.Textarea)


def index(request):
    if request.method == 'POST': # If the form has been submitted...
        form = newform(request.POST) # A form bound to the POST data
        if form.is_valid(): # All validation rules pass
            p = newsletter(question = "" +
str(request.POST.get('question')) , email = "" +
str(request.POST.get('email')))
            p.save()

    else:
        form = newform() # An unbound form

    return render_to_response('index.html', {
        'form': form,
    },context_instance=RequestContext(request))



but everytime i add the context_instance=RequestContext(request)  all
the images in me website goes away !!???? why



my html page  index.html :

<html>
<head>
<title></title>
</head>
<body style="overflow:scroll;">
<table style="width:100%">
<tr>

<!-- Margin left -->
<td style="width:20%"></td>
<!-- end of Margin left -->

<!--Content-->
<td style="background-color:#1B4D90;">
<table>
<!--Menu-->
<tr><td>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="800" height="200" id="movie_name" align="middle">
    <param name="movie" value="{{ STATIC_URL }}static/static/menu.swf"/
>
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="{{ STATIC_URL }}
static/static/menu.swf" width="800" height="200">
        <param name="movie" value="movie_name.swf"/>
    <!--<![endif]-->
        <a href="http://www.adobe.com/go/getflash";>
            <img src="http://www.adobe.com/images/shared/
download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
        </a>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
</object>
</td></tr>
<!--End of Menu-->

<!--Main Content-->
<tr><td><br/><center><img src="{{ STATIC_URL }}static/static/images/
mainimage.jpg" width="550px"></img></center></td></tr>
<!--End of Main Content-->

<!--Readmore and questions-->
<tr><td style="background-color:#CCCCCC">
<div style="background-color:#64B55B;width:100%">
<table style="width:100%">
<tr>
<td>
<p style="color:#ffffff;margin:15px">
<b style="color:#1B4D90;font-size:20px">About Us</b><br/>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula
</p>
</td>

<td>
<p style="color:#ffffff;margin:15px">
<b style="color:#1B4D90;font-size:20px">About Us</b><br/>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula
</p>
</td>

<td>
<p style="color:#ffffff;margin:15px">
<b style="color:#1B4D90;font-size:20px">About Us</b><br/>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ut dictum
enim. Quisque posuere justo sem, posuere lobortis ligulaLorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula
</p>
</td>
</tr>
</table>




</div>
<br/><br/>
<table>
<tr>
<td style="width:60%;border-right:1px solid #073E75 ">

<h2 style="color:#073E75;margin-left:20px">Welcome</h2>
<p style="color:#073E75;text-indent:0px;margin-left:20px">Lorem ipsum
dolor sit amet, consectetur adipiscing elit. In ut dictum enim.
Quisque posuere justo sem, posuere lobortis ligula. Etiam erat diam,
elementum in dapibus bibendum, ultrices eget enim. Nulla et nibh nec
elit venenatis commodo sit amet pretium eros. Duis vel velit at augue
tristique vehicula. Nulla in lectus quis nisi egestas egestas at ac
lacus. Donec rutrum volutpat rhoncus. Proin condimentum, odio eu
commodo laoreet, turpis leo tincidunt nisi, nec mollis quam justo
vitae velit.</p>

</td>
<td style="width:40%">
<style>
textarea{
background-color:#CCCCCC;
border-color:#1B4D90;
width:250px;
height:150px;
margin-left:20px;
}

input[type=text]{
background-color:#CCCCCC;
border-color:#1B4D90;
width:250px;
margin-left:20px;

}
input[type=submit]{
background-color:#1B4D90;
color:#ffffff;
width:100px;
margin-left:170px;

}
</style>
<form  action="" method="post">{% csrf_token %}
<b style="margin-left:20px;color:#1B4D90;margin-bottom:10px"><i>Quick
Question </i></b>
{{ form.question }}<br/>
<b style="margin-left:20px;color:#1B4D90;margin-bottom:10px"><i>E-
Mail</i></b>
{{ form.email }}<br/>
<input type="submit"/>
</form>
</td>
</tr>
</table>
</td></tr>
<!--End of readmore and qestions-->
<!--foteer-->
<tr><td>
<p style="margin:10px;color:#cccccc">Global (c) 2011 | Privet policy
<br/> Powerd by <a href="http://www.gardeniatelco.com";>Gardeniatelco</
a></p>
</td></tr>
<!--End of foteer-->
</table>
</td>
<!--end of Content-->
<!-- Margin Right -->
<td style="width:20%"></td>
<!-- end of Margin Right -->
</tr>
</table>
</body>
</html>



and my settings.py is :

# Django settings for global project.

import os
PROJECT_ROOT =
os.path.abspath(os.path.dirname(os.path.abspath(__file__)))


DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'sqlite.db',                      # Or path to
database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for
localhost. Not used with sqlite3.
        'PORT': '',                      # 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.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as
your
# system time zone.
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

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute filesystem path to the directory that will hold user-
uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, "media")

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash.
# Examples: "http://media.lawrence.com/media/";, "http://example.com/
media/"
MEDIA_URL = '/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static
files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/";, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/
static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
   os.path.join(PROJECT_ROOT, "static"),

)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '%f%tl&pf0ifa+1xe!#jujla-%z850nl3420$9ajpx^g4%p_kkz'

# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    #'django.middleware.csrf.CsrfViewMiddleware',
)

ROOT_URLCONF = 'global.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.
    os.path.join(PROJECT_ROOT, "templates"),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'globalc',
    'oembed',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}




-- 
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.

Reply via email to