Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
NoReverseMatch at /product_view/1/ Reverse for 'cart_add' with arguments '('',)' not found. 1 pattern(s) tried: [u'cart/add/(?P<product_id>\\d+)/$']
I am creating an online shopping mall but when I try to load my product page I get the following error. I believe the error is pointing to my namespace but every way I try to correct it, I still get the error Internal Server Error: /product_view/1/ Traceback (most recent call last): File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/agozie/Desktop/shoppingmall/shop/views.py", line 18, in product_view 'cart_product_form': cart_product_form}) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/shortcuts.py", line 30, in render content = loader.render_to_string(template_name, context, request, using=using) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/loader.py", line 68, in render_to_string return template.render(context, request) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/backends/django.py", line 66, in render return self.template.render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 207, in render return self._render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 199, in _render return self.nodelist.render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 990, in render bit = node.render_annotated(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 957, in render_annotated return self.render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/loader_tags.py", line 177, in render return compiled_parent._render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 199, in _render return self.nodelist.render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 990, in render bit = node.render_annotated(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 957, in render_annotated return self.render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/loader_tags.py", line 72, in render result = block.nodelist.render(context) File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/template/base.py", line 990, in render … -
how to hide a form initially, but render the form when the screen is reloaded?
I have a form in my screen. I want to initially hide it. The user can enable it later on, enter the value, and submit the form. Submitting the form would update the screen. But this time I would like the form to stay visible. How do I do that? The below javascript would hide the form initially. $(document).ready(function(){ document.getElementById( 'form1' ).style.display = 'none'; }); The below script would submit the form. But is there anyway I could ensure the form stay visible afterwards? what I have right now 'document.getElementById( 'form1' ).style.display = 'yes'' does not work. function SubmitForm1(){ document.getElementById("form1").submit(); document.getElementById( 'form1' ).style.display = 'yes' } -
How can I use read/write from a postgres database in python ?
I am a newbie to everything here, I am trying to hack a small Heroku application (free tier) and I wanted to store some user key:value pairs of data. I had some hard time trying to make psycopg2 work, and the heroku python article uses the urlparse moudule which is not available in python-3. So, I would appreciate it if someone could help my to connect to the database, and give my a small snippet of code on how to read/write from/to database. -
Refresh Div elements withoud reload Page using Ajax and DJango
I read many posts in site about refresh elements without reload page, but i can't fix my problem. I have a view called 'operation' and i need refresh these page each 5 seconds. Then, i created a other view called 'refresh' to update my data. But it returns error 404 when i open the page. How can i fix the problem? 'POST /operation/refresh HTTP/1.1 404 2317' views.py def main(request): dp_col = DataDisplay.objects.all() #print(dp_col[0].name) reg = Registers.objects.latest('pk') context = { 'dp_col': dp_col, 'reg':reg } return render(request,'operation.html',context) def refresh(request): if request.is_ajax(): reg = Registers.objects.latest('pk') print(reg) #return render(request,'operation.html',{'reg':reg}) return HttpResponse({'reg':reg}) operation.js function refresh_function(){ $.ajax({ type: 'POST', url: 'refresh', success: function(data){ //atualizar os dados da página alert(data); } }) } $(document).ready(function(){ $('#sp_pumpspeed').slider({ formatter: function(value){ return 'Current value: ' + value; }}), setInterval(refresh_function,1000); }); -
ExtractYear and ExtractMonth returning None in Django
I am trying to do group my data on the basis of Year, Month and a Column Value. The Query is FeedbackData.objects.annotate(year=ExtractYear('created'), month=ExtractMonth('created')).values('year','month','start_operator_alias').annotate(dcount=Count('*')).values('year', 'month','start_operator_alias','dcount') The result that I am getting is: <QuerySet [{'year': None, 'start_operator_alias': 7, 'dcount': 12858, 'month': None}, {'year': None, 'start_operator_alias': 2, 'dcount': 185042, 'month': None}, {'year': None, 'start_operator_alias': 5, 'dcount': 13963, 'month': None}, {'year': None, 'start_operator_alias': 3, 'dcount': 127819, 'month': None}, {'year': None, 'start_operator_alias': 0, 'dcount': 566040, 'month': None}, {'year': None, 'start_operator_alias': 6, 'dcount': 83877, 'month': None}, {'year': None, 'start_operator_alias': 1, 'dcount': 170064, 'month': None}, {'year': None, 'start_operator_alias': -1, 'dcount': 36550, 'month': None}, {'year': None, 'start_operator_alias': 4, 'dcount': 25714, 'month': None}, {'year': None, 'start_operator_alias': 8, 'dcount': 200, 'month': None}]> As you can see the month and year are returned as None. What can be the reason for that or what am I doing wrong. model: class FeedbackData(models.Model): deviceId = models.CharField(blank=True, null=True, max_length=64, db_tablespace="indexes") start_cellId = models.CharField(null=True, blank=True, max_length=32) end_cellId = models.CharField(null=True, blank=True, max_length=32) start_mcc = models.CharField(null=True, blank=True, max_length=32) end_mcc = models.CharField(null=True, blank=True, max_length=32) start_mnc = models.CharField(null=True, blank=True, max_length=32) end_mnc = models.CharField(null=True, blank=True, max_length=32) start_lac = models.CharField(null=True, blank=True, max_length=32) end_lac = models.CharField(null=True, blank=True, max_length=32) start_operator_name = models.CharField(db_index=True, null=True, max_length=32, blank=True) start_operator_alias = models.IntegerField(db_index=True, null=True, default=-1) end_operator_name = models.CharField(db_index=True, … -
What's causing 502 bad gateway on a django gunicorn nginx stack?
Periodically some api calls on my django application would run into a 502, but it's quite a mystery as to what causes it, if I run the same api endpoint with a different filter it returns just fine. Here's how my nginx is set up: http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 443 ssl; server_name someserver.com; proxy_read_timeout 5m; location / { proxy_pass http://localhost:2501; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE_ADDR $remote_addr; add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; } ssl_certificate server.crt; ssl_certificate_key server.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; } } And I have my django application running through gunicorn and daemonized through supervisor. this is what my supervisor command looks like: gunicorn myapp.wsgi:application --bind 127.0.0.1:2501 --workers 25 How should I approach debugging this problem? Are there any common pitfalls that I should consider first? -
Generic Views attributes?
lately I've been learning GCBVs and they are definetly very handy. My big problem is, that I do have a book with all the attributes that I can set. But how can I figure out the attributes that have to be set or can be set without the book (they are spread among a lot of pages and do not cover all the attributes? There are concentions for template_names, context etc.? The source code is very cryptic because there is a lot of multiple inheritance etc. How do you guys keep track of the GCBVs? -
How Can I Access The Primary Key (from the database) In A Template?
In my project, I want to display a category page, that lists all of the products in a specific category. Each of the listings on the category page will link the visitor to that specific product. The product view is working properly. Products are accessed with the url: /prod/999 where 999 is the django created record number. For the category page, I have the data and I'm working on my template. I can access the product name, description etc.. in the template but in creating the link to the product detail page, I need that product record. Unfortunately, it doesn't seem to be passed to the template. How do I pass the record number "pk" to my template? Here's my view code: from get_data.models import ShareASale_Data, CategorySummed class CategoryView(generic.ListView): model = ShareASale_Data template_name = 'summary_page/category.html' context_object_name="the_records" paginate_by = 10 def get_queryset(self, **kwargs): # First Get the Actual Category from the Category db. cat_summed = CategorySummed.objects.get(category_url = self.kwargs['s_cat']) # Use the category from the previous line to fetch the product records return ShareASale_Data.objects.filter(merch_category = cat_summed.category ) -
Creating a new parent django class
I am new to django and I have an issue but not sure how to go about it. I already have a working model class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField("date published") However, I realized a Question should belong to a Poll class so I created this class Polls(models.Model): poll_name = models.CharField(max_length=200) poll_date = models.DateTimeField("date published") poll_country = models.CharField(max_length=200) Now I need to add a new Foreign key to Questions poll = models.ForeignKey(Polls, on_delete=models.CASCADE) Now when I update and makemigrations, I have errors. It appears I need to write some custom migrations to achieve this. Could someone please give me some idea on how to proceed. A sample code would be appreciated. Thanks. -
I'm not able to print number of columns in console from xlsx file (Django)
I'm trying to read number of column from xlsx file in order to send emails to the email_ids present in that column, but i'm not able to solve the error " QuerySet attribute not found 'document' " Kindly Help. **Here is my view** from django.contrib.auth import update_session_auth_hash from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import PasswordChangeForm from django.shortcuts import render, redirect from assignment.forms import ( RegistrationForm, EditProfileForm ) from .models import Assignment, Assestment, Document from .forms import DocumentForm import time from xlrd import open_workbook @login_required def email(request): d = Document.objects.all() book = open_workbook('..Shnehil/media/documents/'+str(d.document)) sheet = book.sheet_by_index(0) num_row = sheet.nrows - 1 num_cell = sheet.ncols - 1 time_folder = time.strftime("%Y-%m-%d") print(sheet.nrows) return redirect('/assignment') **This is my models.py** from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.core.urlresolvers import reverse import datetime class Document(models.Model): document = models.FileField(upload_to='documents/') **My html** <form method="post" enctype="multipart/form-data" action="/assignment/email/"> {% csrf_token %} <button type="submit" class="btn btn-success">Email</button> </form> -
ImportError: When Trying to Import Custom FIle
I'm using django-rest-framework-jwt to generate a token for security, but I need to get the user information with the token when someone logs in. The only way I have seen to do this is to create a custom function that will override the default functionality. I'm very new to Django so I'm still trying to figure out how things work, this is what I have tried after reading THIS article. I have tried MANY ways to get this working, but this seems like the best approach. Problem I have when I use the current setup I get: ImportError: Could not import 'custom_jwt.jwt_response_payload_handler' for API setting 'JWT_PAYLOAD_HANDLER'. ImportError: No module named custom_jwt. 1 - after creating the custom_jwt.py what is best practices on where to put it? If there is none, any suggestions on where? 2- how would I gain access to the functions in custom_jwt.py in the settings.py? settings.py JWT_AUTH = { 'JWT_PAYLOAD_HANDLER': 'custom_jwt.jwt_response_payload_handler', 'JWT_RESPONSE_PAYLOAD_HANDLER': 'custom_jwt.jwt_payload_handler', } custom_jwt.py from datetime import datetime from calendar import timegm from rest_framework_jwt.settings import api_settings def jwt_payload_handler(user): """ Custom payload handler Token encrypts the dictionary returned by this function, and can be decoded by rest_framework_jwt.utils.jwt_decode_handler """ return { 'user_id': user.pk, 'email': user.email, 'is_superuser': user.is_superuser, 'exp': … -
ImportError raised when trying to load 'material.admin.templatetags.material_admin': cannot import name Layout
Traceback (most recent call last): File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__ return self.application(environ, start_response) File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__ response = self.get_response(request) File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response response = self._middleware_chain(request) File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = response_for_exception(request, exc) ... File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/template/backends/django.py", line 30, in __init__ options['libraries'] = self.get_templatetag_libraries(libraries) File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/template/backends/django.py", line 48, in get_templatetag_libraries libraries = get_installed_libraries() File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/template/backends/django.py", line 113, in get_installed_libraries for name in get_package_libraries(pkg): File "/home/jeremie/.virtualenvs/venv/lib/python2.7/site-packages/django/template/backends/django.py", line 130, in get_package_libraries "trying to load '%s': %s" % (entry[1], e) InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'material.admin.templatetags.material_admin': cannot import name Layout When I run the command python manage.py runserver_plus, I got this error, but I can't see how to fix it. How could I modify this question so that it works? -
Extending User Model Django, IntegrityError
I am trying to extend the User model to create a Profile model. The following code successfully displays a form with the additional fields I specified as location and bio. But when I submit the form only the original username, first_name, last_name, email, and password fields are stored in the database at http://127.0.0.1:8000/admin, none of my custom fields are stored in the Profile section I added to admin . I also get the following error: IntegrityError at /accounts/register/ NOT NULL constraint failed: accounts_profile.user_id Request Method: POST Request URL: http://127.0.0.1:8000/accounts/register/ Django Version: 1.11.2 Exception Type: IntegrityError Exception Value: NOT NULL constraint failed: accounts_profile.user_id Exception Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py in execute, line 328 Python Executable: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 models.py: from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.TextField(max_length=500, blank=True) location = models.CharField(max_length=30, blank=True) birth_date = models.DateField(null=True, blank=True) @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() forms.py: from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from .models import Profile class RegistrationForm(UserCreationForm): email = forms.EmailField(required = True) class Meta: model = User #model User comes with username, email, first … -
Wagtail CMS APIv2 Pagination not Showing Numbers or Next & Previous
I can't seem to get pagination to work with my Wagtail CMS projects API. It only shows a random list of 20 on the page, image or documents. My code is listed below from my settings file. The Wagtail Documents mention just adding rest_framework to the settings file to allow browsing but I can't seem to figure out how to browse all and not just 20 results. Thank you. REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE': 100, 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer', ), 'DEFAULT_PARSER_CLASSES': ( 'rest_framework.parsers.JSONParser', ), } -
Inserting a value (evaluated in views.py) to database in views.py
Here is the models.py file: class SoundFile(models.Model): date_created = models.DateTimeField(auto_now_add=True) # Date of creation name = models.CharField(max_length=50, default='Sound File') # Name of the file during upload nameOnly = models.CharField(max_length=200, default='FILENAME') # Song Identifier without file extension identifier = models.CharField(max_length=50, default='XXXXXXX') # Song Identifier without file extension fileSize = models.IntegerField(default=0) # File size in bytes uploaded_file_url = models.CharField(max_length=200, default='URL') # file url duration = models.IntegerField(default=0) no_of_frames = models.IntegerField(default=0) score = models.FloatField(default=0.0) I need to alter 'score' in views.py as it is evaluated by a function in views.py only. views.py: from .models import SoundFile def rnp(request, nameOnly, no_of_frames): # ... # nameOnly is unique to every row in the database file = SoundFile.objects.get(nameOnly=nameOnly) score = compare.evaluate(freq, freq_u) # This doesn't work file.score = score # ... -
Getting non-unique values from a django query
I'm writing a script where I want to get every occurrence of a value, from visited sites. First I get sites visited: sd = SessionData.objects.filter(session_id__mlsession__platform__exact=int('2')) result = sd.values('last_page') I then get the values that I'm expecting: [{'last_page': 10L}, {'last_page': 4L}, {'last_page': 10L}] With that, I want the page with 10L as an id to have double the weight of 4L, since it's appearing two times. I try to get the values from the list: wordData = KeywordData.objects.filter(page_id__in=result) but then I only get unique values: [<KeywordData: 23>, <KeywordData: 24>, <KeywordData: 8>] where my wanted outcome would be: [<KeywordData: 23>, <KeywordData: 24>, <KeywordData: 8>, <KeywordData: 23>, <KeywordData: 24>] The only way I've managed to not get a unique list is by iterating through a for-loop but that isn't really an option since the data I'm dealing with has millions of entries. Is the "__in" filter in django made to only return unique entries? Is there a way that I can get the right output the "django"-way? Thank you in advance for your help! -
Pre-populating Model Form with object data - Django
I have tried various options for this but no luck so far. I am trying to get instance data to be pre-populated into my ModelField. Here is what I have: forms.py class edit_project_info(ModelForm): project_name = forms.CharField(max_length=150) class Meta: model = Project exclude = ['project_type', 'created_date', 'start_date', 'end_date', 'pm_scope', 'dev_scope', 'design_scope', 'testing_scope' ] View.py def edit_project (request, offset): this_project = Project.objects.get(pk=offset) data = {'project_name' : 'abc'} if request.method == 'POST': form = edit_project_info(request.POST, instance=this_project, initial=data) if form.is_valid(): form.save() return HttpResponseRedirect('/project_profile/%s/' % offset) else: form = edit_project_info() All I get is an empty field. I can add the initial value to forms.py, but then it is static rather than populated based on the form instance. What I have done here with creating a dict and then passing it to initial in the form instance does not seem to do anything. I'm sure I am missing something basic. Any help would be great! Thanks ahead of time. -
How can I setup a django site in a vps
I am trying to setup a django site in a VPS, hosted in hostgator. I have done it on a apache server once in a different system. But the httpd.conf file did not have nameserver and multiple enteries for WHM and Cpanel on that system. I followed the documentation and was successful for it. But for the VPS I am a bit confused. The tech guys in hostgator are not helping. Help is appreciated. Thanks in advance. -
How to post on multiple pages using django
For a project, we are trying to build a basic forum-like website; however, we are trying to post on multiple pages instead of one and cannot add another extend on the part that allows the post to be added to that page: {% extends 'blog/base.html' %} {% block content %} <div class="post"> {% if post.published_date %} <div class="date"> {{ post.published_date }} </div> {% endif %} {% if user.is_authenticated %} <a class="btn btn-default" href="{% url 'post_edit' pk=post.pk %}"><span class="glyphicon glyphicon-pencil"></span></a> {% endif %} <h1>{{ post.title }}</h1> <p>{{ post.text|linebreaksbr }}</p> </div> {% endblock %} Is there any way to make the website display these posts on multiple pages using another method? -
Displaying specific posts using django
I have a post application in django where different staff members can create post. I now want to be able display each posters post when they log in and not include others post. model class Post(models.Model): """docstring for Post.""" user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1) #blank=True, null=True)#default=1 title = models.CharField(max_length = 120) slug = models.SlugField(unique= True) draft = models.BooleanField(default = False) publish = models.DateField(auto_now=False, auto_now_add=False) content = models.TextField() updated = models.DateTimeField(auto_now=True, auto_now_add=False) timestamp = models.DateTimeField(auto_now=False, auto_now_add=True) #objects = PostManager() def __str__(self): return self.title View def index(request): results = Post.objects.all().filter(draft=False)#.filter(publish__lte=timezone.now()) que = request.GET.get("q") if que: results =results.filter( Q(title__icontains=que)| Q(content__icontains=que)).distinct() paginator = Paginator(results, 8) # Show 25 contacts per page pages ="page" page = request.GET.get('page') try: query = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. query = paginator.page(1) except EmptyPage: # If page is out of range (e.g. 9999), deliver last page of results. query = paginator.page(paginator.num_pages) context = { "objects": query, "pages": pages } template = 'index.html' return render(request,template,context) and additional code would be uploaded on request. Thanks -
Django DetailView get_context_data
I'm new in Django. There is a html page (project_details) which should show the title and the tasks of the project, but shows only the title of the project, not the tasks. The tasks exists, the problem is the filter!!! views.py The error is here from .models import Project,Task from django.views.generic import ListView, DetailView class ProjectsList(ListView): template_name = 'projects_list.html' queryset= Project.objects.all() class ProjectDetail(DetailView): model = Project template_name = 'projects_details.html' def get_context_data(self, **kwargs): context = super(ProjectDetail, self).get_context_data(**kwargs) ## the context is a list of the tasks of the Project## ##THIS IS THE ERROR## context['tasks'] = Task.object.filter(list=Project) <---->HERE ((work with Task.object.all() )) return context models.py class Project(models.Model): title = models.CharField(max_length=30) slug = AutoSlugField(populate_from='title', editable=False, always_update=True) class Task(models.Model): title = models.CharField(max_length=250) list = models.ForeignKey(Project) slug = AutoSlugField(populate_from='title', editable=False, always_update=True) urls.py from django.conf.urls import url from .models import Project from .views import ProjectsList, ProjectDetail urlpatterns = [ url(r'^$', ProjectsList.as_view(), name='project_list'), url(r'(?P<slug>[\w-]+)/$',ProjectDetail.as_view() , name='project_details'),] projects_details.html {% extends './base.html' %} {% block content %} <div> <a href={{ object.get_absolute_url }}> <h4> {{object.title}} </h4> </a> <ul> {% for task in tasks %} <----> NO OUTPUT <li> <li> {{task}}</li> {% endfor %} </ul> </div> {% endblock content %} Sorry for my bad English. -
How to use a javascript to validate a form?
I was trying to build a Django form. And the javascript logic I am trying to implement is that if the input form value is not empty, then submit the form. However, I am not sure exactly how to get the id of {{form.value}}. <form id = "form1" action="." method="POST">{% csrf_token %} <div class=".col1" style="float:left;vertical-align: middle;"> {{ form.region }} {{ form.operator }} </div> <div class="col-xs-2 style="vertical-align: middle;"> {{ form.value }} </div> </form> function SubmitForm1(){ if(document.getElementById( {{Form.Value}} ).value != ""){ document.getElementById("form1").submit(); } } -
ImportError: No module named openerp
While running odoo at the first time it shows ImportError: No module named openerp C:\Python27\python.exe E:/workspaces/odoo-10.0-20170812/odoo.py -c E:\workspaces\odoo-10.0-20170812\odoo.conf Traceback (most recent call last): File "E:/workspaces/odoo-10.0-20170812/odoo.py", line 160, in main() File "E:/workspaces/odoo-10.0-20170812/odoo.py", line 156, in main import openerp ImportError: No module named openerp Process finished with exit code 1 -
Django CMS Auto-Publishing Draft
I have a Django CMS based site and thought the Publishing Dates in the menu would help answer this question, but unfortunately I am hitting snags. It appears the publishing dates choice is just to make a page ON or OFF. I have an existing published page that needs to be queued up during the week and then have the changes served up at midnight on a weekend. The page needs to show the current content until the update happens and then auto publish on the weekend with new content. Is this possible with Django-CMS? Does anyone know of any add-ons that may help with this issue? Thank you very much for your responses! -
Firefox Redirects Django Site to Default Search Engine Other Browsers Work Well
I am currently observing an interesting and what seems like a strange behavior from a Django site I am building. After migrating it to production, I noticed that in Firefox, whenever I request my-site.store, I am redirected to a search engine page. In Chrome and Safari, the site works as expected. Here is a copy of the link to which the Firefox takes the site: https://search.yahoo.com/yhs/errorhandler?hspart=gt&hsimp=yhse-gt&q=http%3A%2F%2Fmy-site.store%2Fstatic%2Foscar%2Fimg%2Fimage_not_found&type=692858 As you can see, I am using TLD .store. Not sure if that matters, but it should be pointed out. I am also using an e-commerce system for Django called Oscar. The DNS is set up using AWS's Route 53 service. I am using this service and configuration for 5-6 other sites, and have never had a problem like this with them. Any idea of how to fix or troubleshoot this is appreciated.