CSRF token is missing

2010-08-25 Thread Jonas Geiregat
code. Which is not there. So I looked where django lived by running: import django; django.__file__. Looked in the contrib/comments/templates/comments/form.html file. Inside that file the I'm seeing " {% csrf_token %}" So my question is; Why isn't the csrf_token generate

Query overhead or not ?

2010-08-30 Thread Jonas Geiregat
y of which tags are used the most. I'm wondering if this is a good idea ? Since if I have 1000 tags this would require 1000 queries just for one simple tag cloud. Is there a better way of solving this without adding an extra count field to the Tag model. Regards, Jonas Geiregat jo.

Re: Query overhead or not ?

2010-08-31 Thread Jonas Geiregat
d 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, visi

Re: Query overhead or not ?

2010-09-01 Thread Jonas Geiregat
I look at aggregation and annotation but I don't think It's possible to solve this by using any of those two systems. Or am I overlooking something ? Op 31-aug-2010, om 13:09 heeft Jonas Geiregat het volgende geschreven: > Thanks for your advise. I'm short of time righ

Re: fetching values from model

2010-09-01 Thread Jonas Geiregat
com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > Met vriendelijke groeten, Jonas Geiregat jo...@geiregat.org -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: fetching values from model

2010-09-01 Thread Jonas Geiregat
about? > > On Sep 1, 6:02 pm, Jonas Geiregat wrote: >> You don't write Python code inside your template file. That's one of the >> basic django template rules. >> You can pass values from your views to your template and show them there. >> Or generate the H

Re: Query overhead or not ?

2010-09-01 Thread Jonas Geiregat
Tag.objects.values('name').annotate(times_used=Count('post__tags')) That's the solution! Op 1-sep-2010, om 15:00 heeft Jonas Geiregat het volgende geschreven: > I look at aggregation and annotation but I don't think It's possible to solve > this by u

Re: {% csrf_token %} template tag not outputting the hidden field

2010-09-01 Thread Jonas Geiregat
bscribed 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://group

django-1.2.1 on ubuntu

2010-10-03 Thread Jonas Geiregat
Hello I've been currently developing a django application on my Mac which runs 1.2.1. Now I've setup a ubuntu server which I like to move my project to. Ubuntu installs django-1.1 by default. My current setup on ubuntu uses apache and mod_wsgi with django version 1.1. I wish to move to version 1

Generic relations

2010-11-17 Thread Jonas Geiregat
n [4]: g = GenericPost(content_object=a) In [5]: g.save() In [6]: GenericPost.objects.all() Out[6]: [, , , ] Why is it that I have 4 objects already when I only have created one ? And how do I access that particular object by using the GenericPost model ? Regards, Jonas Geiregat jo...@geiregat

Re: Generic relations

2010-11-17 Thread Jonas Geiregat
cPost.objects.get(pk=1).content_object.content --- AttributeErrorTraceback (most recent call last) /Users/Jonas/Webdesign/genericv/ in () AttributeError: 'NoneType' object has no attribute

Re: Generic relations

2010-11-18 Thread Jonas Geiregat
That was it! After running: ./manage.py sqlclear foo | ./manage.py dbshell && ./manage.py syncdb it works! So something in my db was inconsistent! Thanks! Op 18-nov-2010, om 09:57 heeft Marc Aymerich het volgende geschreven: > On Thu, Nov 18, 2010 at 12:00 AM, Jonas Geiregat wrote

Re: Using foreignkey data as a primary key

2010-11-18 Thread Jonas Geiregat
ld(Tag) > >def __unicode__(self): >return self.tag > > > Should I be using OneToOne field or ForeignKey or neither and some > other mechanism? Met vriendelijke groeten, Jonas Geiregat jo...@geiregat.org -- You received this message because you are subscribed to

Re: how to hide a field on

2010-11-18 Thread Jonas Geiregat
u 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

Generic relation overflows the maximum recursion depth

2010-11-19 Thread Jonas Geiregat
he problem occurs when creating a Post model and saving it: p = Post(title="foobar", ) p.save() I get the following error message: RuntimeError: maximum recursion depth exceeded The problem should be located in the post_save_callback function. Kind regards, Jonas Geiregat jo...@ge

