Hi Daniel,
i change it to instance, but still got other errors :
def myadmin_change_post(request,
template_name='blog/admin/change_post.html'):
try:
id= request.GET.get('id','4')
except ValueError:
id=1
#post = get_object_or_404(Post,pk=id)
post = Post.objects.get(
hello,
I store request.GET in session:
request.session['query_string'] = request.GET
then I retrieve the value in another page and try to urlencode the
QueryDict:
context['query_string'] = request.session['query_string'].urlencode()
in my context I get the python's string representation of the
> I am trying to construct a simplest example to see the djblets data grid in
> action
>
> def test(request):
> countries = [ {'name': 'Australia', 'population': 21, 'tz': 'UTC +10',
> 'visits': 1},
> {'name': 'Germany', 'population': 81, 'tz': 'UTC +1',
> 'visits': 2},
>
I am trying to construct a simplest example to see the djblets data grid in
action
suppose everything is in my view.py
views.py
-
class UserDataGrid(DataGrid):
username = Column("Country Name", sortable=True)
first_name = Column("Population", sortable=True)
last_name = Col
Is there an easy way to change "Auth" to "My Authentication App Name"
in index.html? I tried changing {{ name }} to
{{ string.replace(name,'Auth','My Authentication App Name') }} but it
just kills the label completely -- hopefully just a syntax problem.
How about changing the order that the models
I've also created a TimeDeltaField.
It stores internally in PG as an INTERVAL, but as a string in other dbs.
http://hg.schinckel.net/django-timedelta-field
Matt.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the w
> The response is something like:
> 'Content-Type: text/html; charset=utf-8\n\n[{"pk": 1, "model":
> "MyApp.foo", "fields": {"choice_field": "db_name1"}}]'
This is interesting.. But I think the serializer is working properly.
the first element in the tuple is the value stored in the database,
and
Depending on the resolution and maximum duration, you could just use
an integerfield containing either the number of seconds or minutes,
and then recreate it. That way you can also base queries off of the
value, which you can't do with just a pickle field. Of you could
subclass the integerfield a
Hello,
I'm new to Django and having a problem with serialization.
I am trying to serialize a model that has a CharField with choices,
and the json serializer returns json with the choices' database values
instead of display values.
Is there a way to get the json serializer to use the choices's di
Thank you very much!! I know my code needs to be tidied up xD. I'vd tried many
things to solve the problem that's why my code looks so awful. And I'm glad
there is an easy solution for my problem (and I didn't saw it *wall*)
And @bruno desthuilliers: It's good for a newbie like me to see how ot
On 08/14/2011 09:57 PM, bruno desthuilliers wrote:
{% for current, entry, month, n in months %}
Please think about what "months" is here... Yes, a list of dicts. So
this line is the equivalent of:
current = months[0] # first dict in the list
entry = months[1]# second dict in the list
month
Hi,
your template is missing a closing double-quote
this line
> "month{% endif %} >
should be
> "month"{% endif %} >
Also by reformatting a little I noticed you close a with a
{% for current, entry, month, n in months %}
{% if entry %}{% endif %}
http://foo.bar/"
On 14 août, 20:11, Schmidtchen Schleicher
wrote:
> Hey Guys,
> my problem is, as shown in the subject, that the template-engine puts in the
> name of the templatevariable instead of the value:
>
> my view:
>
> def YearlyView(request, calid, year):
The convention is to use all_lower names for func
You can something like the following code to create a custom TimeDeltaField
in django.
Here I'm using python object serialization of represent the object as a
character object in the database.
models.py
===
import datetime
import pickle
from django.db import models
class TimeDeltaField(model
Hey Guys,
my problem is, as shown in the subject, that the template-engine puts in the
name of the templatevariable instead of the value:
my view:
def YearlyView(request, calid, year):
lst = []
k = get_object_or_404(Kalender, pk=calid)
now_year, now_month = datetime.date.today().year
This line:
form = AdminPostForm(initial=post)*
*
should be
form = AdminPostForm(instance=post)
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-use
Check this http://dpaste.com/594215/
I've taken it from Marty Alchin's 'Pro Django' book and I just fixed
decimal import to get it working
On 14/08/11 15:13, Python_Junkie wrote:
One of the reasons that I migrated to django is because of the
underlying functionality.. With that said I would u
well this sounds good..
thanks for the information russell .
Mulianto
On Sun, Aug 14, 2011 at 3:31 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:
>
> On Sunday, August 14, 2011, Phang Mulianto wrote:
> > Thanks Reinout for the response,
> >
> > i read the doc , just in time compilat
Even if there are no if interests|length > 0 I get the extra
whitespaces. Sam is correct. I've used Jinja2 before and used the - to
remove unnecessary lines.
I have lots of templates written for django, so I don't want to
retrofit them all. Worse case I could post process the message, but I
would
> The builtin dev server is not meant to be {{USED IN production}},
Python_junkie is NOT in production.
> and setting up apache+mod_wsgi (DaemonProcess mode) is no big deal.
It can be for beginners; it can wait until app will be deployed
>> I am presuming that I can continue to use the django li
hi..need help..
Here are the model :
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
slug = models.SlugField(max_length=50, unique=True, help_text='Unique
Value for Article page URL, created from title.')
is_publish = models.Boolean
If you have a solution that is fine.
But if you did the business logic in the view, there is no need for
{%- if interests|length > 0 %} and you would simply return your
dictionary values while rendening as a variable that contains actual
values
and no need for the if statement which provides t
One of the reasons that I migrated to django is because of the
underlying functionality.. With that said I would use a separate table
or file, whichever you are comfortable with , to store the changing
time delta variable.
You could dynamically retrieve this variable in the view or, the
example th
Thank you.
I got the same resolution from a previous django aficianado and it
worked perfectly.
On Aug 14, 5:01 am, Subhranath Chunder wrote:
> If the external IP or some domain name lands you directly on your machine,
> then:
> python manage.py runserver 0.0.0.0:
> would do.
>
> To access you
You are a true genius!
Thank you
The runserver command with the ip address with the IP worked
perfectly.
Thank you again
On Aug 14, 12:33 am, Landy Chapman wrote:
> >The application runs when I remote into the server and run
> > the web pages with localhost on the 8000 port.
> > How do I
On 14 August 2011 14:00, Python_Junkie wrote:
> I think that if you performed the logic to determine if there actually
> is something in the interest for that row in the view and
> then only pass those components from the view, and not in the template
> then your problem goes away.
>
I don't thin
oh thats right, thanks man
On 14 Aug., 12:18, Andrew wrote:
> I use the messages framework (https://docs.djangoproject.com/en/dev/
> ref/contrib/messages/#module-django.contrib.messages) to display
> messages after handling a post. My base template displays the messages
> meaning I can redirect t
thank you much,
but let me ask you again in detail.
i have this html:
Cache leeren: Cache clear
and this view:
def clear_it(request):
b = Command()
b.clear_cache()
#
# here i dont know what to write...
#
#
success_msg = 'Cache cleared successfull'
ret
Hello all,
In one of my models, I want to store a timedelta--a length of time not
tied to a particular start and end date. Although timedeltas are built
into Python, tragically there's no TimeDeltaField in Django.
Extra complications:
* The timedelta can be quite large -- on the scale of one wee
Thanks, I've added a function to the Enty models. It doesn't in some cases I
get good returns now. But not always.
Content is the name of the app. There is no PK-relation on the Category
class, but only the below on the Entry class.
class Entry(models.Model):
categories = models.ManyToManyF
I use the messages framework (https://docs.djangoproject.com/en/dev/
ref/contrib/messages/#module-django.contrib.messages) to display
messages after handling a post. My base template displays the messages
meaning I can redirect to any page after the post and know that the
message will be displayed.
you can use javascript function...
On Sun, Aug 14, 2011 at 4:53 PM, Subhranath Chunder wrote:
> Setting a simple context variable in your view would solve your purpose.
>
> Thanks,
> Subhranath Chunder.
> www.subhranath.com
>
>
> On Sun, Aug 14, 2011 at 1:22 PM, doniyor wrote:
>
>> Hey Guys,
>>
>
If you are okay with overriding the values in you view, then can use
something like:
...
form = MyForm(request.POST)
if form.is_valid():
...
else:
data = form.data.copy()
data['field_name'] = 'default_value'
form = MyForm(data)
...
Not very efficient, but clean code.
Thanks,
If the external IP or some domain name lands you directly on your machine,
then:
python manage.py runserver 0.0.0.0:
would do.
To access you can use: http://:
This should do. Hope it helps.
Thanks,
Subhranath Chunder.
www.subhranath.com
On Sun, Aug 14, 2011 at 9:12 AM, Python_Junkie <
software
Setting a simple context variable in your view would solve your purpose.
Thanks,
Subhranath Chunder.
www.subhranath.com
On Sun, Aug 14, 2011 at 1:22 PM, doniyor wrote:
> Hey Guys,
>
> i need a litle help in working with forms. i have a button and i want
> to output a success text above the but
The admin is supposed to provide an easy and ready to use interface for
content manipulation.
If your app doesn't have models, then the admin makes no sense for it.
Thanks,
Subhranath Chunder.
www.subhranath.com
On Sun, Aug 14, 2011 at 1:26 PM, doniyor wrote:
> Hey Guys, i have here another pr
Hey Guys, i have here another problem..
i wrote an app, without models, the whole thing happens in views.py
and functions are coming from another file. so the thing i want is
that my app should be visible in admin site. i read about overriding
the app_index.html and put it under admin directory in
Hey Guys,
i need a litle help in working with forms. i have a button and i want
to output a success text above the button if the user presses the
button. how to do this ? is there any template tag like {% if
form.is_submitted %} or so?
main point is that i dont want to write another html file on
On 14 août, 05:42, Python_Junkie
wrote:
> I have placed my django application on the virtual server from go
> daddy. The application runs when I remote into the server and run
> the web pages with localhost on the 8000 port.
>
> How do I connect to this web page for demonstration purposes when I
On Sunday, August 14, 2011, Phang Mulianto wrote:
> Thanks Reinout for the response,
>
> i read the doc , just in time compilation to Python bytecode is used in
jinja..
>
> is django default template also do this ?
>
> which i see the reason why jinja faster.
Django's template engine doesn't curr
40 matches
Mail list logo