Re: User permisions

2012-12-06 Thread carlos
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model On Thu, Dec 6, 2012 at 8:18 AM, Javier Guerra Giraldez wrote: > On Thu, Dec 6, 2012 at 8:44 AM, Mārtiņš Jakubovičs > wrote: > > I have app "items" and in admin page I create two users with permisi

Re: Django 1.6.0 over python 3: mysql?

2012-12-06 Thread Ian Clelland
On Fri, Nov 23, 2012 at 6:02 AM, ajendrex wrote: > Hello, > > I'm new to django and I'm going directly to use it over python 3 (I have > been using python 3 for mor than one year). However, the MySQLdb library > doesn't support python 3 yet. Is there a way of connecting django to mysql > over pyt

Re: HELP!!! Admin Site app name rename

2012-12-06 Thread Pedro J. Aramburu
I understand that but, there isn't a way to safely change the app_label attribute. As I understand, django manages the apps through INSTALLED_APPS and django admin strips the app name from the module "path" (please correct me). For example: Say I have the catalog app (package). Inside I have th

Re: How to introduce a text area as a field of a database entry

2012-12-06 Thread Pedro J. Aramburu
CharField is for "short" strings mostly under 255 of length. TextField is for "unlimited" text (the length depends of the database engine). If you just want a textarea for the CharField then you will need to replace the default widget. You'll need to read a little about Forms to change the widg

Re: how to include html in your text area

2012-12-06 Thread Pedro J. Aramburu
Joy, look into the database if it is being saved without escaping. If that's the case you need to render it without escaping marking it as safe with the safe filter. For example: This will not be escaped: {{ data|safe }} or you can use a template block like this: {% autoescape off %} Hello

ImageField in admin always required