Re: Not main content on site - how to?

2010-11-21 Thread Jonas Geiregat
m. > 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. > Met vriendelijke groeten, Jonas Geiregat jo...@geiregat.org -- You received this mes

css templates

2010-12-06 Thread Jonas Geiregat
ted within the django framework ? Met vriendelijke groeten, Jonas Geiregat jo...@geiregat.org -- 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 th

mocking out a Model

2012-04-14 Thread Jonas Geiregat
Hello, I'm trying to test a function that imports and acts upon a django model, named House. from apps.market.models import House def create_house(location, date, price): house = House(id=None, date, price) house.save() # calculate some stuff and further expand the hous

Re: mocking out a Model

2012-04-15 Thread Jonas Geiregat
>> @patch('apps.market.models.House') > > Is create house in apps.market.models, or is it somewhere else? If > it's somewhere else, mock it relative to that file eg: > @patch('apps.some_file.House') def create_house can be found in apps/deps/house_factory.py Inside house_factory I ' from apps.m

Re: Testing Google Charts within Django Unit Tests

2012-04-26 Thread Jonas Geiregat
> I'm looking for a way to test the data that a google chart displays on > a web site with a unit test. Is this at all possible, and if so, where > should I look to accomplish this? I've tried accessing the Google > visualization datatable that is used to create the chart, but it > doesn't seem t

Translated urls and accept-language header

2012-06-27 Thread Jonas Geiregat
Hello, I've setup translated urls for some languages. The default language for django has been set to en-US. If you request a page /registration/ with nl-NL as Accept-Language header, I get a 404. I wasn't expecting such behaviour. Rather I was hoping I would be redirected to /registratie/ ,th

Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-28 Thread Jonas Geiregat
On do, jun 28, 2012 at 09:14:36 -0700, brycenesbitt wrote: > http://127.0.0.1:8000/comments/post/>" method="post"> >/> >id="id_timestamp" /> >value="6e85e1c846861c80575ce435b21a855706725b00" id="id_security_hash" > /> After the starting form tag add {% csrf_token %} More

[ANN] django-ajax-form-mixin v.0.0.1

2012-09-03 Thread Jonas Geiregat
http://django-ajax-form-mixin.readthedocs.org/en/latest/ Hope you enjoy it! Regards, Jonas Geiregat. -- 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

testing a django package

2012-09-10 Thread Jonas Geiregat
Hello, I've created a simple reusable django package. This package basically consists out of a views.py file, with some helper functions. I want to write some tests for what's in this file. This file contains a mixin , so I probably can't test it directly. What's the best way to test a django

Re: testing a django package

2012-09-11 Thread Jonas Geiregat
he methods in them > . You can always use mocking library > . Tests are basically just python code with a lot of asserts, you can always > add viewed in them > . You can use fixtures for test data if you see fit > > Hope this helps! > > Thomas > > On Sep 10,

Re: testing a django package

2012-09-12 Thread Jonas Geiregat
gt;> . Class based views can sometimes be tested without any of the former by >> just testing the methods in them >> . You can always use mocking library >> . Tests are basically just python code with a lot of asserts, you can >> always add viewed in them >&

Re: testing a django package

2012-09-12 Thread Jonas Geiregat
ing JS for this purpose. > > Thomas > > 2012/9/12 Jonas Geiregat : >> >> I can now show you what I really would like to write tests for. >> >> https://github.com/jonasgeiregat/django-ajax-forms >> >> The code I would like to test is in ajax_forms

Re: testing a django package

2012-09-13 Thread Jonas Geiregat
> will be some reversing involved I think. > > self.client.get(reverse("ajax_form_view")) > > I don't see how the client will find my urls.py file and without the broader, > actual django application as context ? > > >> >> Now, this is probably

Re: testing a django package

2012-09-13 Thread Jonas Geiregat
urls.py file and without the broader, > actual django application as context ? > > > > > > Now, this is probably not going to be practical to test your jQuery > > components, but you might want to ask on a JS-focused list regarding > > unittesting JS for this

Re: content management in django

