On Mon, Aug 8, 2011 at 4:36 PM, Josh wrote:
> >
>>
>> >If you need to push back a value in a variable call related_entries, then
>>> you will want to set a value in the context dictionary:
>>
>> >
>>
>> >context[related_entries] =
>>
>>
> Correction on earlier mail
I'm building a django-based media server where each person has a
private account.
The person can upload media files such as mp3s.
The media files will be uploaded to a directory '/media/
uploads/'++'/' with name of filename.mp3
I started working with this posting:
hi,
just use the following.
In views.py import paginator,
from django.core.paginator import Paginator, InvalidPage, EmptyPage
then in your function
bobj = Batch_Criteria_Batch_Instance.objects.all() # get the objects
or query ur table.
SHOW_CONTENT_LIMIT = 5 #
so i tried this now
class Student_Info(models.Model):
Roll_No = models.IntegerField(primary_key=True)
Cell_No = models.IntegerField()
E_mail = models.EmailField(max_length=30)
class Academics(models.Model):
#Roll_No = models.ForeignKey('Student_Info',to_field='Roll_No')
Roll_No =
Tried
"Without a related name:
>> obj.student_set.all()[0].E_mail "
Btw student_set ??
Anyways it doesn't work..
Still trying to figure out the solution...
Date: Mon, 8 Aug 2011 23:07:59 -0400
From: sh...@milochik.com
To: django-users@googlegroups.com
Subject: Re: Need help writing
Make your life a little easier and add a related_name argument to your
Roll_No foreign key.
Example:
Roll_No = models.ForeignKey('Student_Info',to_field='Roll_No',
related_name = 'students')
Then:
obj.students.all()[0].E_mail
Without a related name:
obj.student_set.all()[0].E_mail
I am sorry i forgot to mention one field which was
class Student_Info(models.Model):
Roll_No = models.IntegerField(primary_key=True)
E_mail = models.EmailField(max_length=30)
Cell_No = models.IntegerField()
Ignoring cell_no i tried
>>> recs=Academics.objects.all()
>>>
On 08/08/2011 10:55 PM, Hayyan Rafiq wrote:
Tried that
>>> recs=Academics.objects.all()
>>> recs[0]
>>> obj=recs[0]
>>> obj.Cell_No
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Academics' object has no attribute 'Cell_No'
Am i missing something??
Yes,
Tried that
>>> recs=Academics.objects.all()
>>> recs[0]
>>> obj=recs[0]
>>> obj.Cell_No
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Academics' object has no attribute 'Cell_No'
Am i missing something??
> Date: Mon, 8 Aug 2011 22:48:05 -0400
> From:
It would just be:
recs = Academics.objects.all()
Because that table has all those fields.
Also, some style notes:
It's non-standard to put underscores in class names.
It's non-standard to put capital letters in field names.
It's non-standard (and grammatically incorrect) to name
Suppose I have the following 2 Classes in models.
class Student_Info(models.Model):
Roll_No = models.IntegerField(primary_key=True)
E_mail = models.EmailField(max_length=30)
class Academics(models.Model):
Roll_No = models.ForeignKey('Student_Info',to_field='Roll_No')
GPA =
Hi,
May be you miss understanted my meaning.
I just want to get the current user object in a normal .py file out of
views.
And this file just offer some data according to different user.
Do you have any methods to get the goal?
thank you
regards,
kejun
On Mon, Aug 8, 2011 at 11:49 PM, Tom
On 9/08/2011 9:49am, eggxtreme wrote:
Hi, i've had some strange errors when trying to install django
standalone, so i have used the whole bundle option, linked from
documentation. Bitnami. It installed python, django, apache,
sqlite I use Windows XP btw.
I'm not sure whether Bitnami will
Thanks for your response, perhaps you're right. I certainly agree
that it's a PITA to have to pass the form with an error message by
redirecting. However, I still think it's unfortunate that, after
redisplaying the page with an error message, a subsequent attempt to
reload the (POSTed) page
On 8/08/2011 8:42pm, Michal Petrucha wrote:
On Mon, Aug 08, 2011 at 06:28:59PM +1000, Mike Dewhirst wrote:
Can anyone tell me if to_field is valid in this context and what is
the distinction between through and db_table? ...
class Sections(models.Model):
""" intermediary table for
Hi, i've had some strange errors when trying to install django
standalone, so i have used the whole bundle option, linked from
documentation. Bitnami. It installed python, django, apache,
sqlite I use Windows XP btw.
And i've went first run on python and django by the tutorial.
Unfortunatly i
On Tue, Aug 9, 2011 at 6:03 AM, Ryan Kaskel wrote:
> I've accidentally added a my blog twice to the Django community site
> (the first time must have been a couple of years ago).How do I remove
> the duplicate entry at https://www.djangoproject.com/community/? My
> blog feed
Hello list!
Is there any way to use a different value for a field when re-displaying
a form? I.e. if a user enters '42' into an IntegerField but made the
other fields not validate, how could that IntegerField be re-displayed
with '43'?
Jonas
--
You received this message because you are
>
>
> >If you need to push back a value in a variable call related_entries, then
>> you will want to set a value in the context dictionary:
>
> >
>
> >context[related_entries] =
>
>
Correction on earlier mail when trying some other things. I do this in the
def render. This looks like:
class
On Mon, Aug 8, 2011 at 10:38 PM, Tom Evans wrote:
> After sending emails to django-users@, I'm getting this ridiculous
> phishing email. The email purports to be from
> django-users@googlegroups.com. The links (which I have removed) point
> to non existent URLs on
I've marked a few things that are important I think, because it is getting a
bit bulky
>These are my assumptions about the bits of code you've posted:
>
> >
>
> >models.py
>
> >categories = models.ManyToManyField('Category', blank=True, null=True,
>> default = None)
>
> >
>
> >*Assumption*:
On Mon, Aug 8, 2011 at 2:20 PM, Josh wrote:
> >It sounds like you're not resolving the variable at all in your render
> method --
> >
> >When you construct the template node, you work with Variable objects,
> which represent the >context variable as it exists in the
I've accidentally added a my blog twice to the Django community site
(the first time must have been a couple of years ago).How do I remove
the duplicate entry at https://www.djangoproject.com/community/? My
blog feed is http://ryankaskel.com/category/django/feed/rss/.
Best,
Ryan
--
You received
I need to override save method of inlines in admin. While saving photos, I
need to add user id to DB column. I cant make it in model because there is
no request data there. How can I do it in admin, to somehow get nad set user
id?
--
You received this message because you are subscribed to the
>It sounds like you're not resolving the variable at all in your render
method --
>
>When you construct the template node, you work with Variable objects, which
represent the >context variable as it exists in the template source (eg,
html).
>
>At the point where you actually render your output,
On Mon, Aug 8, 2011 at 12:14 PM, Josh wrote:
> >{% get_related_entries weblog.entry 5 from object.categories as
> related_entries %}
>
> I found that out already. Now I'm pretty sure the problem is in the
> rendering. As far as I can tell ( I don't know how to test
I have made changes like this:
""" Introduced a new model to store the form field select values """
class Branch(models.Model):
"""Branch"""
name = models.CharField(max_length=50)
name_branch = models.CharField(max_length=50)
address_1 = models.CharField(max_length=100)
class
Hi i wanted to know is there a way through which i could use a tree control in
my template
I wanted to add something like
Student
|_Name
|_Address
|_Contact No
I think you guys get the picture...How can i add something like that in my
template...Thanks
>{% get_related_entries weblog.entry 5 from object.categories as
related_entries %}
I found that out already. Now I'm pretty sure the problem is in the
rendering. As far as I can tell ( I don't know how to test template tags in
a shell ) I get a list of the names of the categories back.
On Monday, 8 August 2011 16:51:52 UTC+1, Josh wrote:
>
> I'm trying to create custom templatetags now, while learning Django. When
> an entry is displayed I want to list other entries with the same categories
> below the entry. I also wrote a templatetag (following the Practical Django
>
I think the problem is in the render part. I've modified the __init__ of the
Node to self.categories = template.Variable(categories)
Any advice is welcome. All I want to do is a query on the Entries model
that have corresponding categories and return it to the template.
--
You received
Hi,
I have dedicated server sites and django hosting sites. Personally, I
prefer that someone else takes care of the server and focus myself on
development. So, unless you need to use a lot of resources for some
reason, dedicated django hostings are ok to me.
About google apps, I never used it.
ok fixed it myself
I should have used class variables and not instance variables inside
formfield_for_foreignkey (actually implemented this in a ModelForm
subclass. So feel free to ask me if you wanna do something similar and
it doesn't work)
On 5 Aug 2011, at 18:04, Tobias Ottenweller
Hi I wanted to know if there was a way in which we could use widget directly in
an HTML file
By widget i mean elements of a form such as input boxes,calendars,Buttons etc
without using the forms class.
For example A default normal html input box is :
I wanted to replace it with a fancier
I'm trying to create custom templatetags now, while learning Django. When an
entry is displayed I want to list other entries with the same categories
below the entry. I also wrote a templatetag (following the Practical Django
Projects from James Bennet)
I'm having problems with using a
On Mon, Aug 8, 2011 at 4:19 PM, Kejun He wrote:
> hi,
> My goal is to generate some data,
> For example:
> I defined a template tag, and it is used to generate a menutree, the item of
> the menutree is a list.
> The list comes from another .py file.In this file,I want to
On Fri, Aug 05, 2011 at 10:31:38AM -0700, fire_water wrote:
> and has a http://code.google.com/p/django-stdimage/
> issues/detail?id=22">known bug that does not delete images when
> its object/row is deleted.
> According to django-imagekit's github.com page, it has the same
hi,
My goal is to generate some data,
For example:
I defined a template tag, and it is used to generate a menutree, the item of
the menutree is a list.
The list comes from another .py file.In this file,I want to get a current
user object(LIKE:request.user),
so I need to get a request object
Thanks Chintan, Tom,
'twas easy.
Regards
Damola
From: Chintan Tank
To: django-users@googlegroups.com
Sent: Monday, August 8, 2011 4:08:09 PM
Subject: Re: problem with django admin
I think you might want to define what text to
Tom,
Thanks for your reply. I will try it out and post back the results.
On Mon, Aug 8, 2011 at 10:25 AM, Tom Evans wrote:
> On Mon, Aug 8, 2011 at 3:06 PM, Chintan Tank
> wrote:
> > (sorry for duplicate I have already posted on
I think you might want to define what text to display when you directly
reference the model's instance.
see
https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#unicode
In Java it is like overriding the toString() method.
On Mon, Aug 8, 2011 at 10:35 AM, Oyedamola Oyeniyi
hahahahah amazing description and page. I accidentally the entire coke
reading the FAQ.
Should be interesting for migrating old projects (not that I have any).
Cheers,
AT
On Mon, Aug 8, 2011 at 11:47 AM, francescortiz wrote:
> The FAQ section is awesome!
>
> On Aug 5,
Hi all,
I have a strange problem with the admin pages and I don't evenknow
where to begin tolook at the FAQ. I'm a newbie to Django and Python(in
fact, web applications in general) so forgive the dumbness of the
question.
I have just finished the models.py and admin.py files on an app I am
The FAQ section is awesome!
On Aug 5, 5:51 pm, rei wrote:
> I accidentally PHP support for the Django template language.
>
> No support yet for cookies, headers or event GET / POST, but otherwise
> functional. See the source code for usage examples.
>
>
On Aug 8, 3:32 pm, Rodney Topor wrote:
> I have a question about the definition of function vote in part 4 of
> the tutorial.
>
> If the user presses the button Vote without selecting a choice, this
> function renders the template polls/detail.html to redisplay the poll
>
For the javascript part, the last thing they say before the footer in
lesscss.org is that you can embed javascript variables inside the css:
It is also possible to access the JavaScript environment:
@height: `document.body.clientHeight`;
I don't know how they handle it, but I don't find
After sending emails to django-users@, I'm getting this ridiculous
phishing email. The email purports to be from
django-users@googlegroups.com. The links (which I have removed) point
to non existent URLs on click22.googlegroups.com
Full headers below:
> Delivered-To: tevans...@googlemail.com
>
On Mon, Aug 8, 2011 at 3:06 PM, Chintan Tank wrote:
> (sorry for duplicate I have already posted on stackoverflow.com >
> http://goo.gl/I7Jj6 )
>
> I need to perform a datamigration of a model Answer in app Question.
> In that script there is a dependency such that I need
On Mon, Aug 8, 2011 at 2:56 PM, Daniel Roseman wrote:
>
> I'm afraid it's really not clear what you're trying to do, or what the
> problem is.
> If the issue is that you have a field referring to a foreign key, and you
> want to change what the values displayed in the
(sorry for duplicate I have already posted on stackoverflow.com >
http://goo.gl/I7Jj6 )
I need to perform a datamigration of a model Answer in app Question.
In that script there is a dependency such that I need to create an
instance of a model Chapter which is in the app Journal. So, I coded
it
On Monday, 8 August 2011 13:06:51 UTC+1, Kayode Odeyemi wrote:
>
> That didn't help either. It still did not depict what I'm trying to do.
> Those filters are for retrieving values set by a user. However, I tried the
> code below which is to hard code the choices into the form field on
I have a question about the definition of function vote in part 4 of
the tutorial.
If the user presses the button Vote without selecting a choice, this
function renders the template polls/detail.html to redisplay the poll
detail with an error message. However, the URL in the address bar of
the
Yeah form.branch_name displayed but the values are not the tuples - this is
the primary reason why I'm seeking for help.
I have dabbled into the modelForm (widgets) as an option, obviously no luck
there.
At the moment, I'm building a new model that maps the db table that contains
the values,
Like they do in the admin, right ?
You might want to check Django's source for the admin forms and templates to
get some inspiration then.
Hard coding the choices is never a satisfactory solution but I suggest you
retrieve them from your models file so you stay DRY compliant and then it's
pretty
That didn't help either. It still did not depict what I'm trying to do.
Those filters are for retrieving values set by a user. However, I tried the
code below which is to hard code the choices into the form field on creation
class TransactionUpdateForm(forms.ModelForm):
branch_name_new =
Hey guys i am looking for a teacher for django beginner i Pay for
hour ,with the skype
And teamviewer ,chat Pls Send me skype user for contact me to
ivan_vilc...@hotmail.com
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
Hello,
Please why am I get the following error:
Caught NameError while rendering: global name 'name' is not defined.
Initially I did not receive this sort of error, it just surfaced all
off a sudden. I restored my app to the state where everything worked
and I'm still getting the same error.
On Mon, Aug 08, 2011 at 06:28:59PM +1000, Mike Dewhirst wrote:
> Can anyone tell me if to_field is valid in this context and what is
> the distinction between through and db_table? ...
>
> class Sections(models.Model):
> """ intermediary table for Document recursive m2m """
> document =
On 08/08/11 09:09, Matthias Kestenholz wrote:
Hello everyone
The first release candidate of FeinCMS v1.4 hit the streets yesterday
and is available at the usual places. Please note that the official
repository has been moved to the feincms organization on github and
does not live in my personal
On Monday, 8 August 2011 11:08:29 UTC+1, oops wrote:
>
> Hi,
>
> I try to get a request object out of views.py, and could not get the
> reqeust object through "def demo(request)".
>
> Could you tell me how to get it??
>
> Or is there other ways to get the same goal.
>
> Thanks very much
>
>
Oh, sorry, I must have misunderstood then.
I remember reading a post on thread on SO that addressed this, and I believe
that they came up with a template filter as there was no "simple" way to do
it.
Here it is:
Hi,
I try to get a request object out of views.py, and could not get the reqeust
object through "def demo(request)".
Could you tell me how to get it??
Or is there other ways to get the same goal.
Thanks very much
regards,
kejun
--
You received this message because you are subscribed to the
Thanks for the reply.
I have a views.py like this:
@login_required
def update_transaction(request, tpin=None):
qs = Q(my_institution=None) |
Q(my_institution=request.user.get_profile().my_institution)
txn = get_object_or_404(Transaction.objects.filter(qs), tpin=tpin)
context =
Check out get_FOO_display, there:
https://docs.djangoproject.com/en/dev/ref/models/instances/
Le 8 août 2011 11:06, "Kayode Odeyemi" a écrit :
> In the Django [1], the example as described below shows how to build Forms
> that are tied to a model.
>
> from django.db import
Open works files that are on your hard drive, not with urls.
That is : open('/var/www/myfile') works, but open('http://mysite/myfile')
doesn't.
You should not use the url of the file but its location on the disk (like
/var/mymedia/myfile on Linux).
If you really want to open it through the
So I have a pdf I want to send as an attachment
file is Doc.objects.all()[0]
brochure = file.get_full()
// returns http://www..xx/media/docs/file.pdf
fp = open(brochure, 'rb')
attachment = MIMEImage(fp.read())
fp.close
msg_preamble = "dd"
msg.attach(attachment)
// fp =
In the Django [1], the example as described below shows how to build Forms
that are tied to a model.
from django.db import models
from django.forms import ModelForm
TITLE_CHOICES = (
('MR', 'Mr.'),
('MRS', 'Mrs.'),
('MS', 'Ms.'),
)
class Author(models.Model):
name =
Can anyone tell me if to_field is valid in this context and what is the
distinction between through and db_table? ...
class Sections(models.Model):
""" intermediary table for Document recursive m2m """
document = models.ForeignKey(Document, to_field='ancestor')
section =
Hello everyone
The first release candidate of FeinCMS v1.4 hit the streets yesterday
and is available at the usual places. Please note that the official
repository has been moved to the feincms organization on github and
does not live in my personal account anymore.
Development of 1.5 has
69 matches
Mail list logo