Re: Migrated code is not working in Django

2020-02-07 Thread DC
Hi ram,

What’s is not working ? Like static files?
Could you share what error you are facing?

Regards, d

On Sat, 8 Feb 2020 at 1:25 PM, Ram  wrote:

> Hi,
>
> When we have new code drop from development, we copy the files manually to
> the hosting server running in Digital Ocean droplet. Then we run these two
> commands
>
> 1. makemigrations
> 2. migrate
>
> in the python virtual environment.
>
> Both the commands completed find but, we are not able to use the new
> integration in our web site. We did not touch the database (postgres) side
> hoping that models.py would take care of migration on the database side.
>
> Please advise what would be missing from my side?
>
> Thanks,
> ~Ram
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F31iuhtCDO63rPyt6nOXMY798fQgqorrY%3DwJxEcL36dNg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACnTmkFeLgODmXog%2BJMbs_StRRt24Ux8JsLkx07qOpn_rt-JhA%40mail.gmail.com.


[import pyzbar.pyzbar as pyzbar] raises ImportError('Unable to find zbar shared library')

2019-07-12 Thread SUDHAN DC
Hello guys,

I am very new in the Django and python and I am trying to write a 
barcode-reader code.

my requirements.txt file is as follows

Django>=2.2,<3.0
psycopg2>=2.7,<3.0
Pillow>=6.1.0
pyzbar==0.1.8
numpy==1.16.4
django-sslserver==0.20

 but when I try to import the prybar it raises an error.
I have also installed zbar using 
  -brew install zbar

but this could not solve my error
please help me.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ab2a0eb4-de65-463c-ab5e-5ba269ccb93b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


redirect to change form page from admin action intermediate page

2015-11-04 Thread dc


I am trying to add admin action 'download_selected'. When the action is 
selected, it redirects to an intermediate page. When the user selects a 
file type and clicks on 'download', it downloads the file and stays on that 
page. How do I redirect it back to change form page it happens for 
'delete_selected'? Thanks.

Here is my code.

*admin.py*

class SelectDownloadFormatForm(forms.Form):

DOWNLOAD_TYPE_CHOICES=[('csv','csv'),

   ('json', 'json'),

   ('xml','xml')]

_selected_action = forms.CharField(widget=forms.MultipleHiddenInput)

download_type = forms.ChoiceField(label=_('Select a Download type'), 
choices=DOWNLOAD_TYPE_CHOICES, widget=forms.RadioSelect())


def download_selected(self, request, queryset):

import csv

from django.http import HttpResponse, HttpResponseRedirect

import StringIO

form = None

if 'download' in request.POST:

form = self.SelectDownloadFormatForm(request.POST)

if form.is_valid():

dtype = form.cleaned_data['download_type']

print dtype

response = HttpResponse(content_type='text/csv')

response['Content-Disposition'] = 'attachment; 
filename="export.csv"'

writer = csv.writer(response)

writer.writerow(['id', 'name', 'qid' ,'label', 'name', 'field'])

count = 0

for s in queryset:

questions_query = ParentModel.objects.filter(parent_form_id 
= s.id)

for q in questions_query:

writer.writerow([s.id, s.name, q.id, q.label, q.name, 
q.field])

count += 1