2012-09-24 Thread Jonas Geiregat
I would advise you to take a look at feincms, it has exactly what you need. > Hello, > > I'm converting a static website to a Django application and I need a piece of > advice from more experienced people what is the right way to store content. > The website will have some static pages like "ab

model field not null

2012-09-26 Thread Jonas Geiregat
Hello, While setting up a new model I'm trying to have a strong data model. One of the requirements is that a certain field cannot be null. lastname = models.CharField( blank=False, default=None,

Does ModelForm follow ForeignKey relations ?

2011-09-20 Thread Jonas Geiregat
creating froms from models but didn't found any clues. Is this even possible at all ? Now I'm implementing the form by hand , which is a lot of work , being able to use the ModelForm would speed up this process. Regards, Jonas Geiregat jo...@geiregat.org -- You receive

Re: Does ModelForm follow ForeignKey relations ?

2011-09-20 Thread Jonas Geiregat
> Hi, > > ModelForm should automatically create a dropdown list for your foreign key. > If there is nor such drop-down created probably you are doing something wrong. > I don't want the dropdown list I want the values of the foreinkey to be expaneded into fields For example I have user as For

Re: Does ModelForm follow ForeignKey relations ?

2011-09-20 Thread Jonas Geiregat
> So you want to edit the User object through the ModelForm of the other model, > or you just want to display it? > I want to edit the User object through the ModelForm. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Keep getting TemplateDoesNotExist when unit testing

2011-12-24 Thread Jonas Geiregat
Hello, I'm fairly new to Unit Testing. As I'm trying to setup a simple unit test in one of my Projects, it keeps returning a TemplateDoesNotExist Exception. It looks like for some reason the unit test framework can't locate my template directory I've correctly defined in settings.py Here's the

Keep getting TemplateDoesNotExist when unit testing

2011-12-24 Thread Jonas Geiregat
Hello, I'm fairly new to Unit Testing. As I'm trying to setup a simple unit test in one of my Projects, it keeps returning a TemplateDoesNotExist Exception. It looks like for some reason the unit test framework can't locate my template directory I've correctly defined in settings.py Here's the

Re: Creating clean URLS

2012-01-01 Thread Jonas Geiregat
> I want my url to be free from parameters being passed. > > I have handled the request in "twitter_after_auth" function of view > and > > I am redirecting user to the new url "http://localhost/create_cr/"; > > but instead the url shows some additional parameters that I have > already handled.

Re: Joining Tables

2012-01-08 Thread Jonas Geiregat
> The user field is a foreign key to django auth User model. Each user is > assigned to a group (django Auth Group model). I want to retrieve all the > photos which belongs to users of a specific group. How can it be done? > from django.contrib.auth.models import Group group = Group.objects.

Re: Joining Tables

2012-01-08 Thread Jonas Geiregat
> The user field is a foreign key to django auth User model. Each user is > assigned to a group (django Auth Group model). I want to retrieve all the > photos which belongs to users of a specific group. How can it be done? > from django.contrib.auth.models import Group group = Group.objects.

Re: Joining Tables

2012-01-08 Thread Jonas Geiregat
> Thanks Jonas, the statements you had provided would give me a list of users > who belong that group, but how can I retrieve the photos of those users? > Actually I was looking for a single statement which would join all these > tables and returns the data based on the Group ID. I would reco

Re: RequestContext(request)

2012-01-09 Thread Jonas Geiregat
I'm no expert but the problem should most likely lay with how STATIC_URL is populated. When the line: str(request.POST.get('question')) , email = "" + > str(request.POST.get('email'))) >p.save() > >else: >form = newform() # An unbound form > >return render_to_respon

Re: RequestContext(request)

2012-01-09 Thread Jonas Geiregat
I'm no expert but the problem should most likely lay with how STATIC_URL is populated. When the line: str(request.POST.get('question')) , email = "" + > str(request.POST.get('email'))) >p.save() > >else: >form = newform() # An unbound form > >return render_to_respon

can't get translation to work

2012-11-16 Thread Jonas Geiregat
I've got an app with the following translation settings: # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'nl-BE' gettext = lambda s: s LANGUAGES = ( ('en', gettext('English')), ('nl', gettext('

Foreignkey Form

