Making a field readonly according to the user in admin.py

2015-11-18 Thread Victor
Dear experts, models.py class Book(models.Model): title = models.CharField(max_length=100) author = models.CharField(max_length=100) quantity = models.IntegerField(db_column='quantitity',default=0) class Meta: db_table="book" admin.py class BookOption(admin.ModelAdmin):

Re: Making a field readonly according to the user in admin.py

2015-11-18 Thread Jani Tiainen
Hi, In general you shouldn't be even trying to do this in admin since it's not designed for this kind of functionality. Admin is just a datacentric tool to view your data. It's never been meant to help implementing any businesslogic. And basically you only should let people in admin that you

Requesting data from an API and rendering data on website

2015-11-18 Thread nAncy sharma
Hi, I am using Django Cms 3.1.3. I want to give a call (request ) to an API and display the result on my website. Could anyone help me with this ? I am new to django cms ! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from t

Re: Requesting data from an API and rendering data on website

2015-11-18 Thread Avraham Serour
Can you do it in plain python? On Wed, Nov 18, 2015, 12:34 PM nAncy sharma wrote: > Hi, > > > I am using Django Cms 3.1.3. I want to give a call (request ) to an API > and display the result on my website. > Could anyone help me with this ? I am new to django cms ! > > -- > You received this mes

Django model proxy override save

2015-11-18 Thread drifter
I want to override the save for a model when saved from the proxy I've tried commenting out as much as I can but it's still using the model save. Here's my code. class MovieProxy(Movie): class Meta: verbose_name = 'movie show' proxy=True def save(self, *args, **kwargs):

Re: Requesting data from an API and rendering data on website

2015-11-18 Thread nAncy sharma
Hi Avraham, Yes that should work. But since i am new to django cms , i don't know the files (ex: model.py ,view.py etc ) which all files need changes and where does the actual code of requesting to an API is to be written. On Wednesday, November 18, 2015 at 4:26:16 PM UTC+5:30, Avraham Serou

Re: Requesting data from an API and rendering data on website

2015-11-18 Thread Jani Tiainen
Then I suggest that you do official tutorial from Django documentation. It will give you a grasp what Django itself is and how it works. Django CMS is just built on top of Django so principles do apply there as well. On 18.11.2015 13:14, nAncy sharma wrote: Hi Avraham, Yes that should work.

Re: Making a field readonly according to the user in admin.py

2015-11-18 Thread Timothy W. Cook
While Jani's admonishments might be considered 'best practice' in some cases. Those do not always cover everyone's use case. I solved a similar issue allowing users with the superuser role to have edit access to some items that other staff do not have access to edit. Use the get_form method of th

Re: Timer for online examination

2015-11-18 Thread bobhaugen
That should have been runTimer and retryTimer On Tuesday, November 17, 2015 at 7:43:02 AM UTC-6, bobhaugen wrote: > > On Tuesday, November 17, 2015 at 12:29:02 AM UTC-6, Arindam sarkar wrote: >> >> I am developing an online examination website. And having difficulty >> implementing the timer . >>

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-18 Thread 'Tom Evans' via Django users
On Mon, Nov 16, 2015 at 5:38 PM, Axel Rau wrote: > > Any idea how to add __init__() to a form class, created by modelform_factory > () ? > > Axel > modelform_factory takes many arguments, one of which is for the base form class to use. You can provide a different base class from the default Mode

Re: Getting NoReverseMatch and can't find the mistake

2015-11-18 Thread 'Tom Evans' via Django users
On Tue, Nov 17, 2015 at 7:08 PM, Bob Aalsma wrote: > Sorry, can't seem to find what's wrong here, please help: what am I > missing??? > > I'm seeing > > NoReverseMatch at /zoekopdrachten/4/resultaat/ > > Reverse for 'resultaat' with arguments '('',)' and keyword arguments '{}' > not found. 1 patte

(secure-auth) very old mysql. old django, up-to-date workstation

2015-11-18 Thread 술욱
Hello, mysql server 3 django 1.6.11 workstation: ubuntu wily (15.10) mysql client 5.6.27 I need to make Django recognize secure-auth=false or skip-secure-auth=true but so far I couldn't I tried in project/settings.py 'OPTIONS': { 'skip-secure-auth': 'true', },

Re: Requesting data from an API and rendering data on website

2015-11-18 Thread Adam Simon
With all respect Jani, I do not think this is the right answer. Django-cms per se does not give top level access to the views, so integrating pure python is not as easy as it sounds. Adam On Wednesday, November 18, 2015 at 3:50:46 AM UTC-8, Jani Tiainen wrote: > > Then I suggest that you do

Form/widget Media urls not using the hashed names from ManifestStaticStorage?

2015-11-18 Thread Bart van der Schoor
I'm trying to upgrade an existing application to use a Manifest based StaticStorage so we can leverage long-term caching. It works as expected for files included with the `static from staticfiles` template tag: my app shows the hashed names for the standard admin javascript/css files and they a

Re: Form/widget Media urls not using the hashed names from ManifestStaticStorage?

2015-11-18 Thread Tim Graham
There's a ticket about it: https://code.djangoproject.com/ticket/21221 I think it's likely to be fixed in Django 1.10. In the meantime, you have to wrap the Media urls with django.contrib.staticfiles.templatetags.staticfiles.static. On Wednesday, November 18, 2015 at 12:51:28 PM UTC-5, Bart van

Re: Making a field readonly according to the user in admin.py

2015-11-18 Thread Mike Dewhirst
These three references should get you started. get_queryset[1] is useful for filtering the entire display based on the request user. readonly_fields[2] is a simple list of fields which are readonly for everyone. get_readonly_fields[3] is an Admin callable which can be overridden by your ow

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

2015-11-18 Thread Axel Rau
> Am 18.11.2015 um 15:28 schrieb 'Tom Evans' via Django users > : > > modelform_factory takes many arguments, one of which is for the base > form class to use. You can provide a different base class from the > default ModelForm, make sure to derive the new base class from > ModelForm. > Ah, tha

Problem with static folder

2015-11-18 Thread Dariusz Mysior
I had a static folder nr 1 in app accounts and my templates see it, but when I create folder static nr 2 in my project directory tempalates dosn't see it. I copy this static folder nr 2 and past to accounts folder next to this static folder nr 1 and it is visible. Why in project directory thi

QuerySet values() or values_list() with some RelatedObjectDoesNotExist records returns only those records with valid related intances

2015-11-18 Thread Steve W
Condition: A model with a ForeignKey or OneToOne relationship to another model, where the related model instance may be null. Desired Behavior: queryset.values() or values_list() returns all records from queryset, not just those with valid related model instance. Observed Behavior: queryset.va

Re: QuerySet values() or values_list() with some RelatedObjectDoesNotExist records returns only those records with valid related intances

2015-11-18 Thread Steve W
Solved or Work-Around: #Include a 'select_related()' invocation in the queryset chain, against the related model(s): cases = Case.objects.select_related('release').all() cases.count() 228 fieldnames = ('reference','release__release') records = cases.values(*fieldnames) records.count() 228 #OK,

Display Sub-Sub-Menu in Menu Bar

2015-11-18 Thread nAncy sharma
Hi, I have a designed a structure for my website as : |-Passenger |-About Us |-About1 |-About2 |-Contact Us But on my website i see the view as: |-Passenger |-About Us (dropdown sign) |-Contact Us So here the problem is i can not view or select About1 and About2 :