self.message_user(request, "Successfully downloaded %d survey 
responses in %s format" % (count, dtype))   

return response

if not form:

form = self.SelectDownloadFormatForm(initial={'_selected_action': 
request.POST.getlist(admin.ACTION_CHECKBOX_NAME)})

return render(request,'admin/download_type.html', {'items': queryset,

 'download_type_form': 
form,

})

download_selected.short_description = "Download selected forms"


*download_type.html*

{% extends "admin/base_site.html" %}

{% block content %}



  {% csrf_token %}  

  {{ download_type_form }}

  Following survey will be downloaded with corresponding responses:

  {{ items|unordered_list }}

  

  

 

{% endblock %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/16d9b710-e42b-4eed-b73a-9289767df9fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: return values from static files to django admin

2015-11-02 Thread dc
Thanks a lot. Let me look into it.

Is there any other way I can populate my choice list with user input?

On Monday, November 2, 2015 at 10:19:22 AM UTC-5, Andréas Kühne wrote:
>
> Hi,
>
> What you are suggesting doesn't work. You can't communicate with the 
> django backend via javascript if you don't use a lot of ajax requests. I 
> would check django-smart-selects and see if you could use that?
>
> Regards,
>
> Andréas
>
> 2015-11-02 15:57 GMT+01:00 dc <ana...@vt.edu >:
>
>> Any lead will be extremely helpful. I am still stuck. :(
>>
>> On Thursday, October 29, 2015 at 11:40:32 PM UTC-4, dc wrote:
>>>
>>> I have declared a charfield 'choice_text' in one of my models. I want to 
>>> convert it to a dropdown box in django admin. The choices in the dropdown 
>>> list depend on user input to a textbox defined in another model class. 
>>> I have a javascript (declared  as Media class inside a ModelAdmin class) 
>>> that reads user input in the textbox. But I am unable to this choice list 
>>> back from .js file to django admin. How do I do that? Thanks in advance.
>>>
>>> I have tried this.
>>>
>>> *models.py*
>>> class Routing(models.Model):
>>> choice_text = models.CharField(_('Choices'), max_length=100, 
>>> default="(any)", null=False)
>>>
>>> *admin.py*
>>> class AdminRoutingInlineForm(forms.ModelForm):
>>> def __init__(self, *args, **kwargs):
>>> super(AdminRoutingInlineForm, self).__init__(*args, **kwargs)
>>> CHOICES = [('a', 'any'),('b', 'blah'),] * // override this 
>>> with choices from populate_dropdown.js (code below)*
>>> self.fields['choice_text'].choices = CHOICES
>>>
>>> class RoutingInlineAdmin(StackedInline):
>>> form = AdminRoutingInlineForm
>>> fields = (('choice_text', 'next'),)
>>> model = Routing
>>>
>>>
>>> class FormModelAdmin(ModelAdmin):
>>> inlines = [RoutingInlineAdmin]
>>>
>>> class Media:
>>> js= ("sforms/admin/populate_dropdown.js",)
>>>
>>>
>>> *populate_dropdown.js*
>>> (function($) {
>>> $(document).ready(function() {
>>>
>>> $("[id^=id_fields-][id$=_options_0]").each(function(){ *  
>>> // user input from this field will be used as choices*
>>> choices = '(any),' + $(this).val().split("\n");
>>> alert(choices);
>>> 
>>> *// send this choices back to admin.py and override CHOICES 
>>> in AdminRoutingInlineForm class*
>>> });  
>>> });
>>>  
>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6ef56f22-dce0-4a85-b348-381b3a93e88f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/6ef56f22-dce0-4a85-b348-381b3a93e88f%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24ac486e-08fa-42cd-a426-bda97246693c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: return values from static files to django admin

2015-11-02 Thread dc
Any lead will be extremely helpful. I am still stuck. :(

On Thursday, October 29, 2015 at 11:40:32 PM UTC-4, dc wrote:
>
> I have declared a charfield 'choice_text' in one of my models. I want to 
> convert it to a dropdown box in django admin. The choices in the dropdown 
> list depend on user input to a textbox defined in another model class. I 
> have a javascript (declared  as Media class inside a ModelAdmin class) that 
> reads user input in the textbox. But I am unable to this choice list back 
> from .js file to django admin. How do I do that? Thanks in advance.
>
> I have tried this.
>
> *models.py*
> class Routing(models.Model):
> choice_text = models.CharField(_('Choices'), max_length=100, 
> default="(any)", null=False)
>
> *admin.py*
> class AdminRoutingInlineForm(forms.ModelForm):
> def __init__(self, *args, **kwargs):
> super(AdminRoutingInlineForm, self).__init__(*args, **kwargs)
> CHOICES = [('a', 'any'),('b', 'blah'),] * // override this 
> with choices from populate_dropdown.js (code below)*
> self.fields['choice_text'].choices = CHOICES
>
> class RoutingInlineAdmin(StackedInline):
> form = AdminRoutingInlineForm
> fields = (('choice_text', 'next'),)
> model = Routing
>
>
> class FormModelAdmin(ModelAdmin):
> inlines = [RoutingInlineAdmin]
>
> class Media:
> js= ("sforms/admin/populate_dropdown.js",)
>
>
> *populate_dropdown.js*
> (function($) {
> $(document).ready(function() {
>
> $("[id^=id_fields-][id$=_options_0]").each(function(){ *  // 
> user input from this field will be used as choices*
> choices = '(any),' + $(this).val().split("\n");
> alert(choices);
> 
> *// send this choices back to admin.py and override CHOICES 
> in AdminRoutingInlineForm class*
> });  
> });
>  
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ef56f22-dce0-4a85-b348-381b3a93e88f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: return values from static files to django admin

2015-10-30 Thread dc
bump!!

On Thursday, October 29, 2015 at 11:40:32 PM UTC-4, dc wrote:
>
> I have declared a charfield 'choice_text' in one of my models. I want to 
> convert it to a dropdown box in django admin. The choices in the dropdown 
> list depend on user input to a textbox defined in another model class. I 
> have a javascript (declared  as Media class inside a ModelAdmin class) that 
> reads user input in the textbox. But I am unable to this choice list back 
> from .js file to django admin. How do I do that? Thanks in advance.
>
> I have tried this.
>
> *models.py*
> class Routing(models.Model):
> choice_text = models.CharField(_('Choices'), max_length=100, 
> default="(any)", null=False)
>
> *admin.py*
> class AdminRoutingInlineForm(forms.ModelForm):
> def __init__(self, *args, **kwargs):
> super(AdminRoutingInlineForm, self).__init__(*args, **kwargs)
> CHOICES = [('a', 'any'),('b', 'blah'),] * // override this 
> with choices from populate_dropdown.js (code below)*
> self.fields['choice_text'].choices = CHOICES
>
> class RoutingInlineAdmin(StackedInline):
> form = AdminRoutingInlineForm
> fields = (('choice_text', 'next'),)
> model = Routing
>
>
> class FormModelAdmin(ModelAdmin):
> inlines = [RoutingInlineAdmin]
>
> class Media:
> js= ("sforms/admin/populate_dropdown.js",)
>
>
> *populate_dropdown.js*
> (function($) {
> $(document).ready(function() {
>
> $("[id^=id_fields-][id$=_options_0]").each(function(){ *  // 
> user input from this field will be used as choices*
> choices = '(any),' + $(this).val().split("\n");
> alert(choices);
> 
> *// send this choices back to admin.py and override CHOICES 
> in AdminRoutingInlineForm class*
> });  
> });
>  
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ea61e786-51c3-4d98-86fc-b49695cfcb03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


return values from static files to django admin

2015-10-29 Thread dc
I have declared a charfield 'choice_text' in one of my models. I want to 
convert it to a dropdown box in django admin. The choices in the dropdown 
list depend on user input to a textbox defined in another model class. I 
have a javascript (declared  as Media class inside a ModelAdmin class) that 
reads user input in the textbox. But I am unable to this choice list back 
from .js file to django admin. How do I do that? Thanks in advance.

I have tried this.

*models.py*
class Routing(models.Model):
choice_text = models.CharField(_('Choices'), max_length=100, 
default="(any)", null=False)

*admin.py*
class AdminRoutingInlineForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(AdminRoutingInlineForm, self).__init__(*args, **kwargs)
CHOICES = [('a', 'any'),('b', 'blah'),] * // override this with 
choices from populate_dropdown.js (code below)*
self.fields['choice_text'].choices = CHOICES

class RoutingInlineAdmin(StackedInline):
form = AdminRoutingInlineForm
fields = (('choice_text', 'next'),)
model = Routing


class FormModelAdmin(ModelAdmin):
inlines = [RoutingInlineAdmin]

class Media:
js= ("sforms/admin/populate_dropdown.js",)


*populate_dropdown.js*
(function($) {
$(document).ready(function() {
   
$("[id^=id_fields-][id$=_options_0]").each(function(){ *  // 
user input from this field will be used as choices*
choices = '(any),' + $(this).val().split("\n");
alert(choices);

*// send this choices back to admin.py and override CHOICES 
in AdminRoutingInlineForm class*
});  
});
 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc21af05-5d8a-4fd5-8f8c-8e303192576a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: design decision tree survey using django admin interface

2015-07-16 Thread dc
Thanks. I'll look into it.

On Wednesday, July 15, 2015 at 12:18:05 AM UTC-4, luisza14 wrote:
>
> I know it is not the answer of your question but for your survey design it 
> is important that you see this links.
>
> https://github.com/chrisglass/django_polymorphic
> https://github.com/django-mptt/django-mptt/
>
> I know that because I did a survey app years ago, but unfortunately it is 
> not free and it is in spanish too.
>
>
>
> 2015-07-14 17:32 GMT-06:00 anc :
>
>> I need to build a survey tool which provides an interface to the survey 
>> administrator to add/edit/delete questions. I understand we can do it 
>> through the admin interface. But can we modify the admin interface to 
>> provide branched/skip logic feature so that the administrator can design a 
>> survey where the next question to be displayed will depend on the answer of 
>> the previous question? I mean this branch logic feature will allow the 
>> survey administrator to create a decision tree survey.
>>
>>
>> Thanks,
>> Ananya
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c869-d9a2-4bf2-a370-efd77ad2e925%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47cdbf6c-69ed-4c62-b826-90fc60c7d403%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade to django 1.7- ImproperlyConfigured -Tastypie label duplicate? help

2015-05-30 Thread dc
Were you able to solve the problem @amarshall? I have the exact same error, 
do let me know please!

On Tuesday, March 31, 2015 at 8:04:23 PM UTC+5:30, Filipe Ximenes wrote:
>
> Thats strange.
> Are you using pip to install dependencies? Try uninstalling everything and 
> reinstalling again. 
> Make sure INSTALLED_APPS is not being defined somewhere else in the code. 
> Does the error persists if you set DEBUG = False locally?
>
> On Tue, Mar 31, 2015 at 10:21 AM, amarshall  > wrote:
>
>> Hi Filipe,
>>
>> I have few apps installed. When I comment out the tastypie line my app 
>> builds but gets an error in production because tastypie app isn't found. 
>> Here it is:
>>
>> INSTALLED_APPS = (
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> 'rest_framework',
>># 'south',   // commented out after upgrade to Django 1.7
>> 'tastypie',
>> 'lokal',#my app
>> )
>>
>>
>>
>> On Tuesday, March 31, 2015 at 5:52:55 AM UTC-4, Filipe Ximenes wrote:
>>>
>>> Can you show us your INSTALED_APPS?
>>> It may be the case you have a lot of apps installed and is not seeing a 
>>> duplicate reference to tastypie.
>>> On Mar 29, 2015 9:43 PM, "amarshall"  wrote:
>>>
 Hi,

  So I updated my django project from django 1.6 to 1.7.7 and when I run 
 "python manage.py migrate" I get this error stating that I have a 
 duplicate 
 label. 

 Here's the traceback

   Creating tables...
   Installing custom SQL...
   Installing indexes...
 Running migrations:
   Applying tastypie.0001_initial...Traceback (most recent call last):
   File "manage.py", line 11, in 
 execute_from_command_line(sys.argv)
   File "/usr/local/lib/python2.7/dist-packages/django/core/
 management/__init__.py", line 385, in execute_from_command_line
 utility.execute()
   File "/usr/local/lib/python2.7/dist-packages/django/core/
 management/__init__.py", line 377, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/usr/local/lib/python2.7/dist-packages/django/core/
 management/base.py", line 288, in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/usr/local/lib/python2.7/dist-packages/django/core/
 management/base.py", line 338, in execute
 output = self.handle(*args, **options)
   File "/usr/local/lib/python2.7/dist-packages/django/core/
 management/commands/migrate.py", line 161, in handle
 executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/usr/local/lib/python2.7/dist-packages/django/db/
 migrations/executor.py", line 68, in migrate
 self.apply_migration(migration, fake=fake)
   File "/usr/local/lib/python2.7/dist-packages/django/db/
 migrations/executor.py", line 96, in apply_migration
 if self.detect_soft_applied(migration):
   File "/usr/local/lib/python2.7/dist-packages/django/db/
 migrations/executor.py", line 140, in detect_soft_applied
 apps = project_state.render()
   File "/usr/local/lib/python2.7/dist-packages/django/db/
 migrations/state.py", line 57, in render
 self.apps = Apps([AppConfigStub(label) for label in 
 sorted(self.real_apps 
 + list(app_labels))])
   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py"
 , line 56, in __init__
 self.populate(installed_apps)
   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py"
 , line 89, in populate
 "duplicates: %s" % app_config.label)
 django.core.exceptions.ImproperlyConfigured: Application labels aren't 
 unique, duplicates: tastypie


 Not sure what to do here. I remove tastypie from the list of 
 INSTALLED_APPS in my settings and everything works fine. but I do need it. 
 Any suggestions ?

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/django-users/7e4cfbf8-d3e0-4e0e-a38c-b83930ffa3b6%
 40googlegroups.com 
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving 

Re: DateTimeField(auto_now_add=True) and admin page

2011-12-10 Thread DC
Hello Amit,

Yes, this is solution - I wanted those fields to be shown in admin, I
understand they're read-only. So, I put this in EcoPointAdmin and it
works:

readonly_fields = ['entry_date', 'last_change_date']

Thank you.

On Dec 10, 2:23 pm, Amit <pathakami...@gmail.com> wrote:
> Hi,
>
> You can display entry_date on admin by using readonly attribute of
> admin.
> Set readonly = (entry_date,) this will do your task, but You cannot
> modify this on admin.
>
> Thanks
> Amit
>
> On Dec 9, 7:46 pm, DC <davor.ceng...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I have the following lines in my model:
> >     entry_date = models.DateTimeField(auto_now_add=True)
> >     pub_date = models.DateTimeField('date published', blank=True,
> > null=True)
> >     last_change_date = models.DateTimeField(auto_now=True)
>
> > Basically, I want the entry date to be added automatically, and last
> > change date to be updated on every save(), just as described in
> > documentation. The problem is that those fields don't appear on the
> > admin page. I tried with explicitly setting those fields in my admin
> > class, per Tutorial:
>
> > class EcoPointAdmin(admin.ModelAdmin):
> >     fieldsets = [
> >         ('Details', {'fields': ['title', 'description', 'type',
> > 'status']}),
> >         ('Geo data', {'fields': ['latitude', 'longitude']}),
> >         ('Dates', {'fields': ['entry_date', 'pub_date',
> > 'last_change_date']}),
> >     ]
>
> > But now I get the error shown below.
>
> > Any chance to have those fields on admin page, without creating my
> > custom admin? I couldn't find anything useful in the archives.
>
> > Thanks,
> > DC, Django novice
>
> > The error msg:
>
> > ImproperlyConfigured at /admin/ecopoint/ecopoint/3/
>
> > 'EcoPointAdmin.fieldsets[2][1]['fields']' refers to field 'entry_date'
> > that is missing from the form.

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DateTimeField(auto_now_add=True) and admin page

2011-12-09 Thread DC
Hi,

I have the following lines in my model:
entry_date = models.DateTimeField(auto_now_add=True)
pub_date = models.DateTimeField('date published', blank=True,
null=True)
last_change_date = models.DateTimeField(auto_now=True)

Basically, I want the entry date to be added automatically, and last
change date to be updated on every save(), just as described in
documentation. The problem is that those fields don't appear on the
admin page. I tried with explicitly setting those fields in my admin
class, per Tutorial:

class EcoPointAdmin(admin.ModelAdmin):
fieldsets = [
('Details', {'fields': ['title', 'description', 'type',
'status']}),
('Geo data', {'fields': ['latitude', 'longitude']}),
('Dates', {'fields': ['entry_date', 'pub_date',
'last_change_date']}),
]

But now I get the error shown below.

Any chance to have those fields on admin page, without creating my
custom admin? I couldn't find anything useful in the archives.

Thanks,
DC, Django novice

The error msg:

ImproperlyConfigured at /admin/ecopoint/ecopoint/3/

'EcoPointAdmin.fieldsets[2][1]['fields']' refers to field 'entry_date'
that is missing from the form.

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.