2012-12-12 Thread Jonas Geiregat
Hello, Suppose I have a model with a foreign key. class Building(models.Model): pass class Inhabitant(models.Model): building = models.ForeignKey(Building) I would like to display a form where all fields from the Building model and Inhabitant model are visible (but only once) Should I

Re: Foreignkey Form

2012-12-12 Thread Jonas Geiregat
correct > value before saving > > IMHO simple way is create a edit form for buiding which has buttons > add/remove inhabitant . check DetailView in docs please > > thanks, Serge > skype: skhohlov > tel: +380636150445 > > > 2012/12/12 Jonas Geiregat : >&

Re: Converting Django app into a Desktop app

2012-12-18 Thread Jonas Geiregat
> Hi > > I am very comfortable with Django, and I was wondering about whether there is > some way to convert a Django web app into a Desktop app (may be not 100%), so > that I can distribute it to users. May be wrapping it in a light web server > "if there is something like this". > > >

Re: how to deploy django project to lighttpd server

2013-01-07 Thread Jonas Geiregat
I have several account on djangoeurope.com. What I mostly do is like you did, create a new project using their admin interface. Next I backup the RUN script and delete that directory completely! The I checkout my project code, just make sure the project you are checking out (or copying) has th

Re: App-structure: how to have a bunch of data in all the pages.

2013-02-05 Thread Jonas Geiregat
On Tue, Feb 05, 2013 at 02:06:28AM -0800, Stefano Tranquillini wrote: > Now, i can create a base.html template where i render the data. but, how > should i do the population of these lists? > Should i create a middleware that for each request populates the lists? > or what? I think that a Context

Re: linux or windows

2013-05-31 Thread Jonas Geiregat
On 31 May 2013, at 13:11, Kakar Arunachal Service wrote: > Hi! > I know this question is one absurd question, but just out of curiosity, is it > important to use linux other than the windows, related to django. Cause i'm > in windows, and if it is, then i was thinking to use Ubuntu. Please advi

Re: CBVs and using existing forms for user authentication etc

2013-05-31 Thread Jonas Geiregat
On 31 May 2013, at 12:36, tony gair wrote: > > I'm trying to write my first django app using cbv's and good practice ala 2 > scoops! > > (thanks for all the help so far in this forum btw!) > > I have constructed the app using django braces and CBV's and have noticed > that I can only authent

Re: linux or windows

2013-05-31 Thread Jonas Geiregat
On 31 May 2013, at 13:26, Kakar Arunachal Service wrote: > thanks!! So, for the production purpose, one must use linux? > No you can also run django and python applications in general on a window system, even in production. But in is most cases it's easier to deploy a django/python applicatio

Re: Something similar to a WAMP stack for Django?

2013-06-05 Thread Jonas Geiregat
On 05 Jun 2013, at 18:07, Nafiul Islam wrote: > Hi! > > Is there something similar to a WAMP stack for django and python development, > like there is for PHP? It gives you a better way of emulating how a real > server would work. There is: http://bitnami.com/stack/django -- You received th

Re: PDF generator in Django

2013-08-06 Thread Jonas Geiregat
On 04/08/2013, navnath gadakh wrote: > Which is best tool to generate PDF in python django I sucessfully used django-appypod before. It uses a rather strange library called appy.pod that uses openoffice odt files as a template. If you have an openoffice server running you can generate a pdf out o

Re: Json serialization for use in JS

2011-05-19 Thread Jonas Geiregat
;] } ] } > > > thanks for any guidance you can give. Perhaps there is a better way > entirely to handle JSON in django I haven't run across yet. > > -- redfive > > -- > You received this message because you are subscribed to the Google Groups > "Django

Re: Json serialization for use in JS

2011-05-20 Thread Jonas Geiregat
> > Your idea of overriding the Serializer class sounds like a better idea to me. > It should be possible (and will be interesting) ,I'll think I'll look into > that tonight. Overwriting django's default serializers is possible. This is how I've done it: In the root of my django project: mkd

Re: Json serialization for use in JS

2011-05-20 Thread Jonas Geiregat
> > class Serializer(PythonSerializer): > def end_object(self, obj): > self.objects.append({ > "fields" : self._current > }) > self._current = None > > I've made a small mistake I was importing PythonSerializer while It should've been JsonSerializer C

