184 questions
0
votes
0
answers
19
views
Creating a VIEW with PostgreSQL in PgAdmin
Having to query several steps to get a "totals" result, I used a cte and I have also used a subquery with OVER (PARTITION BY) command.
Which query, the cte or the subquery with OVER (...
0
votes
1
answer
63
views
I need to create a view for statement containing create table and drop tables
I need to create a view but an error occurs since statement after create view is IF statement.
Create View Test_Data AS
Checking if the Table exists to be dropped first
IF OBJECT_ID('Test_T', 'U') IS ...
0
votes
1
answer
60
views
Issues with creating and editing records in LoanTransaction model in ASP.NET Core
I’m working on an ASP.NET Core project with Entity Framework Core, and I'm facing issues with creating and editing records in the LoanTransaction model. Here's what I've done so far and the issues I’m ...
0
votes
2
answers
203
views
Not able to set the variable as column alias in create view in snowflake stored procedure
I am trying to create a view in snowflake stored procedure. I need one of the column from the variable. I tried following but getting following error,
Error
SQL compilation error:
syntax error line 4 ...
0
votes
1
answer
50
views
Error Assigning Foreign Key in Django CreateView, can't get an instance
Issue: Cannot Assign "38" to "Pusinex2.seccion" - Must Be a "Seccion" Instance
Models:
The models Seccion and Pusinex2 are related in a ForeignKey manner.
Seccion holds ...
-2
votes
1
answer
37
views
Creating new view with match value from another table SQL
I have 2 tables like in the picture. In the first table I have column ID, in the second table I also have ID column and email column. In the end, I want a table 1 with specific email from table 2 ...
2
votes
0
answers
51
views
Django formset: unicity constraint pass form_valid()
I try to use formset and CBV CreateView for a treatment model but validation failed. I am quite lost with validation logic in my view.
I have added a try/catch in form_valid method to manage unicity ...
0
votes
1
answer
188
views
SQL Incorrect syntax: CREATE VIEW must be the only statement in the batch
I'm struggling with a problem in SQL - I keep getting this error:
Incorrect syntax: CREATE VIEW must be the only statement in the batch
I'm using newest Microsoft SQL Server Management Studio.
...
0
votes
2
answers
80
views
request.user in createdview
How implement that the user in the Model Entities add automatically the user that is authenticated in django?
now, returning the following error:
error
I have tried differents methods that i have ...
0
votes
1
answer
57
views
Django: Object is not saved to DB when submitting form with CreateView
I have a CreateView to create artists but when submitting the form, nothing happens.
models.py
class Artist(models.Model):
name = models.CharField(max_length=222, unique=True)
slug = models....
-1
votes
1
answer
320
views
ORA-00998: "must name this expression with a column alias"
I need help with that error
this is my code
CREATE OR REPLACE VIEW emplpersuc
AS SELECT SUCURSAL.NOMBRE, COUNT(SUCURSAL.NOMBRE) FROM VENTA
JOIN SUCURSAL ON SUCURSAL_CODIGO_SUCURSAL=CODIGO_SUCURSAL
...
0
votes
1
answer
35
views
Django - problem with saving data in Createview with ModelForm to non-default database
I've got problem with saving data to non-default database.
In models.py I've got:
grid_fs_storage = GridFSStorage(collection='tab_userinquiries', base_url='mydomain.com/userinquiries/',database='...
-1
votes
1
answer
284
views
How to remove duplicate user_id from a query result?
The problem is I am trying to use Create View for a query but I keep getting an error which means
That I have a duplicate row
My two table structure and relation
My query
SELECT * FROM user_profile ...
2
votes
1
answer
3k
views
Give permissions to Create/Drop views only
I'm working with
Microsoft SQL Server 2019 (RTM-GDR) - 15.0.2095.3 (X64) Apr 29 2022 18:00:13
Copyright (C) 2019 Microsoft Corporation
Standard Edition (64-bit) on Windows Server 2016 Datacenter ...
0
votes
1
answer
53
views
how can i make a view using the foreign key that is applies in mysql?
I am still a beginner and i searched in google ,read w3schools and couldn't get how to do it the following thing.
i want to create view from the info in cases field
AS you saw these are the info ...
2
votes
1
answer
226
views
CreateView doesn't save object , throws 'this field is required ' error
models.py is :
class Todo(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE,null=True,blank=True)
title = models.CharField(max_length=200)
desc = models.TextField(null=...
1
vote
0
answers
172
views
SqlAlchemy query create view
This is my sql query for create view in Postgresql. But I need to query it from SqlAlchemy
CREATE OR REPLACE VIEW public.my_view
AS
SELECT m.id AS mt_dump_model_csv_id,
m.geom,
...
1
vote
1
answer
835
views
Django CreateView object.id in get_succes_url pk(id) is NONE and then after redirecting to another URL it prints out created entry ID
I have a problem that I just can't figure out.
After creating a work order I want to redirect to the detail page of that work order.
Here is my models.py
class Radni_nalozi(models.Model):
Klijent =...
1
vote
0
answers
992
views
Create View with Collation
I need to create a view from another database (linked as connectionserver) but here I need a different collation.
Example:
CREATE VIEW vw_table1
AS
SELECT *
FROM server2.table1;
How can I specify the ...
0
votes
1
answer
71
views
Save django CreateView in Python Shell
I'm trying to write a test for my CreateView view in django. As part fo the test, I want to create a new object through a CreateView class, though I'm unsure how to save the object through tests.py.
...
1
vote
3
answers
1k
views
I cannot find my CREATE VIEW table after refreshing even after "Commands completed successfully." message. (SQL)
--Creating View to store data for later visualizations
CREATE VIEW PeopleVaccinatedpercent AS
SELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations
,SUM(cast(...
1
vote
1
answer
164
views
NOT NULL constraint failed: spring_post.publisher_id
I created a class base create view.When i try to submite the post model create view. it will return
NOT NULL constraint failed: spring_post.publisher_id
how can i set the publisher the get the current ...
0
votes
1
answer
1k
views
Django CreateView doesn't save object and doesn't give error
I'm working on a new project and I'm having difficulties adding new objects from the users page. It can be added from admin dashboard.
This is the model:
class Product(models.Model):
title = ...
0
votes
1
answer
785
views
Fill The ForeignKey Field in Django CreateView Automatically
Here is my scenario. I want one of my model fields to be auto-fill based on whether the user is authenticated or not. Like when the user submits the form, I need to check if the user is authenticated ...
1
vote
1
answer
3k
views
Multiple forms with one single create view in Django
I have 5 forms: MyForm, EducationForm, ExperienceForm, RecommendationForm, OtherDocumentsForm
I want to disply them in one form template. I can not do it with CreateView because it only accepts one ...
1
vote
3
answers
911
views
How I create a view with the record count of different tables
I need to create a view with the record count from 3 different tables but with the same columns.
That is, these queries
SELECT COUNT (*) AS count_a from table1 ta
SELECT COUNT (*) AS count_b from ...
0
votes
1
answer
353
views
Django CreateView form can't submit
My views:
class AddSuiteView(CreateView):
model = TestSuite
form_class = TestSuiteForm
def get_context_data(self, **kwargs):
context = super().get_context_data(**...
1
vote
1
answer
377
views
CreateView redirect with parameter created from the same view
I have this CreateView that creates an object for me and after creating it I would like it to render me inside that object through its 'nome_scheda' which is a text field.
views.py
class ...
1
vote
1
answer
739
views
NOT NULL constraint failed error when attempting to save using createview
This is my first post to SO, so please let me know if I've missed any important details. I am working on updates to a home-grown dJango based ticketing system.
I have two "parent" models (...
0
votes
2
answers
376
views
How can I fix SSDT marking random columns in my CREATE VIEW statement "ambiguous"?
I'm moving a bunch of SQL Server databases into SSDT projects so I can have source control. There is a view with a very large number of columns that prevent me from building one of the projects.
...
-1
votes
1
answer
320
views
What Am I Doing Wrong With This 'Create A View' in My SQL Database
I am trying to create a view with multiple tables with multiple select statements. The error message I receive is "Incorrect syntax: 'CREATE VIEW' must be only statement in batch."
...
1
vote
1
answer
1k
views
Odoo14: Cannot read property 'modelExtension' of undefined
I want to create a new view_type in Odoo 14. I followed these instructions: https://www.odoo.com/documentation/14.0/fr/developer/reference/javascript/javascript_cheatsheet.html#creating-a-new-view-...
0
votes
1
answer
42
views
CreateView switch model
i have a problem with my CreateView.
I wish I could have two different models that change based on the url it finds.
I also have problems with success_url, I don't know how to pass it a parameter.
url....
3
votes
1
answer
158
views
Need to create a view from a SQL Server Graph Table that does not include the hidden graph_id column
The table was created as a NODE, therefore SQL Server adds a graph_id_xxxxxx column between others. I create a view with the following sentence:
CREATE VIEW FILE_VIEW1 AS
SELECT
[NAME]
FROM [dbo]...
-1
votes
1
answer
3k
views
How to change column name in VIEW table?
How to change column name in SQL?
I have tried the following but giving a syntax error.
create view cView as select * from College;
alter table cView
rename cName to collegeName,
rename enrollment to ...
0
votes
2
answers
279
views
How "CREATE VIEW" works?
I'm a newbie in here. I had a problem that need your help.
Here is my context: I have 1 table that contains 100 mil data rows. I need to build reports from this table. I use Power BI, using direct ...
2
votes
1
answer
5k
views
MS SQL Server - How to create a view using hierarchical query
I would like to create hierarchical query using with and removing 4 join, someone can help please i am beginner in SQL views.
CREATE VIEW CAR( ID, CARLEVEL) AS
select
t.C_ID,
coalesce(d.C_ID, ...
0
votes
0
answers
55
views
Create View Table
I am trying to create view table using UNION ALL. But I got one error. Below is my SQL code:
CREATE VIEW dbo.v_DemographicInfo
AS
(
SELECT 'HSA' AS HospitalName, HSA.*,P.*,S.*,E.*,
CASE WHEN DATEDIFF(...
-1
votes
1
answer
89
views
I am getting error code 105 using create view
[![I am getting error code: 1050 (as you can see at from the output in the image) Table already exists, when it doesnt. Can anyone help me with this?
The question reads: Create a view called ‘...
1
vote
1
answer
1k
views
Django IntegrityError at /create_post/
When trying to create a create class-based view I get the IntegrityError listed above the full error is
IntegrityError at /create_post/
null value in column "author_id" of relation "...
-2
votes
1
answer
59
views
why INNER JOIN errors out at the plus sign?
This is very similar but NOT exactly the same error in an answer I saw for subject "MySQL inner join". The problem is an error at the WHERE statement, as follows: "ERROR 2.5could not ...
1
vote
1
answer
27
views
prepoluate a generec createview
i want that a form is prepoluate with data
my model:
TYPE = (("S",'Swing'),
("R","Rapide"))
class valuation(models.Model):
stock = models.ForeignKey("...
0
votes
2
answers
27
views
generic class based view CreateView - how to compare the request.user to a certain modelobject.user
Inside my generic CreateView class based view, I want to compare the request.user to a certain modelinstance.user, and if the users dont match, I want to raise a 404 error, how can I achieve this? ...
1
vote
1
answer
38
views
DjangoRelatedObjectDoesNotExist at /profile/
I've been through in similar topics for days for a possible solution, however none of them solved my issue which seems pretty simple to me but I stucked on this error right after I created a user: ...
0
votes
3
answers
882
views
Insert default value in view without creating table in SQL
I have to create a view in SQL that has a set of default values without creating any tables, and I don't know if it is possible or not? Maybe something like this:
CREATE VIEW PersonalView
AS
...
0
votes
2
answers
140
views
possible Form Field Errors for ChangePasswordForm Django
I'm trying to customize the form field errors for a changepasswordview in Django, however, to do that I believe I need to know the attribute names of the field errors so that I can do something like ...
1
vote
1
answer
2k
views
How to resolve "Incorrect syntax near the keyword 'VIEW' error while creating view in dynamic SQL
I have a use case in which I need to create views in multiple databases using dynamic SQL. I realized that I can't give database name in front of the view in dynamic SQL, so used the use database ...
0
votes
2
answers
490
views
How to pass request.user with a ManyToMany Field in Django
I have two models Exercise and Area, Area has a manytomanyfield back to Exercise:
class Exercise(models.Model):
user = models.ForeignKey(Profile, on_delete=models.CASCADE)
name = models....
0
votes
1
answer
3k
views
How to update a specific manytomany field in django
My Area model has an exercise attribute with a ManyToManyField to my Exercise model:
class Area(models.Model):
name = models.CharField(max_length=100)
exercise = models.ManyToManyField(...
0
votes
1
answer
100
views
How can I handle multiple forms on one page using the DRY method
I have a total of 10 forms I need to display. I am using a DetailView to display them and a CreateView to handle their logic. So far my views.py looks like this:
from .forms import (
...