2012-12-06 Thread Detectedstealth
Hi, I have a picture for my custom user declared as follows: class CustomUser(AbstractBaseUser): picture = models.ImageField(upload_to='profile_pictures', null=True, blank=True) In admin I use the image class CustomUserAdmin(UserAdmin): fieldsets( ('Profile details', {

Re: Optional GIS field in a model

2012-12-06 Thread Aapo Rista
On Thursday, December 6, 2012 11:32:35 PM UTC+2, Nikolas Stevenson-Molnar wrote: > The reason for your syncdb error is that the table creation doesn't > happen as part of the class definition (in other words, there's no error in > *creating* your Content class). Why not add an "ENABLE_GIS" set

Re: Multiple stackinline all sharing relation need assistance

2012-12-06 Thread Detectedstealth
Ok I got it to work with the following code. Just wondering if there is another way to do this as I really don't like adding to the request object to get it to work. class RecommendationInline(admin.StackedInline): model = Recommendation def formfield_for_foreignkey(self, db_field, req

Re: how to include html in your text area

2012-12-06 Thread Mario Gudelj
HTML is not really stripped. It's just encoded. If you want to render it on the frontend you can use https://docs.djangoproject.com/en/dev/ref/templates/builtins/#std:templatefilter-escapeor safe filter e.g. {{ your_var|safe }} Cheers, -mario www.zenbookings.com On 7 December 2012 05:10, Jonath

Re: Multiple stackinline all sharing relation need assistance

2012-12-06 Thread Detectedstealth
Hi Andrew, I think you are right the queryset is a must. However how do I find the selected user inside the queryset, I don't want the logged in user. For example if I go to edit user ID 2 in the queryset I need to know that id so I can change the filter to find experiences only with that ID.

Re: How to introduce a text area as a field of a database entry

2012-12-06 Thread Daniel Roseman
On Thursday, 6 December 2012 13:58:47 UTC, Javier Guerra wrote: > On Thu, Dec 6, 2012 at 6:18 AM, joy > > wrote: > > content = models.CharField(max_length=500) > > is that size even supported? > > models.CharField maps to a VARCHAR() field, which AFAIK, is typically > limited to 255 chars. >

Re: Optional GIS field in a model

2012-12-06 Thread Nikolas Stevenson-Molnar
The reason for your syncdb error is that the table creation doesn't happen as part of the class definition (in other words, there's no error in /creating/ your Content class). Why not add an "ENABLE_GIS" setting to your settings file? Then use your if/else: from django.conf import settings ... E

Re: django synchronize database over REST

2012-12-06 Thread Nuno Khan
yes, those are the requirements. anyways i have gone with writting my own message queue with a thread that sees if its full or not so send it away On Thu, Dec 6, 2012 at 7:51 PM, Josh Cartmell wrote: > Why not use the same database? i.e. is there any reason that they have > to have separate dat

Re: django synchronize database over REST

2012-12-06 Thread Josh Cartmell
Why not use the same database? i.e. is there any reason that they have to have separate databases? On Dec 6, 5:10 am, psychok7 wrote: > Thanks for the answer.. but what I. Could have synchronous replication? What > do you advise over a rest interface? -- You received this message because you a

Re: how to include html in your text area

2012-12-06 Thread Jonathan Baker
The html is saved to the database, but is stripped out when the variable is rendered to the template to help prevent XSS attack. You can read more about it (including how to selectively disable the feature) here: https://docs.djangoproject.com/en/dev/topics/templates/#automatic-html-escaping On Th

how to include html in your text area

2012-12-06 Thread joy
May i use html inside a text area? (i need some link in my text but the TextField of my object Text gives me back the html without formatting it) Is there any workaround? Joy -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discus

Optional GIS field in a model

2012-12-06 Thread Aapo Rista
I've a generic app for saving files, usually photos and videos, but also audio files, PDFs and some other binaries are supported. I've a model called Content, which stores the file and some metadata, including GeoDjango's PointField for GPS coordinates. I'm using PostgreSQL and PostGIS 1.5. I t

Re: User permisions

2012-12-06 Thread Javier Guerra Giraldez
On Thu, Dec 6, 2012 at 8:44 AM, Mārtiņš Jakubovičs wrote: > I have app "items" and in admin page I create two users with permisions to > create, edit and delete "items". But I want that only user who create item > can edit and delete id. How can I do that? search for "record-level permissions" -

Django-cms

2012-12-06 Thread jk121960
Hi, I am new to django-cms, I followed docs and it seems to be working fine (creating pages etc) but I went to do an app hook and that part along with redirect and soft root are missing from the advanced area. I have rebuilt environment a few times and it is still not there. Can anyone help me

Re: Portable way to prepend string to all rows in a table

2012-12-06 Thread Javier Guerra Giraldez
On Thu, Dec 6, 2012 at 7:25 AM, Larry Martell wrote: >> >> orm['travelbox.AccommodationImage'].objects.all().update(file='travelbox/accommodation/' >> + F('url')) >> >> However that doesn't work - it executes the following SQL: >> >> UPDATE `travelbox_accommodationimage` SET `file` = >>

Re: How to introduce a text area as a field of a database entry

2012-12-06 Thread Javier Guerra Giraldez
On Thu, Dec 6, 2012 at 6:18 AM, joy wrote: > content = models.CharField(max_length=500) is that size even supported? models.CharField maps to a VARCHAR() field, which AFAIK, is typically limited to 255 chars. better use a models.TextField(), it maps to a TEXT field, which is intended to longer

User permisions

2012-12-06 Thread Mārtiņš Jakubovičs
Hello! I can't find information about that, so I post my problem here. I have app "items" and in admin page I create two users with permisions to create, edit and delete "items". But I want that only user who create item can edit and delete id. How can I do that? Thanks. -- You received this

Re: django synchronize database over REST

2012-12-06 Thread psychok7
Thanks for the answer.. but what I. Could have synchronous replication? What do you advise over a rest interface? -- 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-u

Re: Portable way to prepend string to all rows in a table

2012-12-06 Thread Larry Martell
On Thu, Dec 6, 2012 at 6:18 AM, Francis Devereux wrote: > Hi, > > I currently have the following code in one of my migrations: > > cursor = connection.cursor() > cursor.execute('''UPDATE travelbox_accommodationimage SET file = > CONCAT('travelbox/accommodation/', url)''') > transactio

Portable way to prepend string to all rows in a table

2012-12-06 Thread Francis Devereux
Hi, I currently have the following code in one of my migrations: cursor = connection.cursor() cursor.execute('''UPDATE travelbox_accommodationimage SET file = CONCAT('travelbox/accommodation/', url)''') transaction.commit_unless_managed() This works for us (on MySQL, which we are us

Re: Set Permissions in User model from views

2012-12-06 Thread Nikhil Verma
Hi Tom Thanks for replying .I looked at this http://parand.com/say/index.php/2010/02/19/django-using-the-permission-system/ and got that point. def register_user(data): > """ > This method is used to register a new user and create a user profile. > """ > password = hashlib.sha1(da

Re: Set Permissions in User model from views

2012-12-06 Thread Tom Evans
On Thu, Dec 6, 2012 at 8:10 AM, Nikhil Verma wrote: > Hi All > > I am developing a simple app in which i have to play with user permissions.I > register a user(during a sign up process) with this method :- > > def register_user(data): > """ > This method is used to register a new user and

Re: How to introduce a text area as a field of a database entry

2012-12-06 Thread Nikhil Verma
Try this content = models.TextField(blank=True,null=True) On Thu, Dec 6, 2012 at 4:48 PM, joy wrote: > My model.py > > ##model.py > from django.db import models > > class Text(models.Model): >pag= models.CharField(max_length=10) >content = models.CharField(max_length=500

How to introduce a text area as a field of a database entry

2012-12-06 Thread joy
My model.py ##model.py from django.db import models class Text(models.Model): pag= models.CharField(max_length=10) content = models.CharField(max_length=500) ##should i put something different in the previous line to have a textarea in the admin view of this field?

Add chosen user Permission in User table from Avaliable user Permissions by writing code

2012-12-06 Thread Nikhil Verma
Hi All I am in User Table from django auth and in the admin i am in change_forms page . I can clearly see that there is ManyToMany relationship field called user_permission. In user_permission filed we have choosen user permssion in which we choosen permission gets saved. However i want to set it

Re: Multiple stackinline all sharing relation need assistance

2012-12-06 Thread Andrew Macgregor
Hi, I think you may need to add a queryset() method on your InlineModelAdmin and filter by user. https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-options You can use the example from ModelAdmin: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.ad

Set Permissions in User model from views

2012-12-06 Thread Nikhil Verma
Hi All I am developing a simple app in which i have to play with user permissions.I register a user(during a sign up process) with this method :- def register_user(data): """ This method is used to register a new user and create a user profile. """ password = hashlib.sha1(data['c