Re: Authenticating from a mysql database

2011-05-22 Thread Jonas Geiregat
-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > Jonas Geiregat jo...@geiregat.org -- You received this message because you are subscribed to the Google Groups "Django users" g

Re: How do you organize your deployment enviroment

2011-05-23 Thread Jonas Geiregat
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. Jonas Geiregat jo...@geiregat.org -- You

Re: Authenticating from a mysql database

2011-05-23 Thread Jonas Geiregat
er') | YES | MUL | > Driver|| > > The password is encrypted using mysql's password() function, but I > guess that would not pose too much of a problem, right? > > All the best, Uwe > > > On 23 Mai, 00:16, Jonas Geiregat wrote:

Re: Authenticating from a mysql database

2011-05-23 Thread Jonas Geiregat
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. > Jonas Geiregat jo...@geiregat.org -- You received this

Re: How do you organize your deployment enviroment

2011-05-25 Thread Jonas Geiregat
uot; 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. Jonas Gei

Re: django database

2011-05-26 Thread Jonas Geiregat
> do i have to install mysql to create a database in my website? As mentioned before you can use sqlite but consider the disadvantages: * Speed (sqlite for me ,even when developing a serious application, is a no go) When deleting large rows sqlite is remarkably slower then mysql. * I've seen s

Re: Stuck on "ViewDoesNotExist" last step of tutorial part 4

2011-06-18 Thread Jonas Geiregat
0. raise ViewDoesNotExist("Tried %s in module %s. > Error was: %s" % (func_name, mod_name, str(e))) > > Exception Type: ViewDoesNotExist at /polls/1/vote/ > Exception Value: Tried results in module polls.views. Error was: > 'module' object has no attrib

complex query

2011-07-03 Thread Jonas Geiregat
(max_length=20) What I want to query for is: The most used Tags (and their count) for all books who's pub_date is greater then today. I can solve the last part Book.objects.filter(pub_date__gt=datetime.date.today()) But how do I count all the tags for all these books ? Jonas Geireg

Re: django/python performance vs play/java

2011-07-05 Thread Jonas Geiregat
n play behind nginx proxy too: the > results are pratically identical. Note the response time too: the > slowest play response is 47 ms, the fastest django one is 110 ms, > > any suggestion to improve performance is appreciated, > > thanks in advance, > drakkan > > -

Re: cropping of an image

2011-07-07 Thread Jonas Geiregat
> > I want the code for including an image with crop feature. Django doesn't come with any image handling libraries. I've done this before and have used PIL (Python Image Library) for it. It might be advised to use this in combination with celery if you're handling large files. That way it w

Re: login form

2011-07-09 Thread Jonas Geiregat
> @ All > i have created a login form in django. > but after filling the username and password when click on submit, it > shows the following error : > > Forbidden (403) > > CSRF verification failed. Request aborted. This has been asked many times before on this list. I advise you to read th

Re: Extending User model with Inheritance - Attribute Error

2011-07-10 Thread Jonas Geiregat
Op 10-jul-2011, om 12:37 heeft Venkatraman S het volgende geschreven: > > This is not good design. If you want to store some extra fields for a User - > i would define just another model called ProfileDetails, FK it to User and > use it as such. That's also how I would do it, some example cod

Re: need help with calling following complex query

2011-07-10 Thread Jonas Geiregat
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. > Jonas Geiregat jo...@geiregat

Re: need help with calling following complex query

