django

read only permission in admin interface

Hi all, I saw this post, http://stackoverflow.com/posts/1348076/revisions , only at step 3 i'm getting confused, he tells to put 3. Add "get_view_permission" to default model class but what's the default model class? It doesn't seem to work to me, i get following error message: AttributeError at /admin/ 'Options' object has no attri...

django: displaying group users count in admin

I would like to change admin for a group, so it would display how many users are there in a certain group. I'd like to display this in the view showing all groups, the one before you enter admin for certain group. Is it possible? I am talking both about how to change admin for a group and how to add function to list_display. ...

Permission django admin interface

Hi all, I followed this tutorial: http://stackoverflow.com/posts/1348076/revisions Afterwards i made a user guest with permission 'Can view test' in the admin interface. When i did that it was only possible to see 'test' but not click on it and see it's actual data... so basicly i couldn't view the data from my model 'test' by only per...

Serving uploaded images securely in Django?

Hi there, My Django site lets users upload images. It's running on Apache. Files are uploaded via a FileUpload form. The folder to which files are uploaded is outside the Django project, and protected as described here, i.e. the folder has 755 permissions and files have 644 permissions. I now want to serve the images up to users - b...

Can this be done with the ORM? - Django

Hi folks, I have a few item listed in a database, ordered through Reddit's algorithm. This is it: def reddit_ranking(post): t = time.mktime(post.created_on.timetuple()) - 1134000000 x = post.score if x>0: y=1 elif x==0: y=-0 else: y=-1 if x<0: z=1 else: z=x return (log(z) + y * t/45000) I'm wonde...

Keeping track of user habits and activities? - Django

Hi folks, I was working on a project a few months ago, and had the need to implement an award system. Similar to S*tackOverflow's badge system*. Badges I might have not implemented it in the best possible way, and I am curious what your say in it would be. What would a good way to track user activities, needed for badge awarding be?...

Synchonizing data between django orm and pyodbc data source

Hello. I have a database (in Access 95 format... don't ask) that contains data i'd like to use in Django. I can already successfully connect, issue queries, etc using pyodbc. For the most part this is a one way sync operation - that is, the data won't be modified in Django, but will be modifed in the Access 95 db via legacy applications...

What's the best django way to do a query that spans several tables?

I have a reviews/ratings web application, a la Digg. My django app content has the following model: class Content(models.Model): title = models.CharField(max_length=128) url = models.URLField(max_length=2048) description = models.TextField(blank=True) class Recommendation(models.Model): user = models.ForeignKey(User) ...

webapp, tipfy or django on google app engine

which one are you using on google app engine? what were the reasons behind your decision? ...

XML file as model for django project

Hi, I have a XML file that is managed by other programs, I am writing a web service such that users are able to query this file. In essence i am using a xml based database instead of using sql as the model database in Django. how do i do this? all the tutorials that i find use a sql database in the backend. is there a way to use the xm...

Calling private parent class method from parent class (django)

I want to call a redefined private method from an abstract parent class. I am using django if that matters. class Parent(models.Model): def method1(self): #do somthing self.__method2() def method2(self): pass # I also tried calling up a prent method with super class child(Parent): def method1(sel...

After extending the User model in django, how do you create a ModelForm?

I extended the User model in django to include several other variables, such as location, and employer. Now I'm trying to create a form that has the following fields: First name (from User) Last name (from User) Location (from UserProfile, which extends User via a foreign key) Employer (also from UserProfile) I have created a modelfor...

Django Upload form to S3 img and form validation

I'm fairly new to both Django and Python. This is my first time using forms and upload files with django. I can get the uploads and saves to the database to work fine but it fails to valid email or check if the users selected a file to upload. I've spent a lot of time reading documentation trying to figure this out. Thanks! views.py de...

Django: run a Unix command from with Django?

Sorry if this is a duplicate - couldn't find an answer by searching. How can I run a Unix command from within a Django views file? I want to run a 'cp' command to copy a file that's just been uploaded. Thanks in advance. ...

need help figuring out dynamic menu generation in django

I need to dynamically generate a code like this in the resulting html: <p>>> gallery one</p> <p><a href="../gallery2">gallery two</a></p> <p><a href="../about">about the author</a></p> <p><a href="../news">our news</a></p> I do have menu_code string variable created in views.py (it is generated depending on an item number of the curre...

How do you set the initial value for a ManyToMany field in django?

I am using a ModelForm to create a form, and I have gotten the initial values set for every field in the form except for the one that is a ManyToMany field. I understand that I need to give it a list, but I can't get it to work. My code in my view right now is: userProfile = request.user.get_profile() employer = userPr...

How to chroot Django

Can one run Django in a chroot? Notably, what's necessary in order to set up (for example) /var/www as a chroot'd directory and then have Django run in that chroot'd directory? Thank you - I'm grateful for any input. ...

Treebeard admin in Django

I've setup Treebeard in Django and everything seems to have gone well. I tried to setup the admin system and I can see my models being presented in the admin interface. However, when I try to add new data using the admin interface, I get the following error in my template. The code still works fine, and I did a check in my DB and the da...

Examples of use for PickledObjectField (django-picklefield)?

Hi, surfing on the web, reading about django dev best practices points to use pickled model fields with extreme caution. But in a real life example, where would you use a PickledObjectField, to solve what specific problems? ...

Encoding gives "'ascii' codec can't encode character … ordinal not in range(128)"

I am working through the Django RSS reader project here. The RSS feed will read something like "OKLAHOMA CITY (AP) — James Harden let". The RSS feed's encoding reads encoding="UTF-8" so I believe I am passing utf-8 to markdown in the code snippet below. The em dash is where it chokes. I get the Django error of "'ascii' codec can'...