After some testing i think that the prob occurs because from the same view
I render another one form in the same template. This form is not
multi-part. In this case it happens what I describe. If i put this simple
form in comments (in views and in template) the multipart form uploads the
file
>
> I'm running it on the django development server. I changed the header and
> it behaves the same way. Is that expected or not?
>
I also tried print request.FILES and I get , but after
> i tried print request.raw_post_data and it seems that the name of the file
> that i try to upload is
>
> I have it like this, with filefield, in my first question I'm just posting
> the generated model from inspectdb and underneath I'm saying that I change
> it to FileField..
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this
>
> as I say in my last reply, I include the multi part header and it doesn't
> work! :( What else I can try?
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
Yes, exactly I'm using a modelform and in my views I'm doing:
def upload(request):
if "doc-form" in request.POST:
docform = LicenceForm(data=request.POST, files=request.FILES)
if docform.is_valid():
docform.save()
return render_to_response('bingo.html',
Hi! It's my first time trying to achieve the ''file upload functionality'
and I need your help. I'm working on a legacy db and I'm supposed to do the
file upload in a table that gets created this way:
CREATE TABLE "LICENCE"
("ID" NUMBER NOT NULL ENABLE,
"VEH_ID" NUMBER NOT
Hi all!
I'd like to know if there's a way to resize my modelform fields on the
template. They're being rendered too big for the text input.
I tried this :
name = forms.CharField(
widget=forms.TextInput(attrs={'size':'40'}))
but it didn't work.
I also changed the width in css
>
> I can see what you mean.
>
Meanwhile, I tried the following and it seems to work:
$("#myform").submit(function() {
var rdatefrom=$('#id_rdatefrom').val()
var arr_sdateText = rdatefrom.split("/");
startday = arr_sdateText[0];
startmonth = arr_sdateText[1];
startyear =
Hi!I'm trying to perform an ajax call on the submit of a form. The form
will be submitted depending on the call's result.
I'm doing sth like that:
$("#myform").submit(function() {
var rdatefrom=$('#id_rdatefrom').val();
var arr_sdateText = rdatefrom.split("/");
startday =
I saw it but I think that this isn't what I need for what I wanna do. I
shouldn't use django's authentication module. I should make my own backend
work.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
On Thursday, August 9, 2012 10:39:07 AM UTC+3, mapapage wrote:
>
> I'm working with a legacy database so I should use another model (Owners)
>> instead of the default Djangoconstrib.auth.models.User for
>> authentication.
>>
> That's why I wrote my own and cu
>
> I'm working with a legacy database so I should use another model (Owners)
> instead of the default Djangoconstrib.auth.models.User for authentication.
>
That's why I wrote my own and custom authentication backend.
> My model has an id field (id = models.DecimalField(...)) that is used for
>
> I wrote this custom authentication backend:
>
from django.contrib.auth.models import User, check_password
from auth.models import Owners
class AuthBackend(object):
def authenticate(self, username=None, password=None):
try:
user =
for the login I do (username must be the id field(pk) of an 'owners' table
and password is a field of the same table):
def login_user(request):
c = {}
c.update(csrf(request))
state = ""
if request.POST:
password = request.POST.get('password')
id =
I wrote a somehow custom login that works when the user inserts his
credentials. He is simply redirected to a page with url:
url(r'^(?P\d+)/$', 'auth.views.main', name='main'),
Now that I try to add @login_decorators but I'm facing problems.
For example, I have the view def
I have an app where a user submits some forms. Now I want the user to be
able to edit his previous submitted forms.
So on the template(e.g old_Webrequests.html) I just load a list with links
corresponding to every submitted form(view:old_Webreqs(request,user_id)).
{% for a in all_reqs %}
{{ a
Hello!
I have a form including a field: veh_id1 = models.ForeignKey(Vehicles))
that is being rendered on the template as dropdown list.
Now I want according to the user's choice in that list some other fields of
my form to be auto-completed and displayed on the template before the form
In my models.py I override the save method like this:
def save(self, *args, **kwargs):
self.directiondb = get_direction_db(self.nod_id1.id,
self.nod_id2.id)
get_direction_descr(self.nod_id1.id, self.nod_id2.id)
get_vrd_code(self.nod_id1.id, self.nod_id2.id)
I confront a strange situation since one field of my modelForm doesn't
being displayed (only its label is) so I can't put a value there when the
form is rendered
and I get the error: ORA-01400: cannot insert NULL into
("VPMS_BETA"."WEBREQUESTS"."DIRECTIONDB"). Of course, i don't wanna change
>
> You were completely right in the first place. It worked! It seemed more
> complex to me as I'm newbie in django :) Sorry for the inconvenience..
>
You really saved me, thank you!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view
>
> I have a legacy db so I have many restrictions and conventions. Anyway,
> the associated part of views looks like:
>
def Webrequests(request, user_id):
try:
owner = Owners.objects.get(id=user_id)
except owner.DoesNotExist:
print "There isnt an owner with
>
> part of models.py with the related fields:
>
class Vehicles(models.Model):
id = models.DecimalField(primary_key=True, unique=True, max_digits=127,
decimal_places=0)
plate = models.CharField(max_length=80, unique=True)
own_id1 = models.ForeignKey('Owners', null=True,
>
> I do it like this: form = WebrequestsForm(own_id=own_id, initial = {...})
>
but I think that the prob is not there. Somehow it has to do with what it
is being returned (and tries to be saved in a decimal field of the form) by
these:
self.fields['veh_id1'].queryset =
I already read that, but my question is how can I css-style only some of my
fields while the rest continue to be rendered by form.as_table. Is there
such an option?
I want that because with modelForms I have a direct mapping of my forms to
my models and if I customize them manually I loose for
The important part of my template is the following:
>
>
> Forms
>
>
>
> {% extends "main.html" %}
>
>
>> {% block content %}
>
> > enctype='multipart/form-data'{% endif %}>
>
>
>> {% csrf_token %}
>
>
>
>
>
>
>
> {{ lname }}
>
> {{
Hi!
In my django app I'm using modelForms and not simple django forms so in
order to render the form I just do {{ form.as_table }} an the template and
everything is being displayed.
That's simple, but obviously any html code is being skipped, so I wonder
how will I further customize my form
I'm working on a django project on Ubuntu 10.04 with Oracle Database
Server
I use Oracle Database 10g xe universal Rel.10.2.0.1.0 against
cx_Oracle-5.0.4-10g-unicode-py26-1.x86_64
My db is generated by oracle 10gr2 enterprise edition (on Windows XP,
import done in US7ASCII character set and
27 matches
Mail list logo