2011-07-11 Thread Jonas Geiregat
> > results.extra(select={ > 'distance': > '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(latitude)f)*cos(%(longitude)f-longitude)))' > % { > 'latitude': latitude, > 'longitude': longitude

Django API

2011-07-12 Thread Jonas Geiregat
django was written. Is there something like that out there ? Regards, Jonas Geiregat jo...@geiregat.org -- 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 un

Re: request.method GET or POST

2011-07-12 Thread Jonas Geiregat
Op 12-jul-2011, om 07:04 heeft Venkatraman S het volgende geschreven: > We have to check for request.method to suitably route the request to the > logic. > > Would it be nice if we have something like doGet or doPost(similar to java > servlets) that we have in our views, > so that the request

Re: block bots and spiders

2011-07-12 Thread Jonas Geiregat
> Hi all, > > has someone an effective way to block away bots and spiders? > There are so many ignoring robots.txt - besides facebook and tons of > Java/xyz clients there are many more illegal spiders around. > > So does anyone have a performance effective way to block them out? > Or do you thi

Re: get all objects that are related to current, reverse look up

2011-07-12 Thread Jonas Geiregat
Op 12-jul-2011, om 09:18 heeft bruno desthuilliers het volgende geschreven: > On Jul 12, 4:32 am, garagefan wrote: >> simply put, here's my code >> >> class ContentBlock(Orderable, Displayable): >> location = models.ManyToManyField(ContentBlockLocation, blank=True, >> null=True, help_text="li

Re: Inspecting objects

2011-07-12 Thread Jonas Geiregat
d 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, visi

Re: Inspecting objects

2011-07-12 Thread Jonas Geiregat
Op 13-jul-2011, om 08:25 heeft Jirka Vejrazka het volgende geschreven: >> Thank you all for your help!!! > > I know I'm a bit late to the party (blame timezones :), but thought > I'd put my 2 cents worth in :) > > For inspecting models from command lines (usually when working with > models from

Re: session and caching

2011-07-13 Thread Jonas Geiregat
> I have site with with a lay-out depending on a session, set in my > view. I first tried site-wide caching, and this obviously didn't work. > The caching is not session aware, and the lay-out changes almost > randomly. Are you sure because in the docs I find the opposite. https://docs.djangopr

django.contrib.auth.view.login reuse

2011-07-21 Thread Jonas Geiregat
Hello, I would like to add login fields to each page. But I want to keep it as DRY as possible. I'm pretty satisfied until now about using django.contrib.auth.views.login ,but that's just one specific view in my case host.com/login. With a urls.py line as: (r'^/login/$', 'django.contrib.auth.

Re: import django models without runing the server

2011-07-21 Thread Jonas Geiregat
> Alexander, > > Try use this > > #test.py > import os, sys > sys.path.append('../') > os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' > > myproject/test.py > This is a good read on the subject , it presents an elegant solution. http://superjared.com/entry/django-and-crontab-bes

Re: django.contrib.auth.view.login reuse

2011-07-21 Thread Jonas Geiregat
> Hello, > > I would like to add login fields to each page. But I want to keep it as DRY > as possible. > I'm pretty satisfied until now about using django.contrib.auth.views.login > ,but that's just one specific view in my case host.com/login. With a urls.py > line as: > (r'^/login/$', 'dja

limit foreignkey of queryset

2011-07-22 Thread Jonas Geiregat
Hello, How would I limit the results of a foreign key of a queryset ? Ie. I have the models Person and Task. I want to get all Person's but only get their 2 latest tasks. Person__task points to Task__name It's a ManyToMany Relationship. Jonas Geiregat jo...@geiregat.org -- Yo

Parse content

2010-12-24 Thread Jonas Geiregat
for implementing such behavior using the built-in template language ? Regards, Jonas Geiregat jo...@geiregat.org -- 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...@googlegrou

ModelForm changing default field for ForeingKey

2011-01-21 Thread Jonas Geiregat
Hello, I'm creating a subset of a ModelForm. class FavArtistForm(ModelForm): class Meta: model = FavArtist fields = ('artist',) widgets = { 'artist': CharField(), } The field artist is of the type ForeignKey which is by default repres

'unique' field upon inserting

2011-01-25 Thread Jonas Geiregat
Hello, I have a model that has a field of the type BigIntegerField(). When inserting something into that field the value must not have been used before but upon inserting it's possible to insert the same value twice. Is there a way to do this using django ? I could generate a random number ch

Re: 'unique' field upon inserting

2011-01-25 Thread Jonas Geiregat
isit this group at > http://groups.google.com/group/django-users?hl=en. > Met vriendelijke groeten, Jonas Geiregat jo...@geiregat.org -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-u

Re: copying sqlite database file between projects

2011-01-25 Thread Jonas Geiregat
> 've copied the database file, and the models.py file to the > appropriate locations in the new project. Have you adjusted the settings.py database settings to the correct values ? If so, maybe try the full path to your database file. Regards, Jonas. -- You received this message beca

Re: Django form(s) for intermediary models

2011-01-25 Thread Jonas Geiregat
> In that form, I'd > like to see a checkbox for each Person (member) and a text field for > 'date_joined'. Anyway to do this? You can create forms from models. See this page for more information: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ You can always override the default

Re: Forbidden (403) CSRF verification failed. Request aborted.

2011-01-25 Thread Jonas Geiregat
Hey, I've also struggled with CSRF for a while. Maybe I can give you some guidance. > you need to ensure: > > •The view function uses RequestContext for the template, instead of > Context. > •In the template, there is a {% csrf_token %} template tag inside each > POST form that targets an intern

Re: Confusion about the new staticfiles contrib app

2011-01-25 Thread Jonas Geiregat
Op 26-jan-2011, om 06:46 heeft Brian Neal het volgende geschreven: > Hi - > I'm trying to cut over my project to use the new staticfiles > application. I'm using the dev server with DEBUG = True on a recent > SVN trunk checkout. My STATIC_URL is '/static/' and my MEDIA_URL is > 'http://localhost:

Re: looking cheap Python/Django/mySQL hosting

2011-01-26 Thread Jonas Geiregat
> for small project. > I use djangoeurope.com. They have server in Paris and Zurich. -- 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

Re: Confusion about the new staticfiles contrib app

2011-01-26 Thread Jonas Geiregat
>> > > I don't understand this. One is a URL, the other is a file path. Why > would I set STATIC_URL = MEDIA_ROOT? Or did you make a typo and mean > MEDIA_URL? That might make more sense to me. MEDIA_ROOT is the path to the directory where your files will live. MEDIA_URL is the URL the get t

Re: Adding an App to the Admin

2011-01-28 Thread Jonas Geiregat
Op 28-jan-2011, om 04:09 heeft Corey Richardson het volgende geschreven: > I'm following the tutorial at [1]. I'm trying to add the app to the > admin site. I've run manage.py syncdb, and I've restarted the dev > server. Any hints? The appropriate files that I was instructed to modify > can be se

Re: Adding an App to the Admin

2011-01-28 Thread Jonas Geiregat
>> >> Are you logged in as a user with permission to change models in that app? It >> won't appear if not. I once changed my admin.py file and after reloading nothing had changed. What did solve this issue was restarting the server or hard refreshing the page (Shift + F5 or something like that

Re: example do not work, TypeError

2011-01-30 Thread Jonas Geiregat
> ... print form.as_table() # ERROR 'WordFormFormSet' object is > not iterable Sounds like pretty obvious error to me. You can't iterate over the WordFormFormSet object. just write formsetw.as_table(). -- You received this message because you are subscribed to the Google Groups "

Re: Redirect with current data

2011-01-31 Thread Jonas Geiregat
s@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. Met vriendelijke groeten, Jonas Geiregat jo...@geiregat.org -- You receiv

Accessing the HttpRequest object from a model

2011-02-15 Thread Jonas Geiregat
I have a model from django.contrib.auth.models import User class Post(models.Model): with_some_properties = model.CharField(max_length=1) author = models.ForeignKey(User) def clean(self): if self.author is None: self.author =

Re: Accessing the HttpRequest object from a model

2011-02-15 Thread Jonas Geiregat
>> > > Two ways: > > 1) Pass the form which is creating/modifying this object the current > request. It can then use the request object in the save() method to > populate the field. Eg: > > class FooForm(forms.ModelForm): > def __init__(self, *args, **kwargs): >self.request = kwargs.pop('r

Using markdown within admin interface

2011-02-23 Thread Jonas Geiregat
Hello, I love markdown for writing content on websites. I use it almost all the time when I'm working with django. The only issue I hate is that the default django admin interface gives you a standard textfield. There's nothing wrong with that but when you're pasting some code on let's say a

django random template tag

2011-03-10 Thread Jonas Geiregat
Hello, I've ran into a situation where I might need a random generator in my templates. I'm aware that the default template tag set doesn't support any random generator. Previous attempts in adding one to the default set where ignored because off out of scope issues with the standard set. Anywa